library(AER)
library(MASS)
data("Boston")
bh_mult_mod <- lm(medv ~ lstat + crim + age, data = Boston)
# correction Factor
n <-
k <-
CF <-
# obtain both R^2 and the adj. R^2
# check that the adj. R^2 can be computed as stated above
# correction Factor
n <- nrow(bh_mult_mod$model)
k <- ncol(bh_mult_mod$model)-1
CF <- (n-1)/(n-k-1)
# obtain both R^2 and the adj. R^2
summary(bh_mult_mod)$r.squared
summary(bh_mult_mod)$adj.r.squared
# check that the adj. R^2 can be computed as stated above
1 - (1 - summary(bh_mult_mod)$r.squared) * CF == summary(bh_mult_mod)$adj.r.squared
test_predefined_objects("bh_mult_mod")
test_object("n")
test_object("k")
test_object("CF")
test_output_contains("summary(bh_mult_mod)$r.squared")
test_output_contains("summary(bh_mult_mod)$adj.r.squared")
ex() %>% check_operator("==") %>% check_result() %>% check_equal()
success_msg("Well done!")