# [R] help with lme random = syntax and groupedData syntax

Huso, Manuela manuela.huso at oregonstate.edu
Fri Dec 3 01:12:44 CET 2010

```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.