Continuing with the sample data table, this example fits a model where the slope for the covariate depends on the level of Drug.
Select Help > Sample Data Library and open
Select Analyze > Fit Model.
Select y and click Y.
Select both Drug and x and click Macros > Factorial to Degree.
This adds terms up to the degree specified in the Degree box to the model. The default value for Degree is 2. Thus the main effects of Drug and x, and their interaction, Drug*x, are added to the model effects list.
Click Run.
This specification adds two columns to the linear model (call them x4i and x5i) that allow the slopes for the covariate to differ by Drug level. The new variables are formed by multiplying the indicator variables for Drug by the covariate values, giving the following formula:
Coding of Analysis of Covariance with Separate Slopes, shows the coding for this model. The mean of X, which is 10.7333, is used in centering continuous terms.
X – 10.7333 if a, 0 if d, –(X – 10.7333) if f
0 if a, X – 10.7333 if d, –(X – 10.7333) if f
A portion of the report is shown in Plot with Interaction. The Regression Plot shows fitted lines with different slopes. The Effect Tests report gives a p-value for the interaction of 0.56. This is not significant, indicating the model does not need to include different slopes.
Plot with Interaction