> library(AER) > library(MASS) > # Estimate the multiple regression model > bh_mod_multiple <- lm(medv ~ lstat + age + crim + 1, data = Boston) > robust_summary_multiple <- coeftest(bh_mod_multiple, vcov = vcovHC(bh_mod_multiple, type = "HC1")) > # Print the coefficient summary with robust standard errors for the multiple regression model > print(robust_summary_multiple)
> R2_simple <- 0.5533 > # Adj. R-squared for the large regression model > adj_r_squared_large <- summary(bh_full_mod)$adj.r.squared > # Compare R-squared values > if (adj_r_squared_large > R2_simple) { + print("The adjusted R-squared of the large model is higher than the R-squared of the simple model.") + } else if (adj_r_squared_large < R2_simple) { + print("The adjusted R-squared of the large model is lower than the R-squared of the simple model.") + } else { + print("The adjusted R-squared values are equal for both models.") + } [1] "The adjusted R-squared of the large model is higher than the R-squared of the simple model."