Help with lme code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Help with lme code

Pryseley Assam

Dear R - Users
  I have some problems fitting a linear mixed effects model using the lme function (from the library nlme). A sample data is as shown at the bottom of this mail. I fit my linear mixed model using the following R code:
   
  bmr <-lme (outcome~ -1 + as.factor(endpoint)+ as.factor(endpoint):trt, data=datt,
      random=~-1 + as.factor(endpoint) + as.factor(endpoint):trt|as.factor(Trial),
      correlation = corSymm(form=~subject|as.factor(endpoint)), weights=varIdent(form=~subject|endpoint))
   
  With this code, i want to obtain random effects for each Trial. ALso my residuals are correlated, and the correlated residuals are  heteroscedastic over endpoint. That is, each endpoint has a different constant variance.
   
  However, I recieve the following error message using the code above:
   
  Error in lme.formula(outcome ~ -1 + as.factor(endpoint) + as.factor(endpoint):trt,  :
        Incompatible formulas for groups in "random" and "correlation"
   
  May someone kindly inform me how to correct this code.
   
  Does this imply that the grouping factor in the correlation formula must be the same grouping factor in the random formula ? If so, is there a way of getting pass this restriction ?
 
Best regards
Pryseley
   
  Sample data:
   
  RowNames Trial subject VISUAL0  TRT VISUAL24 VISUAL52 TREAT outcome endpoint trt
4      1    1003      65   4       65       55     2       0        1   1
8      1    1007      67   1       64       68     2      -3        1  -1  
12      2    1110      59   4       53       42     2      -6        1   1  
14      2    1111      64   1       72       65     2       8        1  -1  
16      2    1112      39   1       37       37     2      -2        1  -1  
18      2    1115      59   4       54       58     2      -5        1   1  
24      3    1806      46   4       27       24     2     -19        1   1  
26      3    1813      31   4       33       48     2       2        1   1  
28      3    1815      64   1       67       64     2       3        1  -1  
4      1    1003      65   4       65       55     2     -10       -1   1    
8      1    1007      67   1       64       68     2       1       -1  -1    
12      2    1110      59   4       53       42     2     -17       -1   1    
14      2    1111      64   1       72       65     2       1       -1  -1    
16      2    1112      39   1       37       37     2      -2       -1  -1  
18      2    1115      59   4       54       58     2      -1       -1   1  
24      3    1806      46   4       27       24     2     -22       -1   1    
26     3    1813      31   4       33       48     2      17       -1   1    
28      3    1815      64   1       67       64     2       0       -1  -1    

   

               
---------------------------------

Bring photos to life! New PhotoMail  makes sharing a breeze.
        [[alternative HTML version deleted]]

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