studying Econometrics I come across this question for which I cannot find the right answer:
Assuming a percentage of household's expenses on food is linearly dependent on the total expenditure and size of household: $$\text{wfood}_i = \beta_1 + \beta_2 \text{totexp}_i + \beta_3 \text{size}_i$$Using F-test for restricted and unrestricted models test a hypothesis $H_0$ that coefficients $\beta_1, \beta_2, \beta_3$ do not depend on the $\text{sex}_i$. The alternative hypothesis is that at least one of $\beta_1, \beta_2, \beta_3$ vary.
I use
$$F=\frac{(RSS_R-RSS_{UR})/r}{RSS_{UR}/(n-k_{UR})} \sim F_{r, k_{UR}}$$
to test restricted model (first one) against unrestricted (adding $+\beta_4\text{sex(woman)}_i$), but get the wrong value of F-statistic (I have to choose one of the variants, and there's no such value there; expected value is $2.4$ or $24.4$).
How do I do that:
library(Ecdat)
data("BudgetFood")
b <- na.omit(BudgetFood)
model_r <- lm(data = b, wfood ~ totexp + size)
model_ur <- lm(data = b, wfood ~ totexp + size + sex)
r <- 2
n <- count(b)$n
k_UR <- 4
RSS_UR <- deviance(model_ur)
RSS_R <- deviance(model_r)
Fstatistic <- ((RSS_R - RSS_UR) / r) / (RSS_UR / (n - k_UR))
Fstatistic # 0.145555
qf(0.975, r, n - k_UR) # 3.689447
I appreciate any ideas. Thanks.