# Testing a regression coefficient against 1 rather than 0

Brief caveat- I haven't dusted off my stats knowledge since some university courses a few years ago, and I'm struggling with cobwebs.

I have a model where a linear 1 to 1 relationship has been assumed in the past. The model assumes that revenue from Product A will translate to Product B- it's not perfect, but it's what we've been using for now. I was given the task of doing some exploratory work on this relationship.

I modelled the relationship between revenue B and revenue A, and was able to work out a rough coeffecient. This coeffecient seems to be significant (t test within bounds), but I know the t test is testing whether the slope of this regression line is significantly different than zero. I would like to know if this slope is significantly different than 1, the previous relationship we assumed. How can I adjust a hypothesis test for this? I know I'm going to see the answer and hate myself for asking, thanks for helping me shake this out of my brain.

• When you posit a "linear one-to-one relationship" it is tempting to plot the differences in revenue over time (or possibly the differences of their logarithms) in order to explore that assumption. Is such plotting possible for you? Do you measure revenues of both products synchronously? And if it's possible, what does the plot look like? – whuber Feb 10 '15 at 17:29
• I agree with @whuber here. Is seems like you should be able to perform a test of whether the differences in revenue (e.g. $\bar{y}_{i1} - \bar{y}_{i2} = 0$) are different from zero. – StatsStudent Feb 10 '15 at 18:13
• This website is all about asking questions :) Also agree with @whuber and StatsStudent. If your null hypothesis is $Y_i = X_i$ + (Normal error with unknown, but constant, parameters), then $X_i - Y_i$ has a normal distribution, and you can t-test for the mean being zero. – P.Windridge Feb 10 '15 at 19:18
• @P.Windridge A more applicable hypothesis might be that both $X$ and $Y$ are random variables without assuming either is Normal (which is unlikely for most product revenue streams). Nevertheless, examining their differences is still a good way to understand how well those variables might be linearly related and avoids any need for the complications of errors-in-variables regression. – whuber Feb 10 '15 at 19:40
• If the variances of A and B are the same, regression to the mean -- in effect, the fact that correlations are less than 1 -- tells us that the regression slope must also be less than 1. So I don't think there's much point in testing; it's a test on the correlation (which we already know a priori to be less than 1), confounded with the relative variances of A and B. – Glen_b Feb 11 '15 at 1:02

Examine the confidence interval of the slope coefficient. If it includes 1, then we will not reject the null hypothesis stating that the slope is 1. The drawback is that you will not know the p-value other than it has to be smaller than 0.05.

Some software such as Stata allows user to implement customized testing of the coefficient. And that can get you the specific p-value. For example, in Stata, one can use the test command to further test the slope against a null value is that not zero.

. sysuse auto
(1978 Automobile Data)

. reg price mpg

Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  1,    72) =   20.26
Model |   139449474     1   139449474           Prob > F      =  0.0000
Residual |   495615923    72  6883554.48           R-squared     =  0.2196
Total |   635065396    73  8699525.97           Root MSE      =  2623.7

------------------------------------------------------------------------------
price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
_cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
------------------------------------------------------------------------------


Here we see that the regression coefficient for mile/gallon is -238.9 with a 95% CI of -344.7 and -133.1. Using test, we can test against our value, like, -400:

. test mpg = -400

( 1)  mpg = -400

F(  1,    72) =    9.21
Prob > F =    0.0033


The p-value is 0.0033, and we reject the null that the coefficient is equal to -400. (Should also note that the 95% CI does not include -400.) Similar function can be found in other software as well. For instance, in SAS, the same function is also called test, assigned after the proc reg model statement.

An alternate way (which I think is better, thanks to whuber's comment) is to compute the mean of the pairs and then use a one-sample t-test to check if their means are equal to zero. If one of the methods, however, is constantly and persistently bigger and you know what that difference is, you can also test the difference against that number rather than zero.

• What do you think of testing whether the mean difference in revenue is zero? – whuber Feb 10 '15 at 17:21
• @whuber, yes, that would definitely be an elegant way to make the question simpler. Thanks for the suggestion. – Penguin_Knight Feb 10 '15 at 19:07
• I'd second the call for testing the mean difference equal to zero. I also think it should give the same result as testing against a coefficient of 1. – Duncan Feb 10 '15 at 21:38
• @Duncan, I don't think the tests are quite the same. In testing that the slope $\beta = 1$, our null hypothesis is that $(\hat \beta - 1)/se(\hat \beta) \sim t_{n-2}$. In testing the mean difference is zero, our null hypothesis is that $\bar \epsilon / se(\bar \epsilon) \sim t_{n-1}$, where $\epsilon = X - Y$. (Hopefully the slap dash notation here is clear, and I didn't make a mistake while skimming wikipedia!). Perhaps regression with no intercept? – P.Windridge Feb 11 '15 at 12:10

The key is the use of an offset. Offsets are simple algebraic manipulations to a linear model. In this case, fitting the reduced model with an offset is done by fitting an intercept-only model (since the intercept is a free parameter) and specifying offset(mpg) in the options. This is algebraically equivalent to calculating a new response variable as price-mpg. You could specify offset(2*mpg) to test the null hypothesis that $$\beta=2$$ in the linear model given by:

$$E[\text{price}|\text{mpg}] = \alpha + \beta \cdot \text{mpg}$$

This is better than the confidence interval in Penguin_Knight's approach because:

1. You can use other tests like likelihood ratio and score.
2. You can report the actual $$p$$-value of the significance test.
3. You get a more precise estimate that can break ties when the sig-figs of the report limits of the CI tie with the null value.