[R] Maximum likelihood Estimation

Parvin Dehghani parvin_dehghani at yahoo.com
Fri Oct 10 14:38:04 CEST 2014



maximum likelihood estimation
pari hesabi  
6:04 AM 
To: r-help at 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]]



More information about the R-help mailing list