Skip to content

log Likelihood depends on contrasts?

2 messages · Martin Henry H. Stevens, Douglas Bates

#
Hi folks,
I didn't realize log likelihood of a model depended on the particular  
specification of contrasts.

Example

 > str(cake)
'data.frame':	270 obs. of  5 variables:
$ replicate  : Factor w/ 15 levels "1","2","3","4",..: 1 1 1 1 1 1 1  
1 1 1 ...
$ batch      : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 2 2 2 2 ...
$ recipe     : Factor w/ 3 levels "1","2","3": 1 1 1 1 1 1 2 2 2 2 ...
$ temperature: Ord.factor w/ 6 levels "175"<"185"<"195"<..: 1 2 3 4 5  
6 1 2 3 4 ...
$ angle      : int  42 46 47 39 53 42 39 46 51 49 ...
 > options(contrasts=c("contr.treatment", "contr.poly"))
 > mod.t <- lmer(angle ~ recipe + (1|batch), data=cake)
 > options(contrasts=c("contr.sum", "contr.poly"))
 > mod.s <- lmer(angle ~ recipe + (1|batch), data=cake)
 > logLik(mod.t)
'log Lik.' -947.82 (df=4)
 > logLik(mod.s)
'log Lik.' -948.92 (df=4)
 >

Any insight is appreciated.

Many thanks,
Hank


Dr. Hank Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/

"E Pluribus Unum"
#
On 5/10/07, Martin Henry H. Stevens <HStevens at muohio.edu> wrote:
What you are seeing is the log-restricted-likelihood which does depend
upon that parameterization used for the fixed effects, hence on the
contrasts used for a factor.  If you were to fit both models with
method = "ML" then you would get the same value of the log-likelihood
as shown in the enclosed.

The REML criterion does not always behave like a likelihood.  In
particular there is a term in the REML criterion that depends on the
form of the model matrix for the fixed effects.

(By the way, the model fit in your example doesn't make sense.  It
appears that batch and recipe are the same factor and should not be
included as a fixed effect and as a random effect.)
-------------- next part --------------
[1] "contr.treatment"  "contr.poly"
'log Lik.' -848.0789 (df=5)
'log Lik.' -848.0789 (df=5)