Francois Teste
2007-Apr-11 16:38 UTC
[R] Error with corCompSymm and lme fit for repeated measures
Dear R Friends, I need help with an error associated with corCompSymm in an lme fit. I am using a mixed effects model to analyze a split-plot with repeated measures and would like to fit with the compound symmetry correlation structure. This problem doesn't occur when using corAR1 or any of the other structures. I would greatly appreciate help on how to solve this issue. Here's my data, code lines, and error messages:> PhotoRedTreeID Block M D Time y 1 1 Dgl s1 0.5m june 2.91130232 2 1 Dgl s1 1.0m june 4.92232779 3 1 Dgl s1 2.5m june 6.17724409 4 1 Dgl s1 5.0m june 3.34278032 5 1 Dgl s1 0.5m july 6.30782170 6 1 Dgl s1 1.0m july 6.98652976 7 1 Dgl s1 2.5m july 8.80715989 8 1 Dgl s1 5.0m july 7.19424460 9 1 Dgl s1 0.5m august 4.46399690 10 1 Dgl s1 1.0m august 10.63857941 11 1 Dgl s1 2.5m august 9.84689405 12 1 Dgl s1 5.0m august 13.15311387 13 2 Dgl s4 0.5m june 5.37380975 14 2 Dgl s4 1.0m june 4.05953992 15 2 Dgl s4 2.5m june 6.53184737 16 2 Dgl s4 5.0m june 4.85340448 17 2 Dgl s4 0.5m july 3.77109456 18 2 Dgl s4 1.0m july 6.64288350 19 2 Dgl s4 2.5m july 9.74241641 20 2 Dgl s4 5.0m july 5.10884682 21 2 Dgl s4 0.5m august 8.01357594 22 2 Dgl s4 1.0m august 5.31430680 23 2 Dgl s4 2.5m august 10.62809063 24 2 Dgl s4 5.0m august 10.30284109 25 3 Dog s1 0.5m june NA 26 3 Dog s1 1.0m june 3.29442388 27 3 Dog s1 2.5m june 1.02478107 28 3 Dog s1 5.0m june NA 29 3 Dog s1 0.5m july NA 30 3 Dog s1 1.0m july 2.19628259 31 3 Dog s1 2.5m july 1.11794299 32 3 Dog s1 5.0m july NA 33 3 Dog s1 0.5m august NA 34 3 Dog s1 1.0m august 2.44031399 35 3 Dog s1 2.5m august 0.37264766 36 3 Dog s1 5.0m august NA 37 4 Dog s4 0.5m june 4.33381487 38 4 Dog s4 1.0m june 1.34196737 39 4 Dog s4 2.5m june 0.12930756 40 4 Dog s4 5.0m june 6.51695980 41 4 Dog s4 0.5m july 1.33348150 42 4 Dog s4 1.0m july 2.81174115 43 4 Dog s4 2.5m july 7.69379970 44 4 Dog s4 5.0m july 6.35992462 45 4 Dog s4 0.5m august 3.66707412 46 4 Dog s4 1.0m august 0.44732246 47 4 Dog s4 2.5m august 7.75845348 48 4 Dog s4 5.0m august 5.96733668 49 6 F s1 0.5m june 6.98640483 50 6 F s1 1.0m june 8.14953755 51 6 F s1 2.5m june 4.50763794 52 6 F s1 5.0m june 6.62297344 53 6 F s1 0.5m july 13.59516616 54 6 F s1 1.0m july 9.31375720 55 6 F s1 2.5m july 8.01357856 56 6 F s1 5.0m july 3.72542256 57 6 F s1 0.5m august 2.45468278 58 6 F s1 1.0m august 2.13440269 59 6 F s1 2.5m august 0.08347478 60 6 F s1 5.0m august NA 61 7 F s4 0.5m june NA 62 7 F s4 1.0m june NA 63 7 F s4 2.5m june 6.03948199 64 7 F s4 5.0m june 5.73051868 65 7 F s4 0.5m july NA 66 7 F s4 1.0m july NA 67 7 F s4 2.5m july 10.27613353 68 7 F s4 5.0m july 8.00803252 69 7 F s4 0.5m august NA 70 7 F s4 1.0m august NA 71 7 F s4 2.5m august 10.27613353 72 7 F s4 5.0m august 7.34681883> lme1 = lme(y ~ M*D*Time, random=~1|Block/M/D/Time, data=PhotoRed, na.action=na.omit) > lme2 = update(lme1, correlation=corAR1()) > lme3 = update(lme1, correlation=corCompSymm())Error in corMatrix.corCompSymm(object) : NA/NaN/Inf in foreign function call (arg 1)> cs = corCompSymm(value=0.5,form=~1|TreeID) > lme3 = update(lme1, correlation=cs)Error in lme.formula(fixed = y ~ M * D * Time, data = PhotoRed, random = ~1 | : Incompatible formulas for groups in "random" and "correlation">-- Francois Teste (Ph.D. candidate) The University of British Columbia Department of Forest Sciences 3041-2424 Main Mall Vancouver, B.C., Canada, V6T 1Z4