# Is Slope A statistically different from Slope B? *URGENT*

#### explicit

##### New Member
Hey everyone,

Really need urgent help here.

I am trying to determine if the change in the slope of a line (beta) is statistically significant due to a particular event. As such, how do you test if the slope of line A is statistically different from the slope of line B?

For instance, let's say i'm investigating the beta of Apple's stock, when regressed against the S&P 500.
Regression 1 - 2005-2006 (24 monthly observations), Beta = 0.8
Regression 2 - 2007-2009 (36 monthly observations), Beta = 0.5 (decrease)

How do I determine if this change in beta is statistically different over the two different time periods? Do I apply a t-test? If so, what's the formula to do so?

(I have also deliberately used 2 different sample sizes for the 2 regressions. Please highlight to me if this affects the statistical testing.)

Also, I've noticed that the t-test has always been applied to means or proportions, but never to the slope (beta). As such, is there something wrong with my concept or use of terminologies? Hope you experts can clarify this with me. I really need your help! Thanks in advance everyone

Last edited:

#### trinker

##### ggplot2orBust
You can go in and delete the double post yourself.

I think you want to compare two independant correlations. If so this is the formula:

[TEX]{t}=\frac{\hat{\beta}_{A}-\hat{\beta}_{A}}{S_{\hat{\beta}_{A}-\hat{\beta}_{B}}[/TEX]

where:

[MATH]{S}_{\hat{\beta}_{A}-\hat{\beta}_{B}}=\sqrt{S^{2}_{{\beta}_{A}} + S^{2}_{{\beta}_{B}}}[/MATH]

and for degrees freedom:

[TEX]{df}={N}-2*{q}-2[/TEX]

where:

[TEX]{q} = {n} \; {predictors}[/TEX]

#### explicit

##### New Member
Thanks for your reply!! Been looking all over the net but to no avail.

Basically, i'm comparing the pre-event beta and post-event beta and I want to determine if this change in beta is statistically significant.

Are you able to explain or direct me to your source? I'm quite clueless with the symbols in the formula. Or is there any excel file or youtube video to illustrate this?

If let's say:
Beta(A) = 0.8
Standard error of regression line (A) = 0.015

Beta (B) = 0.5
Standard error of regression line (B) = 0.012

Then do I take (0.8 - 0.5) / (0.015 - 0.012)? Kindly clarify. Thanks in advance!

Will go delete the previous double post now!

Last edited:

#### explicit

##### New Member
Anyone able to provide some input to help me out?

#### CamilleJosion

##### New Member
Hi,
The easiest way to do that is to run an ANCOVA model with 1 factor (with as categories 1 value per regression line you want to create) and your explanatory variables (X1, X2,...). In the model you will have Stock value (Y)= intercept + Factor+Factor*X1+Factor*X2...
Then you can use a test to compare the slopes.
This is all done in XLSTAT if you select the compare slopes option in the Ouputs tab.
Hope it helps,
Camille

#### noetsi

##### Fortran must die
Within subject ANOVA (also called repeated measures) is a way to address this as I think camille suggested above

#### Jake

$Stock_i = \beta_0 + \beta_1*Month_i + \beta_2*Period_i + \beta_3*Month_i*Period_i + \epsilon_i$
You want to test $\beta_3$.