[R-sig-ME] Likelihood

Ben Bolker bbolker at gmail.com
Thu Nov 29 23:05:04 CET 2012

Bonitta Gianluca <bbonit at ...> writes:

> Thank professor Ben. 

 (Probably "Professor Bolker" or "Ben" ...)

> I think that i had used a wrong version..
> ok all work...in right mode.
> Is it possible to see this function in analytical form (oh yes his 
> implementation )? Because i can see that devFunOnly=TRUE will use a .Call. 

  ?? Not really.  You can look in the code by browsing
https://github.com/lme4/lme4 , but it's not simple ...
  The book draft PDF linked from http://lme4.r-forge.r-project.org 
gives some of the computational details.

> the deviance is negative twice the log-likelihood  but when i use this 
> function
> For to have likelihook function  
>                                             (oh yes inverse function of dev, 
> but maby for metropolis ratio ( difference in case of log transformation) i 
> can use also deviance because i'm appling on the top and on the bottom of 
> ratio (difference)  the same (biunivocal)transformation for likelihood 
> function that is dev)

  If you need the likelihood, it's just exp(-deviance/2) ...

> i must set REML=F in 
> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy, 
> devFunOnly=TRUE,REML=T) 
> My problem is that the fm1 model (or better his likelihood)  have more than
> 3 params  ( vector theta labelled from lmer)  only the random intercept
>  params 
> are 18 if i dont wrong..  could be this function return the profile deviance.

  Yes.  There is no simple way at present to get the deviance conditional
on the random effects.

  If you're doing an MCMC approach anyway, have you considered any
of the MCMC-based packages in R (MCMCglmm) or elsewhere (JAGS, WinBUGS,

  Ben Bolker

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