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

Douglas Bates bates at stat.wisc.edu
Thu Apr 16 16:16:58 CEST 2009

On Thu, Apr 16, 2009 at 8:50 AM, Christian Salas
<christian.salas at yale.edu> wrote:
> Dear Prof. Bates:

> I am aware of the logLik(lme.obj),  sorry if i was not clear before.
> What I am aiming to find is a similar syntax (to the one that i use for lm)
> involving the residuals from a lme fitted object, but without using
> logLik(lme.obj), that allows me to compute the log-likelihood value of the
> fitted model. Probably this would require retrieving both the ML sigma for
> the errors and the sigma for the random effects of the lme.obj

But that is not sufficient.  The log-likelihood for a mixed-effects
model involves the determinant of the conditional variance-covariance
matrix of the random effects, given the observed data and the
parameter estimates.

> Douglas Bates wrote:
>> 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