Re: [R] Again some questions about multilevelanalysis

About this list Date view Thread view Subject view Author view Attachment view

From: Douglas Bates (bates@stat.wisc.edu)
Date: Sun 16 May 2004 - 04:34:21 EST


Message-id: <6rfza1v8sy.fsf@bates4.stat.wisc.edu>

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[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

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.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST