In many cases we have a model with subsamples; as we have seen earlier. This arises when the experimental unit and the sampling unit are not the same. For example, imagine that we have a group of 54 pigs and we divide them up into groups of 6 pigs and put them in 9 pens. We have 3 diets and we randomly assign the 3 diets to the pens, so that we have 3 pens on each diet. In each pen there is a trough into which we put the feed, so that all pigs have free and equal access. We weigh each pig at the start of the experiment and at the end and then calculate te difference; it is that difference that we shall be looking at as our dependent variable (outcome). We have 54 pigs and hence 54 weight-gains. BUT, the experimental unit, to which the treatment was applied, was the pen and NOT the pig; pigs are the subsampling unit. It does not matter that it was the pigs that ate the feed and not the pen; the pigs were still a group. If one ignored this elementary fact and analysed the data one would in all likelihood come up with overly optimistic results; i.e. rubbish. Additionally, we may well have a mixture of male and female pigs. It does not matter that it is the pigs that ate the feed and not the 'pen' eating the feed; the animals were a 'group' and this MUST be accounted for.
The statistical model will be:
The data, in the form of the SAS code and data step to input said data are given below.
data subsamp2; input diet pen pig gain sex; cards; 1 1 1 241.47 2 1 1 2 266.13 1 1 1 3 201.13 2 1 1 4 314.11 1 1 1 5 234.54 1 1 1 6 256.76 2 1 2 1 343.85 1 1 2 2 278.91 1 1 2 3 263.21 2 1 2 4 299.79 2 1 2 5 329.00 2 1 2 6 343.61 1 1 3 1 257.04 2 1 3 2 340.12 1 1 3 3 276.31 2 1 3 4 293.03 1 1 3 5 322.97 1 1 3 6 313.31 1 2 1 1 268.52 1 2 1 2 271.46 2 2 1 3 269.41 2 2 1 4 242.54 2 2 1 5 265.53 2 2 1 6 281.51 1 2 2 1 355.27 1 2 2 2 291.54 1 2 2 3 308.28 1 2 2 4 275.09 1 2 2 5 301.42 2 2 2 6 312.66 2 2 3 1 287.78 1 2 3 2 356.63 1 2 3 3 347.70 1 2 3 4 339.20 1 2 3 5 334.41 2 2 3 6 259.72 2 3 1 1 316.33 2 3 1 2 354.47 1 3 1 3 340.59 2 3 1 4 395.03 2 3 1 5 372.19 2 3 1 6 375.58 1 3 2 1 317.48 1 3 2 2 287.57 2 3 2 3 348.24 2 3 2 4 336.53 2 3 2 5 283.04 2 3 2 6 310.32 1 3 3 1 341.39 2 3 3 2 350.02 1 3 3 3 380.93 1 3 3 4 395.15 1 3 3 5 365.06 1 3 3 6 364.22 1 ;
Anything else to our model?
Well. IFF all our pigs were the same sex then no, our model would be complete (apart from the residual error [the variation amongst pigs within pen].
As described, there IS more; we have piglets of different sexes, males and females. We cannot and should not ignore this. How do we consider the effect of sex?
WELL. We should recognise that this is an example of a 'split-plot'. We have sub-divided our group of piglets (pen, aka 'plot') into 2 sub-groups (males and females). So, we shall add to our model an effect of sex and a diet-by-sex interaction.
Our model is now:
Yijk = mu + dieti + penij +
sexk + diet*sexik + eijk
and our SAS code is:
proc mixed data=subsamp2 lognote; class diet pen sex; model gain = diet sex diet*sex/ddfm=kr; random pen(diet); run;