# 8.5 - Unequal Slopes Model - SAS

8.5 - Unequal Slopes Model - SAS

## SAS®

If the data collected in the example study were instead as follows:

 Females Males Salary years Salary years 80 5 42 1 50 3 112 4 30 2 92 3 20 1 62 2 60 4 142 5

We would see in Step 2 that we do have a significant treatment × covariate interaction. Using this SAS program with the new data shown below.

data unequal_slopes;
input gender $salary years; datalines; m 42 1 m 112 4 m 92 3 m 62 2 m 142 5 f 80 5 f 50 3 f 30 2 f 20 1 f 60 4 ; proc mixed data=unequal_slopes; class gender; model salary=gender years gender*years; title 'Covariance Test for Equal Slopes'; /*Note that we found a significant years*gender interaction*/ /*so we add the lsmeans for comparisons*/ /*With 2 treatments levels we omitted the Turkey adjustment*/ lsmeans gender/pdiff at years=1; lsmeans gender/pdiff at years=3; lsmeans gender/pdiff at years=5; run;  We get the following output: Type 3 Test of Fixed Effects Effect Num DF De DF F Value Pr > F years 1 6 800.00 < .0001 gender 1 6 6.55 0.0430 years*gender 1 6 50.00 0.0004 Generating Covariate Regression Slopes and Intercepts data unequal_slopes; input gender$ salary years;
datalines;
m  42  1
m  112  4
m  92  3
m  62  2
m  142  5
f  80  5
f  50  3
f  30  2
f  20  1
f  60  4
;

proc mixed data=unequal_slopes;
class gender;
model salary=gender years gender*years / noint solution;
ods select SolutionF;
title 'Reparmeterized Model';
run;


Output:

Solution for Fixed Effects
Effect gender Esimate Standard Error DF t Value Pr > |t|
gender f 3.0000 3.3166 6 0.90 0.4006
gender m 15.0000 3.3166 6 4.52 0.0040
years*gender f 15.0000 1.0000 6 15.00 < .0001
years*gender m 25.0000 1.0000 6 25.00 < .0001

Here the intercepts are the Estimates for effects labeled 'gender' and the slopes are the Estimates for the effect labeled 'years*gender'. Thus, the regression equations for this unequal slopes model are:

$$\text{Females}\;\;\; y = 3.0 + 15(Years)$$

$$\text{Males}\;\;\; y = 15 + 25(Years)$$

The slopes of the regression lines differ significantly and are not parallel:

And here is the output:

Differences of Least Squares Means

Effect gender _gender years Estimate Standard Error DF t Value Pr > |t|
gender f m 1.00 -22.000 3.4641 6 -6.35 0.0007
gender f m 3.00 -42.000 2.0000 6 -21.00 < .0001
gender f m 5.00 -62.000 3.4641 6 -17.90 < .0001

In this case, we see a significant difference at each level of the covariate specified in the lsmeansstatement. The magnitude of the difference between males and females differs (giving rise to the interaction significance). In more realistic situations, a significant treatment × covariate interaction often results in significant treatment level differences at certain points along the covariate axis.

# 8.5a - Unequal Slopes Model - Minitab

8.5a - Unequal Slopes Model - Minitab

## Minitab®

With new a new data file, Salary-new Data,. When we re-run the program with this new data and find that we get a significant interaction between gender and years.

To do this, open the Minitab dataset Salary-new Data.

Go to Stat > ANOVA > GLM (general linear model) and follow the same sequence of steps as in Lesson 10.4a.

##### Analysis of Variance
Source DF Adj SS Adj MS F-Value P-Value
years 1 8000.0 8000.0 800.00 0.000
gender 1 65.5 65.45 6.55 0.043
years*gender 1 500.0 500.0 50.00 0.000
Error 6 60.0 10.00
Total 9 12970.0

So here we can’t simply remove the interaction term and compare the treatment means at the mean level of the covariate (3 years out of college). The magnitude of the difference between males and females differs (giving rise to the interaction significance).

 [1] Link ↥ Has Tooltip/Popover Toggleable Visibility