1

I am trying to replicate a SAS model for a LINEAR MIXED MODEL WITH RANDOMIZED BLOCKS AND REPEATED MEASURES in R. My professor who works with SAS wrote the syntax in SAS for this test. My knowledge of SAS is very poor and hence my attempts in R. I am having trouble incorporating a repeated measures syntax into my R model. Please advice.

I am examining the association of animal abundances (model species) with a number of habitat variables (such as shrub density, moisture, wood) collected across 27 grids over three years. Abundance data were collected in summer and spring (season) across the three years.

random effects = grid

fixed effects = wood, moisture, shrubdensity

repeated measures = year and season

Here is the SAS code:

proc mixed data=SHREWDATA ic;
class grid year season treatment;
model species= year  season  shrubdensity  moisture  &wood  &wood*year  &wood*season/htype = 3  solution     DDFM=SATTERTHWAITE ;
random grid/solution;
repeated /subject=grid(treatment); 
lsmeans year season; run;

The ‘unit’ (subject) that is repeated from year to year and season to season are treatments within grid.

Here is my attempted R code using lme

modelspecies2 <- lme(modelspecies ~ year + season + shrubdensity + moisture + wood + wood * year + wood * season, random = list(~1|grid), data = SHREWDATA, method = "ML")

I have not seen any discussion that addresses mixed models with both repeated measures and randomixed blocks. I have tried to incorporate a repeated measures syntax, but I either get an error or do not get the same results as those in SAS for the same dataset.

eipi10
  • 91,525
  • 24
  • 209
  • 285
AKARVE
  • 11
  • 1

0 Answers0