Dear:

   I try to revise the maximum likelihood function below using something constrains. But it seems something wrong with it.  Becasue R would not allow me to edit the function like this. It is very appreciate if you can help.
  
function (parameters,y,x1,x2)

{

p<-parameters[1]

alpha1<-parameters[2]

beta1<-parameters[3)]

delta1<-parameters[4]

alpha2<-parameters[5]

mu<-alpha1*((x1)^beta1)*exp(-delta1*(x1^alpha2))

if(y>0 & x1>0 & x2==1,

L<-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

)

else

if(y>0 & x1>0 & x2==2,

L<-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

)

else

if(y>0 & x1>0 & x2==3,

L<-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

)

else

L

}

Thanks a lot!

Xin Shi

	[[alternative HTML version deleted]]

