[R] Again some questions about multilevelanalysis

Felix Eschenburg Atropin75 at t-online.de
Sat May 15 19:40:50 CEST 2004


Dear list,

I asked some questions about multilevelanalysis a couple of months ago. In the 
meantime I did some reading about the subject. Now I'd like to check, if I 
understood it all correctly. If you think my questions are not appropriate 
for this list, please tell me so and i will immediatly stop asking them. 

I have a dataset with one predicted variable (y), two explanatory variables 
(x[1] and x[2]) at the first (the subject) level, a grouping variable at the 
second level (G), and an explanatory variable at the second level (z[1]) 

If I am correct, this leads to the following model (I will write indices in 
squared brackets and gamma as gm):

y = gamma[00] + gm[10]x[1ij] + gm[20] x[2ij] + gm[01]z[1j]+ gm[11]z[1j]x[1ij] 
+ gm[21]z[1j]x[2ij] + U[0j] + U[1j]x[1ij] + U[2j]x[2ij] + R[ij]  


Now I start modelling step by step and I would appreciate any corrections if I 
got something wrong.

An empty model:
e.model <- lme(y~1,random=~1|G)

With one explanatory variable:
fm1.lme <- lme(y~x1,random = ~1|G)

With two exp. variables, assuming that there are only maineffects for my 
variables:
fm2.lme <- lme(y ~ x1 + x2+ ... + x7, random = ~1|G)

The same, adding an interaction effect:
fm3.lme <- lme(y~x1*x2,random=~1|G)

This is how far i got. Now i would like to add the z-variable into the model.
How do i do this ?

Yours sincerly 
Felix Eschenburg




More information about the R-help mailing list