library(AER) library(MASS) model_res <- lm(medv ~ lstat + I(crim + age), data = Boston) RSSR <- sum(model_res$residuals^2) model_unres <- lm(medv ~ lstat + crim + age, data = Boston) USSR <- sum(model_unres$residuals^2) # compute the F-statistic and assign it to `Fstat` # compute the p-value and assign it to `pval` # check whether the null is rejected at the 1% significance level # verify your result with `linearHypothesis()` # compute the F-statistic and assign it to `Fstat` Fstat <- ((RSSR-USSR)/1)/(USSR/(nrow(Boston)-3-1)) # compute the p-value and assign it to `pval` pval <- 1 - pf(Fstat, df1 = 1, df2 = nrow(Boston)-3-1) # check whether the null is rejected at the 1% significance level pval < 0.01 # verify your result with `linearHypothesis()` linearHypothesis(model_unres, "age = crim") test_object("Fstat") test_object("pval") test_or(test_output_contains("pval < 0.01"), test_output_contains("pval > 0.01")) test_function_result("linearHypothesis") success_msg("Correct! The null hypothesis is rejected at a 1% significance level.")