From: Xin <jasonshi510_at_hotmail.com>

Date: Sun 23 Jul 2006 - 00:59:56 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun Jul 23 01:04:47 2006

Date: Sun 23 Jul 2006 - 00:59:56 EST

Dear:

Continuing the issue of 'ifelse'! I selecting the data whose 'x2'=1 for maximizing likelihood. I used two way to do this but the results are different.

1.Way one I use the data for x2=1 and run the program. It works for me. Tthe program is described as below:
function (parameters,y1,x11)

*{
*

p<-parameters[1]

alpha1<-parameters[2]

beta1<-parameters[3]

delta1<-parameters[4]

lamda1<-parameters[5]

mu<-alpha1*((x11)^beta1)*exp(-delta1*(x11^lamda1))

ifelse(y1>0|x11>0,

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

,Inf)

L

}

This is working for me.

2 Way two: I select the data whose x2=1 in the whole range of data. It works but it is not right comparing the value of MLE. the program is: 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(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

L

}

The reason why I edit the program by the second way is I want to use one program for getting results of the different range of data.

Anyone can help? Please!

Thanks!

Xin Shi

[[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun Jul 23 01:04:47 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Sun 23 Jul 2006 - 04:15:40 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*