[R] Maximum Likelihood Estimation Poisson distribution mle {stats4}
chamilka
cmanoj4 at gmail.com
Thu Jul 5 10:48:11 CEST 2012
Hi everyone!
I am using the mle {stats4} to estimate the parameters of distributions by
MLE method. I have a problem with the examples they provided with the
mle{stats4} html files. Please check the example and my question below!
*Here is the mle html help file *
http://stat.ethz.ch/R-manual/R-devel/library/stats4/html/mle.html
http://stat.ethz.ch/R-manual/R-devel/library/stats4/html/mle.html
*In the example provided with the help *
> od <- options(digits = 5)
> x <- 0:10 *#generating Poisson counts*
> y <- c(26, 17, 13, 12, 20, 5, 9, 8, 5, 4, 8) *#generating the
> frequesncies*
>
## Easy one-dimensional MLE:
> nLL <- function(lambda) -sum(stats::dpois(y, lambda, log=TRUE)) *#they
> define the Poisson negative loglikelihood*
> fit0 <- mle(nLL, start = list(lambda = 5), nobs = NROW(y)) * #they
> estimate the Poisson parameter using mle*
> fit0 *#they call the output*
Call:
mle(minuslogl = nLL, start = list(lambda = 5), nobs = NROW(y))
Coefficients:
lambda
11.545 * #this is their estimated Lambda Vallue.*
*Now my question is in a Poisson distribution the Maximum Likelihood
estimator of the mean parameter lambda is the sample mean, so if we
calculate the sample mean of that generated Poisson distribution manually
using R we get the below!*
> sample.mean<- sum(x*y)/sum(y)
> sample.mean
[1] 3.5433
*This is the contradiction!! *
Here I am getting the estimate as 3.5433(which is reasonable as most of the
values are clustered around 3), but mle code gives the estimate 11.545(which
may not be correct as this is out side the range 0:10)
Why this contradiction?
--
View this message in context: http://r.789695.n4.nabble.com/Maximum-Likelihood-Estimation-Poisson-distribution-mle-stats4-tp4635464.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list