##### Nested Designs - Split plot designs and other designs ### import data - data set 1 (splitplot) datum=read.csv(file.choose()) head(datum) ###Analyze data: water plots nested within fertilizer plots, nested within cow plots, nested within fields results=lme(Biomass~Cow+Fertilizer+Water,data=datum,random=~1|Field/Cow/Fertilizer) # no need for 'water' in random effect, water plots are the residual errors (only measured once) anova(results) summary(results) # Notice appropriate den degrees of freedom, accounting for nested samples (pseudoreplicates) ### import data - dataset 2 (Nested ANCOVA) datum=read.csv(file.choose()) head(datum) ###Analyze data: block by individual, which is nested within sex results=lme(Biomass~Age+Sex,data=datum,random=~1|Individual) anova(results) # notice appropriate den degree of freedom, accounting for nested samples (pseudoreplicated by sex) summary(results) ### Analyze data with interaction (no interaction in data) results=lme(Biomass~Age+Sex+Sex:Age,data=datum,random=~1|Individual) anova(results) summary(results) # Note that sex:age is not pseudoreplicated; uses full error term