## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## A Designed Experiment with Different Spatial Scales: Split Plots

The important distinction in models with categorical explanatory variables is between cases where the data come from a designed experiment, in which treatments were allocated to locations or subjects at random, and cases where the data come from an observational study in which the categorical variables are associated with an observation before the study. Here, we call the first case split-plot experiments and the second case hierarchical designs. The point is that their dataframes look identical, so it is easy to analyse one case wrongly as if it were the other. You need to be able to distinguish between fixed effects and random effects in both cases. Here is the linear model for a split-plot experiment analysed in Chapter 11 by aov (see p. 470).

```yields<-read.table("c:\\temp\\splityield.txt",header=T)
attach(yields)
names(yields)

[1]  "yield"  "block"  "irrigation"  "density"  "fertilizer"

library(nlme)```

The fixed-effects part of the model is specified in just the same way as in a straightforward factorial experiment: yield~irrigation*density*fertilizer. The random-effects part of the model says that we want the random variation to enter via effects on the intercept (which is parameter 1) as random=~1. Finally, we define the spatial structure of the random effects after the ‘given’ symbol | as: block/irrigation/density. There is no need to specify the smallest spatial scale (fertilizer plots in this example).

`model<-lme(yield~irrigation*density*fertilizer,random=~1|block/irrigation/density) ...`

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required