Testing linear restriction in R I would like to test a linear restriction in R. Instead of the usual $\beta_i=0$, I want to test if $\beta_k=0.5$ and $\beta_j=-0.5$.
Is there a way to do this using lm command, and just writing a different formula for the models that lm command uses?
I was thinking of writing $y-0.5x_k+0.5x_j=\sum_{i\neq j,k} x_i\beta_i+(\beta_k-0.5)x_k+(\beta_j+0.5)x_j$. However, I'm not sure how to code this reparametrization...
P.S:Would writing $y−I(−0.5x_k+0.5x_j)$ ~ $\sum x_i$ as the formula to be run on lm, work as 2 t-tests? 
Any help would be appreciated.
 A: You can test the hypothesized value of $\beta_k$ much in the same way that it would be tested for $\beta_k = 0$. You can get a t-value on n-2 df with the formula:
$$T = \frac{\beta_i- hypothesezed~~ \beta_i}{Standard~~ Error~~ \beta_i}$$
In many cases this simplifies to beta over standard error because making the hypothesis be zero removes it from the equation.
A: Let's say you want to test the hypothesis of the form $R\beta = r$. In your case:
$$\underbrace{\left[ \begin{array}{cccc} \ldots & 1& 0 & \ldots \\ \ldots & 0& 1 & \ldots  \end{array}\right]}_R \underbrace{\left[ \begin{array}{c}\ldots \\ \beta_j \\ \beta_k \\ \ldots \end{array} \right]}_\beta = \underbrace{\left[ \begin{array}{c}-.5 \\ .5 \end{array} \right]}_r $$
Let $\hat{\beta}$ be your regression estimates of $\beta$. Under the condition that $\hat{\beta} \sim \mathcal{N}\left(\beta, \Sigma \right)$ conditional on data $X$ (eg. $\hat{\beta}$ asymptotically normal with mean $\beta$ and covariance matrix $\Sigma$) then the linear restrictions $R \beta = r$ can be tested with a $\chi^2$ test. Observe that $R\hat{\beta}-r$ would be normal with  $Var(R \hat{\beta} - r\mid X) = R \Sigma R'$. Then we would have:
$$(R\hat{\beta} - r)' \left( R \Sigma R' \right)^{-1} (R \hat{\beta} - r) \sim \chi^2_{\#r}$$
Where $\#r$ is the number of restrictions (in your case two).
The most classic way though is to do an F-test. This would take the form:
$$(R\hat{b} - r)' \left(R \Sigma R' \right)^{-1} (R\hat{b} - r) / (\#r)\sim F(\#r, n- k) $$
where $\Sigma$ is estimate of $Var(\hat{\beta} \mid X)$ and $\#r$ is the number of restrictions (note rank of R should be $\#r$.)
See Fumio Hayashi Econometrics p. 65-66
