maximum likelihood estimation
pari hesabi  
6:04 AM 
To: r-help@r-project.org
Hello,
As an example for Exponential distribution the MLE is got by this structure:
t <- rexp(100, 2)
loglik <- function(theta){ log(theta) - theta*t}
a <- maxLik(loglik, start=1)
print(a)

Exponential distribution has a simple loglikelihood function.  But if a new pdf 
has a more complicated form like:
pr(N(2)=n)= integral( ((2-x)^n)*(exp(ax-2))) - integral (((5-ax)^n)), both 
integrals are defined over the interval(0,2) with respect to x.  
 I  also need to use the loglike of the form : [F log(pr(n))]=lnL  where F is 
the vector of observations and (n) is the vector of input for  the defined pmf. 
 Do you think how I can insert (define) the  pr(n) in the loop below? 
My question is related to:    loglik <- function(a) sum(F*(log(pr(n)))?



> > n <- c(0,1,2,3,4,5,6,7,8)
> > F<-c(0,0,1,3,5,7,8,11,10)
> > loglik <- function(a) sum(F*(log(pr(n)))??????
> > re <- maxLik (loglik, start=.5)
> > summary(re)

I would be grateful if you let me know your idea.
Best Regards,
pari

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to