Re: [R] Linear model vs Mixed model

2016-07-13 Thread Utkarsh Singhal
Thanks Brian for all your kind help. "didn't mean to imply that the different parameterization of the contrasts would make the lm estimates agree more with the lmer estimates, only that it might be easier to compare the regression summary output to see how similar/dissimilar they were ". Got it

Re: [R] Linear model vs Mixed model

2016-07-13 Thread Cade, Brian
Utkarsh: I think the differences between the lm and lmer estimates of the intercept are consistent with the regularization effect expected with mixed-effects models where the estimates shrink towards the mean slightly. I don't think there is any reason to expect exact agreement between the lm and

Re: [R] Linear model vs Mixed model

2016-07-13 Thread Utkarsh Singhal
Hi Brian, This makes some sense to me theoretically, but doesn't pan out with my experiment. The contrasts default was the following as you said: > options("contrasts") $contrasts unordered ordered "contr.treatment" "contr.poly" I changed it as follows: >

Re: [R] Linear model vs Mixed model

2016-07-12 Thread Cade, Brian
Your lm() estimates are using the default contrasts of contr.treatment, providing an intercept corresponding to your subject 308 and the other subject* estimates are differences from subject 308 intercept. You could have specified this with contrasts as contr.sum and the estimates would be more

Re: [R] Linear model vs Mixed model

2016-07-12 Thread Utkarsh Singhal
Hello Thierry, Thank you for your quick response. Sorry, but I am not sure if I follow what you said. I get the following outputs from the two models: > coef(lmer(Reaction ~ Days + (1| Subject), sleepstudy)) Subject(Intercept) Days 308292.1888 10.46729 309173.5556 10.46729 310

Re: [R] Linear model vs Mixed model

2016-07-12 Thread Thierry Onkelinx
The parametrisation is different. The intercept in model 1 is the effect of the "average" subject at days == 0. The intercept in model 2 is the effect of the first subject at days == 0. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team