9.2 - Example
9.2 - ExampleExample 9-2:
Download the text file containing the data: dog1.csv.
We will use the following SAS program below to illustrate this procedure.
Download the SAS Program here: dog2.sas
Note: In the upper right-hand corner of the code block you will have the option of copying ( ) the code to your clipboard or downloading ( ) the file to your computer.
options ls=78;
title "Split-Plot Analysis - Dog Data";
/* After reading in the dog1 data, the variables are stacked
* into two columns, one named 'time' for the time points and
* one named 'k' for the quantitative response values.
* The original p1 through p4 responses are removed.
*/
data dogs;
infile "D:\Statistics\STAT 505\data\dog1.csv" firstobs=2 delimiter=',';
input treat dog p1 p2 p3 p4;
time=1; k=p1; output;
time=5; k=p2; output;
time=9; k=p3; output;
time=13; k=p4; output;
drop p1 p2 p3 p4;
run;
/* The class statement specifies treat, dog, and time
* as categorical variables.
* The model statement specifies k as the response and
* treat, time, and treat-by-time interaction as factors.
* dog (nested within treat) is also specified as a factor.
* The h= option in the test statement is used to specify over
* which groups the mean responses are to be compared.
* The e= option specifies the error term for the test specified
* in the test statement, which is treat here.
*/
proc glm data=dogs;
class treat dog time;
model k=treat dog(treat) time treat*time;
test h=treat e=dog(treat);
run;
Split-plot Model
To fit the split-plot model:
- Open the ‘dog1’ data set in a new worksheet
- Rename the columns treat, dog, p1, p2, p3, and p4, from left to right.
- Data > Stack > Blocks of Columns
- Highlight and select treat, dog, and p1 to move these to the first window on the right.
- Repeat sub-step 1. above with treat, dog, and p2 to move these to the second window on the right.
- Repeat sub-step 1. again for the remaining responses p3 and p4.
- Select New worksheet and choose 'OK'. The new worksheet with the stacked data is created.
- On the new worksheet, rename the columns time, treat, dog, and response, from left to right. This is optional but will be assumed for the steps below.
- Stat > ANOVA > General Linear Model > Fit General Linear Model
- Highlight and select response for the Responses window.
- Highlight and select time, treat, and dog to move these to the Factors window.
- Under Random/Nest, specify dog nested in treat and Random in the pull-down window. Time and treat should be left as Fixed. Then choose 'OK'.
- Under Model, highlight both treat and time, and choose 'Add with interaction order 2'. The treat*time interaction term is added to the Terms window below. Choose 'OK'.
- Choose 'OK' again. The split-plot model results are shown in the results area.
Analysis
Run the SAS program inspecting how the program applies this procedure.
Note in the output where values of interest are located. The results are copied from the SAS output into this table here:
Source
|
d.f.
|
SS
|
MS
|
F
|
---|---|---|---|---|
Treatment |
3
|
19.923
|
6.641
|
6.00
|
Error (a) |
32
|
35.397
|
1.106
|
|
Time |
3
|
6.204
|
2.068
|
11.15
|
Interaction |
9
|
3.440
|
0.382
|
2.06
|
Error (b) |
96
|
17.800
|
0.185
|
|
Total |
143
|
82.320
|
Hypotheses Tests
Now that we have the results from the analysis, the first thing that we want to look at is the interaction between treatment and time. We want to determine here if the effect of treatment depends on time. Therefore, we will start with:
- The interaction between treatment and time, or:
\(H_0\colon (\alpha\tau)_{ik} = 0 \) for all \( i = 1,2, \dots, a;\) \(k = 1,2, \dots, t\)
Here we need to look at the treatment by interaction term whose F-value is reported at 2.06. We want to compare this to an F-distribution with (a - 1)(t - 1) = 9 and (N - a)(t - 1) = 96 degrees of freedom. The numerator d.f. of 9 is tied to the source variation due to the interaction, while the denominator d.f. is tied to the source of variation due to error(b).
We can reject \(H_0\) at level alpha; if
\(F = \dfrac{MS_{\text{treat x time}}}{MS_{error(b)}} > F_{(a-1)(t-1), (N-a)(t-1), \alpha}\)
Therefore, we want to compare this to an F with 9 and 96 degrees of freedom. Here we see that this is significant with a p-value of 0.0406.
Result: We can conclude that the effect of treatment depends on time (F = 2.06; d. f. = 9, 96; p = 0.0406)Next Steps...
- Because the interaction between treatment and time is significant, the next step in the analysis would be to further explore the nature of that interaction using something called profile plots, (we will look at this later...).
- If the interaction between treatment and time was not significant, the next step in the analysis would be to test for the main effects of treatment and time.
- Let's suppose that we had not found a significant interaction. Let's do this so that you can see what it would look like to consider the effects of treatment.
Consider testing the null hypothesis that there are no treatment effects, or
\(H_0\colon \alpha_1 = \alpha_2 = \dots = \alpha_a = 0\)
To test this null hypothesis, we compute the F-ratio between the Mean Square for Treatment and Mean Square for Error (a). We then reject our Ho at level α if
\(F = \dfrac{MS_{treat}}{MS_{error(a)}} > F_{a-1, N-a, a}\)
Here, the numerator degrees of freedom is equal to the number of degrees of freedom a - 1 = 3 for treatment, while the denominator degrees of freedom are equal to the number of degrees of freedom N - a = 32 for Error(a).
Result: We can conclude that the treatment significantly affects the mean coronary sinus potassium over the t = 4 sampling times (F = 6.00; d. f. = 3,32; p = 0.0023). - Consider testing the effects of time:
\(H_0\colon \tau_1 = \tau_2 = \dots = \tau_t = 0\)
To test this null hypothesis, we compute the F-ratio between Mean Square for Time and Mean Square for Error(b). We then reject Ho at level \(\alpha\); if
\(F = \dfrac{MS_{time}}{MS_{error(b)}} > F_{t-1, (N-a)(t-1), \alpha}\)
Here, the numerator degrees of freedom is equal to the number of degrees of freedom t - 1 = 3 for time, while the denominator degrees of freedom is equal to the number of degrees of freedom (N - a)(t - 1) = 96 for Error(b).
Result: We can conclude that coronary sinus potassium varies significantly over time (F = 11.15; d. f. = 3, 96; p < 0.0001).