[R-sig-ME] logLik (old-fashion way) for mixed-effects models

Douglas Bates bates at stat.wisc.edu
Thu Apr 16 15:34:22 CEST 2009


On Thu, Apr 16, 2009 at 4:03 AM, Christian Salas
<christian.salas at yale.edu> wrote:
> If i already fit a lm() model, i can obtain the log-likelihood [i do not
>  want to use AIC()] using the residuals from the model, and using the
>  RMSE of the model as sigma for my normal pdf. This would be in R like

But the RMSE is not the maximum likelihood estimate of sigma.  It's
the REML estimate but not the MLE.

>> sum(dnorm(-resi,mean=0,sd=sigma,log=T))  [1]
>
>  if i fit a gls model i can do the same
>
>  for a lme() model, i know that we cannot just use the same loglik model
>  [1], because they are different. I wonder if somedody already have some
> syntax in R similar to [1] but for  mixed-effects models, i mean something
> that compute the log-likelihood but without using lme() directly as
> summary(lme.obj)$AIC

Assuming that you fit with method = "ML" then wouldn't it be simplest
just to use

logLik(lme.obj)

It isn't clear from your question whether you want another approach
involving residuals, etc. or if it is just the fact that you are not
aware of the logLik generic.

>  thanks in advance!
>
> -------------------------------------------------------------------------------
> Christian Salas                     E-mail:christian.salas at yale.edu
> PhD candidate                       http://environment.yale.edu/salas
> School of Forestry and Environmental Studies
> Yale University                     Tel: +1-(203)-432 5126
> 360 Prospect St                     Fax:+1-(203)-432 3809
> New Haven, CT 06511-2189            Office: Room 35, Marsh Hall
> USA
>
> Yale Biometrics Lab                  http://environment.yale.edu/biometrics
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




More information about the R-sig-mixed-models mailing list