Hi,

 

I have a multilevel situation where subjects are nested within clinics, and
each subject has multiple measurements.

For simplicity, suppose there 4 clinics, 3 subjects per clinic, and each
subject has 3 repeated measures.

Outcome is continuous. I am trying to implement this model with lmer
function in lme4 library.

 

lmeobj1<-lmer(outcome~med+time+medtime+(time|clinid)+(subjid|clinid)) 

 

My data set is as follows: med has two levels, time has three levels,
medtime is the interaction between med and time, subjid is the id numbers
for subjects,

clinid is the id numbers for clinics. I pasted the data below.

 

The above code is giving the same results with fixed effects regression. In
addition, whatever I put as random effects

is not making a difference at all. What am I doing wrong?

 

>cbind(outcome,med,time,medtime,subjid,clinid)

 

         outcome   med  time medtime subjid  clinid

[1,]    0.8511317      0       0       0        10         4

[2,]    3.9524773      0       1       0        10         4

[3,]    2.1637332      0       2       0        10         4

[4,]    1.6713403      1       0       0         1         1

[5,]    1.7379582      1       1       1         1         1

[6,]    5.0951544      1       2       2         1         1

[7,]    0.9523377      1       0       0         2         1

[8,]    2.4599613      1       1       1         2         1

[9,]    5.1759744      1       2       2         2         1

[10,]   -0.9495338      1       0       0         4         2

[11,]    2.9300264      1       1       1         4         2

[12,]    3.7025651      1       2       2         4         2

[13,]    1.1628554      1       0       0         6         2

[14,]    4.1536130      1       1       1         6         2

[15,]    5.0869188      1       2       2         6         2

[16,]    0.3114241      0       0       0         7         3

[17,]    0.6007636      0       1       0         7         3

[18,]    2.2783941      0       2       0         7         3

[19,]   -0.7095164      0       0       0         8         3

[20,]   -0.1541448      0       1       0         8         3

[21,]    1.6037837      0       2       0         8         3

[22,]    1.9994632      0       0       0         9         3

[23,]    0.8047261      0       1       0         9         3

[24,]    0.1828438      0       2       0         9         3

[25,]    2.7219649      0       0       0        12         4

[26,]    2.3046305      0       1       0        12         4

[27,]    1.1838549      0       2       0        12         4

[28,]    0.6292358      1       0       0         3         1

[29,]    2.9953366      1       1       1         3         1

[30,]    3.9291266      1       2       2         3         1

[31,]    0.8726671      0       0       0        11         4

[32,]   -0.4657651      0       1       0        11         4

[33,]    3.0364098      0       2       0        11         4

[34,]    0.3046405      1       0       0         5         2

[35,]    0.8789185      1       1       1         5         2

[36,]    4.1729769      1       2       2         5         2

 

Thanks,


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to