# Comparing the slopes for two independent samples

In this section we test whether the slopes for two independent populations are equal, i.e. we test the following null hypothesis:

H0:  β1 = β2 i.e. β1 – β2 = 0

The test statistic is

If the null hypothesis is true then

where

If the two error variances are equal, then as for the test for the differences in the means, we can pool the estimates of the error variances, weighing each by their degrees of freedom, and so

Now

Since we can replace the numerators of each by the pooled value $s_{Res}^2$, we have

Note that the while the null hypothesis that β = 0 is equivalent to ρ = 0, the null hypothesis that  β1 = β2  is not equivalent to ρ1 = ρ2.

Example 1: We have two samples, each comparing life expectancy vs. smoking. The first sample is for males and the second for females. We want to determine whether there is any significant difference in the slopes for these two populations. We assume that the two samples have the values in Figure 1 (for men the data is the same as that in Example 1 of Regression Analysis):

Figure 1 – Data for Example 1

Figure 1 – Data for Example 1

As can be seen from the scatter diagrams in Figure 1, it appears that the slope for women is less steep than for that of men. In fact, as can be seen from Figure 2, the slope of the regression line for men is -0.6282 and the slope for women is -0.4679, but is this difference significant?

As can be seen from the calculations in Figure 2, using both pooled and unpooled values for sRes, the null hypothesis, H0: the slopes are equal, cannot be rejected. And so we cannot conclude that there is any significant difference between the life expectancy of males and females for any incremental amount of smoking.

Figure 2 – t-test to compare slopes of regression lines

Figure 2 – t-test to compare slopes of regression lines

### 2 Responses to Comparing the slopes for two independent samples

1. Aravindh says:

Hi,

You have a cell wrong in the excel sheet. Please fix it if you can. In Figure 2, cell M11 should be equal to (b1-b2)/(sb1-b2), NOT (b1-b2)/(sb1-sb2)

Thanks Aravindh,
That was a great catch. I have made the change that you suggested. Thanks for your help.
Charles