From: Douglas Bates (firstname.lastname@example.org)
Date: Sun 16 May 2004 - 04:34:21 EST
Atropin75@t-online.de (Felix Eschenburg) writes:
> 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 and x) at the first (the subject) level, a grouping variable at the
> second level (G), and an explanatory variable at the second level (z)
> If I am correct, this leads to the following model (I will write indices in
> squared brackets and gamma as gm):
> y = gamma + gmx[1ij] + gm x[2ij] + gmz[1j]+ gmz[1j]x[1ij]
> + gmz[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
> 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
Just add it in the formula for the fixed-effects.
lme(y ~ x1*x2 + z,random = ~1|G)
Many references on multilevel modeling present the model in such a way
as to give the mistaken impression that a covariate defined to take
the same value across groups may only enter the model at the level of
those groups. Groups are not relevant to fixed effects. They only
matter in the definition of the random effects.
Remail@example.com mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST