# [R] Help with Mixed effect modeling in R

From: Kulkarni, Rohit <rohit.kulkarni_at_roche.com>
Date: Tue, 06 May 2008 18:06:23 -0700

Hi everyone,

I want to fit the following mixed effect model

Y_ij = b_0i + b_1i * (t_ij*grp_ij == 1) + b_2i * (t_ij*grp_ij == 2) + v_0i + v_1i*t_ij + e_ij

with a different covariance matrix of random effects for each group.

(Y is the response

t is time

grp is the group indicator

b 's are fixed effects

v 's are random effects)

I know that this is possible in SAS (I am no expert in SAS, I just looked up some notes) as

• Fit a model with a same diagonal Ri matrix for;
• each group.
• D = (2x2) unstructured matrix differs across groups;
• Specified in the RANDOM statement by the GROUP=grp option;

title 'RANDOM COEFFICIENT MODEL WITH DIAGONAL WITHIN-PATIENT';

title1 'DIFFERENT D MATRIX FOR BOTH GENDERS';

proc mixed method=ml data=dent1;

class pt grp;

model y = grp grp*t / noint solution;

random intercept t / type=un group=grp subject=pt g gcorr v vcorr;

run;

The key to specifying different covariance structure for the random effects seems to be the highlighted portion in the code. What would be it's equivalent in R?

In R, I tried the following

Model1 <- lme(y ~ g1+Tg1+g2+Tg2-1,random = pdBlocked(list(pdSymm(~g1+Tg1-1),pdSymm(~g2+Tg2-1))),data=X.gr,control=c on)

where, g1 and g2 are the group indicator variables and Tg1 = t*(grp==1), similarly Tg2 is defined.

I am forced to assume different intercept for each group in this approach but anyway this works and gives me some output.

Now, I have 5 groups (and there 7 measurements on each subject). I specify the corresponding formula for all 5 groups, it returns a message :

Warning message:

Fewer observations than random effects in all level 1 groups

This creates a doubt in me that possibly this is not the correct way to specify the model I am interested in.

I would appreciate if someone can help me sort out things.

Thanks.

~ Rohit

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 07 May 2008 - 02:43:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 07 May 2008 - 03:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.