[R] a question about linear mixed model in R

Peter Muhlberger peterm at andrew.cmu.edu
Wed Jan 19 19:41:20 CET 2005


On 1/19/05 10:31 AM, "Chung Chang" <cc2240 at columbia.edu> wrote:

> Thanks for your post.
> Yes, your example is indeed similar to my question.
> If i means group, j means individual(subject)

Isn't 'i' individual & j group?

> h:indicator(0:control;1:experiment) k:repeat(if no repeat then k=1)
> the the model is also X_hijk = alpha_h + h * b_i + r_(ij) + e_hijk.
> 
> After I posted this question, I found out how to do it in R.
> So I would like to share with you guys and hear the comments from
> you. 
> X:response,b_i subject effect, r(ij) nested effect within subject
> 
> lme(X~alpha_h,data=dataset,random=list(subject=~h-1,r=~1),method="ML
> ",na.action="na.omit")
> the fixed effect part is alpha_h
> the random effect is subject effect, the corresponding coefficient
> is h and -1 means no random intercept of subject.
> and random effect of r(nested effect within subject)
> Thanks for your help

Hi Chung Chang:  I gather that subject & r above are the grouping variables.
subject would indicate each individual participant, which probably means you
must have multiple observations per individual.  I'm not clear why you would
nest within subject for h but within r for the model constant, but then I
don't know details about your experiment.

Let me see, though, whether I can apply this to my own experiment
(simplified):

Participants engaged in a 2X2 experiment:

c1 (condition 1):  0, 1 indicator.  1=person participated in group-based
political discussion.  0=no group-based discussion (individual sit & think).

c2:  1=person received a citizenship prime.  0=no citizenship prime

c1 & c2 are crossed to yield 4 cells.

grp=a 1:n variable indicating which discussion group a person was in, and
n+1 for those in no discussion (c1==0)

V=some continuous covariate of Y, but one whose coefficient I suspect may be
affected through discussion groups, for those people who were in discussion.

a=constant

lm Model (expanded for clarity):

Y ~ a + c1 + c2 + c1:c2 + V

If I understood correctly, you are suggesting the following lme Model:

Fixed Model for lme:

Y ~ a + c1 + c2 + c1:c2 + c1:V + V

list(grp = ~ c1 + c1:c2 + c1:V)

Is this what you had in mind?

Thanks,

Peter




More information about the R-help mailing list