1. I'm attempting to test for Random Effects. I've grouped the data on subject (grid) but want to use lme to build the model without subject as a RE then add it and do anova between the 2 models. This is the result I get and it appears it's adding Random Effects. tmp.dat4 <- groupedData(Trials ~ 1 | grid, data = tmp.dat4) mod2a <- lme(Trials ~ factor(group_id) + reversal, data = tmp.dat4, na.action = na.omit, method = "REML")> summary(mod2a)Linear mixed-effects model fit by REML Data: tmp.dat4 AIC BIC logLik 4544.054 4587.718 -2262.027 Random effects: Formula: ~factor(group_id) + reversal | grid Structure: General positive-definite StdDev Corr (Intercept) 10.505303 (Intr) fc(_)2 factor(group_id)2 9.830679 -0.778 reversal2 7.106839 -0.275 0.023 Residual 9.995963 Fixed effects: Trials ~ factor(group_id) + reversal Value Std.Error DF t-value p-value (Intercept) 23.275874 1.876185 510 12.405960 0e+00 factor(group_id)2 -7.639842 2.151004 72 -3.551757 7e-04 reversal2 7.681495 1.206858 510 6.364869 0e+00 Correlation: (Intr) fc(_)2 factor(group_id)2 -0.785 reversal2 -0.308 -0.015 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.6884393 -0.5059063 -0.1892908 0.4944976 2.8477377 Number of Observations: 585 Number of Groups: 74 2. Secondly is this the correct way to add covariates (such as age). mod2i <- lme(Trials ~ factor(group_id)*factor(reversal) * age, data tmp.dat4, random = ~ 1 | grid, na.action = na.omit, method = "ML") -- View this message in context: http://r.789695.n4.nabble.com/lme-Random-Effects-and-Covariates-tp3049181p3049181.html Sent from the R help mailing list archive at Nabble.com.
Huso, Manuela
2010-Dec-03 00:12 UTC
[R] help with lme random = syntax and groupedData syntax
Hello, all, I have a fairly complicated experimental design and would really appreciate some help on correctly specifying my random effects. I have a CRD split plot design with one covariate measured on the whole plot unit, one on the subplot unit and 2 other covariates measured on the subsamples in the subplot unit. My design is actually unbalanced, but if it *were* balanced, I would have 7 REP (replicates) each of 3 treatments (TRTMNT1 = whole plot unit are forest stands), each split into 5 TRTMNT2 (subplot units are 25x25m plots), in which 3 to 7 TREES were measured (subsampling units). In addition, I have 1 continuous covariate (ELEV = elevation) measured on the whole plot units (i.e. all measurements in each REP have the same measure of ELEV), 1 continuous covariate measured on the subplot unit (DENSITY of all trees in the subplot unit, so all trees in the subplot have the same measure of density, but each subplot within a whole plot has a different measure) and 2 continuous covariates (HEIGHT and DBH) measured on the subsampling units (trees). I do not understand the syntax of the lme random effects to properly describe my structure to make sure that the test of the effect of my covariates, ELEV measured on the whole plot unit and effect of DENSITY measured on the subplot unit, are correctly specified, with correct df in numerator and denominator, etc. What is the syntax for this random effects structure? How do I indicate that ELEV is measured on the whole plot level, DENSITY on the subplot and HEIGHT and DBH on the tree level? I have read in Pinheiro and Bates about the outer factors, but am not sure how to apply it here. I would greatly appreciate it if some someone could suggest the correct syntax for the lme random = and also syntax to make my data into a groupedData object. Many thanks in advance, Manuela