4
$\begingroup$

Say you have an independent variable, $x$, and two dependent variables $y_1$ and $y_2$. I want to calculate whether these two variables have a significantly different slope. I can do it by calculating separate regressions, and then using he method mentioned at Test a significant difference between two slope values.

I was wondering, would be equivalent to testing for the significance of the slope of the series $(y_1-y_2)$ [e.g. null hypothesis slope=0]? I tried it with a couple of hundred independent series, and the results look very similar (similar distribution of p-values), but I'd think if it were that easy, more people would use it, as the computation is simpler. So, why is it not the same?

$\endgroup$
4
$\begingroup$

If the x's are the same for both, you're effectively making the values paired (on $x$).

More generally - as in the case where you have two separate fitted lines - you don't have that.

When you do have the two sets of $y$ paired on $x$, then you could test for a difference in slope by taking differences $y_{2i}-y_{1i}$ and regressing that on $x$.

If the y-values for a given $x$ are independent (conditional independence), it should make no difference which you do.

$\hat{\beta_2}-\hat{\beta_1}=(X'X)^{-1}X'y_2-(X'X)^{-1}X'y_1=(X'X)^{-1}X'(y_2-y_1)$

showing the estimates are the same, and (assuming conditional independence):

$\text{Var}((X'X)^{-1}X'(y_2-y_1))=(X'X)^{-1}X'\text{Var}(y_2-y_1)X'(X'X)^{-1}$

$=(X'X)^{-1}X'((\sigma_1^2+\sigma_2^2)I)X'(X'X)^{-1}$

$=(\sigma_1^2+\sigma_2^2)(X'X)^{-1}X'X'(X'X)^{-1}$

$=(\sigma_1^2+\sigma_2^2)(X'X)^{-1}$

$=\text{Var}(\hat{\beta_2})+\text{Var}(\hat{\beta_1})$

(though the sample values won't be perfectly uncorrelated). So I think the two are at least asymptotically equal, and should be equally efficient at smaller samples. I don't think it matters which you use.

However, if the y-values are positively correlated, it would be important to work with the differences.

$\endgroup$
  • $\begingroup$ Cool, thanks, I had a vague idea that it might require error independence, but I wasn't sure. $\endgroup$ – naught101 Feb 28 '15 at 6:19
  • 1
    $\begingroup$ It was a fun question actually, I'd never been through that particular calculation before. (I already had come to the answer from general reasoning, but it's always best to follow through a couple of lines of algebra to make sure.) $\endgroup$ – Glen_b -Reinstate Monica Feb 28 '15 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.