I want to know if I am correctly implementing the answer given by Michael Chirico here.
The dataset can obtained using the following code in R:
data = fread(paste0("http://www1.aucegypt.edu/faculty/hadi/RABE5/Data5/", "P060.txt"))
I want to test $$H_0: \beta_1 = \beta_3 =0.5$$ using the model
$$Y = \beta_0 + \beta_1 X_1 + \beta_3 X_3 + e.$$
In the answer from the link above, we can obtain an equivalent null hypothesis and a new model,
$$H_0: \alpha_1 = \alpha_3 = 0,$$
where the new model is
$$\begin{align*}
Y – 0.5(X_1 + X_3) &= \beta_0 + (\beta_1 – 0.5)X_1 + (\beta_3 – 0.5)X_3 + e \\
&= \alpha_0 + \alpha_1 X_1 + \alpha_3 X_3 + e
\end{align*}$$
With the new hypothesis and model, this becomes more familiar to me. I can use the partial F-test to determine whether we reject the null hypothesis or not.
In R I do the following:
m.null = lm(Y - 0.5*(X1+X3) ~ 1, data=supdata)
m.alt = lm(Y - 0.5*(X1+X3) ~ X1+X3, data=supdata)
anova(m.null, m.alt)
I can obtain the F-statistics and use its p-value to make a decision but I would first like to make sure that my implementation is correct.
Best Answer
First Create the model
Then you can use the following code:
You will get the same output with less code and hassle.