[R] parameter estimation
Douglas Bates
bates at stat.wisc.edu
Wed May 17 15:19:05 CEST 2000
Vittorio Addona <vaddon at po-box.mcgill.ca> writes:
> Hello, my question is the following: from a data set (assuming the data
> has a parametric form, gamma, say) how can I estimate the parameters of
> the data's density. That is,
> for the gamma, say, how can I estimate alpha and beta using R? Thank
> you.
One possibility is to use maximum likelihood, which is surprisingly
easy to implement in R. The log-likelihood function for the parameters
alpha and beta given the data x is
sum(dgamma(x, shape = alpha, scale = beta, log = TRUE))
To determine the maximum likelihood estimates, simply put the negative
of the log-likelihood into the optim function.
A worked-out example is given as xmp06.12 in the Devore5 library
(available in the contrib section at CRAN). Use
library(Devore5)
help(xmp06.12) # shows the description with comments
example(xmp06.12) # run the example to see the result
That example also shows the calculations for the method of moments
estimators but I would not recommend them.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list