13.2  Coding for Carryover Covariates
Earlier in the course I mentioned that coding in ANOVA can be tricky business, and here is a prime example. Steve Arnold, formerly teaching this course and now retired, devised this coding strategy to code for carryover effects. The best way to see how it works is going through an example.
The example we will work through appears in the textbook Design of Experiments, by Kuehl, as example 16.1. Investigators want to evaluate the effect of 3 diets on Neutral Detergent Fiber (NDF) levels in steer. The three diets are administered to each steer in a sequence over 3 periods. A total of 6 sequences were used and two steers were assigned to each sequence of treatments.
The crossover design can be summarized as:
Period  
Sequence  1  2  3 
1  A  B  C 
2  B  C  A 
3  C  A  B 
4  A  C  B 
5  B  A  C 
6  C  B  A 
If we look at the the first part of the dataset (steer_data.txt) for this example in Excel , we can see the following:
We need now to add two columns to use an effecttype coding for the 3 treatment levels. We can use:
x_{1}

x_{2}


A

1

0

B

0

1

C

1

1

Where x_{1} and x_{2} will be columns we create in the data to input:
for all of the rows of data.
Notice there no entries for the first period because on the first application of each treatment there has been none that have preceded it. Therefore a 0 is used for both x_{1} and x_{2}. Looking at Period 2, sequence 1, treatment B we can refer back to the Sequence chart and see that it was preceded by treatment level A, so we assign x_{1} = 1, and x_{2} = 0, indicating that it was treatment A that could produce a carryover effect here.
We carefully do this for each entry in the dataset. The coded variables x_{1} and x_{2} then are entered into the general linear model as continuous covariates and LSmeans for treatments are adjusted for carryover effects.