[R-sig-ME] Nested Mixed Models in lme4

Marco Chiarandini marco at imada.sdu.dk
Fri Nov 9 17:41:34 CET 2007


Dear Prof. Bates,


>> I am trying to use the function lmer from lme4 to
>> analyse the following nested factorial design.
> 
>> I have three treatment factors (neighborhood,
>> initial, k);
>> I have three group factors crossing (size, dens,
>> inst).
> 
> Did you mean to write (size, dens, type) there?
> 
> Also, by "factor" do you mean that you regard all of these variables
> as categorical?  If so, you should check the form of the size variable
> in the data frame.  It is being stored as a numeric variable, not as a
> factor.  If you want to interpret this  variable as a categorical
> factor you should convert it to a factor or, as seems likely in this
> case, an ordered factor.  (See ?factor and ?ordered)


yes, thank you a lot! All your corrections are 
appropriate! inst should have been type and all 
variables should have been categorical. My mistake.
Also: as you correctly pointed out, the data are 
from a computer experiment and perfectly balanced, 
and by group factors I meant blocking factors.

Your very clear explanation solved my concerns 
about the nesting! Thanks!

I've also redone the comparison with SAS and now 
results correspond.
The reason was mainly that I needed a quite 
different formula:

lmer(err~initial*neighborhood + initial*k + 
initial*type + initial*size + initial*dens + 
neighborhood*k + neighborhood*type + 
neighborhood*size + neighborhood*dens + k*type + 
k*size + k*dens + type*size + type*dens + 
size*dens + initial*neighborhood*k + 
(1|inst),data=Case3)

True also that we were using lsmeans in SAS that 
you discourage.

To me it would remain only to understand how I 
could obtain the results in a cell means format 
like those in SAS. But this seems to be a problem 
also in lm and hence I must probably study better 
how things work to find the way. Trying something 
of the kind:

fmm1 <- 
lmer(err~-1+ordered(size)+dens+type+(k+initial+neighborhood)^3+(1|inst),data=Case3)

does not seem to help much.

I left all the analysis I did, code + results, 
(SAS and R) at:

http://www.imada.sdu.dk/~marco/Mixed/


Thank you a lot very much for the help!

Best regards,

Marco



-- 
Marco Chiarandini 
http://www.imada.sdu.dk/~marco
Department of Mathematics	      Email: 
marco at imada.sdu.dk
and Computer Science,		      Phone: +45 6550 4031
University of Southern Denmark        Fax: +45 
6593 2691




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