How to tell if two linear regression slopes (one theoretical, one observed) are significantly different?

I have created a linear regression model for a set of data. I have calculated the slope and intercept of the line.

If given a theoretical slope for this kind of data, how can I test to see if the slope that I calculated and the theoretical slope are significantly different?

For example, the slope I calculated is 0.02 and the theoretical slope is 0.01, are they significantly different? How can I tell? I am working in R.

• By doing a one sample t-test. The regression output provides you with estimate, standard error and degrees of freedom for the observed slope and that is really all you need for a t-test. Alternatively you can use the confint function to get the confidence interval of the observed slope, Oct 16 '17 at 13:27
• Say your variable of interest is X. Put offset(0.01 * X) and X itself into the regression equation and then test the coefficient of X or establish a confidence interval for it. @Roland suggestion works too of course. Oct 16 '17 at 13:42

People are usually interested in testing if a parameter estimate is equal to $0$ because that represents no relationship. (In other contexts, 'no relationship' can be other values, such as a ratio of $1$.) However, there is no reason you need to use that specific value as your null. If you have a theoretical basis for wanting to determine if the observed slope is consistent with $.01$, you very much can use that as your null. You will just have to do that manually, since it isn't what software will output by default. The standard formula for a $t$-test is:
$$t = \frac{(\hat\beta_j - \beta_{j\text{ NULL}})}{SE}$$ Since $\beta_{j\text{ NULL}}$ is taken by default to be $0$, that drops out and software just provides your estimate divided by the standard error. Here, you will just need to do the arithmetic yourself. Then you compare your computed $t$-statistic to the relevant $t$-distribution with the same degrees of freedom as the original test.