Test model coefficient (regression slope) against some value In R, when I have a (generalized) linear model (lm, glm, gls, glmm, ...), how can I test the coefficient (regression slope) against any other value than 0? In the summary of the model, t-test results of the coefficient are automatically reported, but only for comparison with 0. I want to compare it with another value.
I know I can use a trick with reparametrizing y ~ x as y - T*x ~ x, where T is the tested value, and run this reparametrized model, but I seek simpler solution, that would possibly work on the original model.
 A: In the end, farly the easiest solution was to do the reparametrization:
gls(I(y - T*x) ~ x, ...)

A: Here's a broader solution that will work with any package, or even if you only have the regression output (such as from a paper).
Take the coefficient and its standard error.
Compute $t=\frac{\hat{\beta}-\beta_{H_0}}{\text{s.e.}(\hat{\beta})}$. The d.f. for the $t$ are the same as they would be for a test with $H_0: \beta=0$.
A: You can use either a simple t-test as proposed by Glen_b, or a more general Wald test. 
The Wald test allows to test multiple hypotheses on multiple parameters. It is formulated as: $R\beta=q$ where R selects (a combination of)  coefficients, and q indicates the value to be tested against, $\beta$ being the standard regresison coefficients. 
In your example, where you have just one hypothesis on one parameter, R is a row vector, with a value of one for the parameter in question and zero elsewhere, and q is a scalar with the restriction to test. 
In R, you can run a Wald test with the function linearHypothesis() from package car. Let us say you want to check if the second coefficient (indicated by argument hypothesis.matrix) is different than 0.1 (argument rhs):
reg <- lm(freeny)
coef(reg)

# wald test for lag.quarterly.revenue =0.1
>library(car)
>linearHypothesis(reg, hypothesis.matrix = c(0, 1, rep(0,3)), rhs=0.1)
#skip some result, look at last value on last row, of Pr(>F) 
  Res.Df       RSS Df  Sum of Sq      F Pr(>F)
1     35 0.0073811                            
2     34 0.0073750  1 6.0936e-06 0.0281 0.8679

For the t-test,  this function implements the t-test shown by Glen_b: 
ttest <- function(reg, coefnum, val){
  co <- coef(summary(reg))
  tstat <- (co[coefnum,1]-val)/co[coefnum,2]
  2 * pt(abs(tstat), reg$df.residual, lower.tail = FALSE)
}

> ttest(reg, 2,0.1)
[1] 0.8678848

Let us make sure we got the right procedure by comparing the Wald, our t-test, and R default t-test, for the standard hypothesis that the second coefficient is zero:
> linearHypothesis(reg, hypothesis.matrix = c(0, 1, rep(0,3)), rhs=0)[["Pr(>F)"]][2]
[1] 0.3904361
> ttest(reg, 2,0)
[1] 0.3904361
## The 'right' answer from R:
> coef(summary(reg))[2,4]
[1] 0.3904361

You should get the same result with the three procedures. 
