Shige Song <shigesong <at> gmail.com> writes: > > Hi Abderrahim, > > I find this book particularly helpful: > http://www.meb.ki.se/~yudpaw/likelihood/likelihood-index.htm > > Shige > > On Fri, Oct 1, 2010 at 12:15 PM, abderrahim youssef > <abderrahim1302 <at> googlemail.com> wrote: > > Dear R help list, > > > > I am desperately looking for any reference explaining by examples how to > > write R codes in order to fit the parameters of a given model using maximum > > likelihood or any other criteria function. I know the general structure: > > First write a code for the maximum likelihood function and afterwards write > > a code to maximize it using optim and then invert the Hessian to get the > > standard errors and p-values. What I want is to find a document which > > gives in detail the R code to do so for some given examples such as > > linear mixed effect models, survival analysis etc ... where the likelihood > > has a closed form and when it doesn't have a closed form ... I will then > > follow the same structure to fit my own model.
You could take a look at the examples for the mle function in the 'stats4' package; maxLik in the "maxLik" package; or mle2 in the 'bbmle' package ('bbmle' also has a vignette). For what it's worth, likelihood estimation for mixed effects models is non-trivial -- it involves either numerical integration or clever analytical reduction to find a good approximation or (in the case of linear mixed effect models) avoid the numerical integration altogether. Not where I would start. (Parametric) survival analysis should be easier. ______________________________________________ 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.