cs <- c(23, 19, 30, 22, 23, 29, 35, 36, 33, 25)
ts <- c(430, 430, 333, 410, 390, 377, 325, 310, 328, 375)
mod <- lm(ts ~ cs)
ssr <- sum(mod$residuals^2)
tss <- 9*var(ts)
# compute R^2, round to four decimal places and save the result to `R2`
# check whether your result is correct using the "==" operator
# compute R^2, round to four decimal places and save the result to "R2"
R2 <- round(1-ssr/tss,4)
# check whether your result is correct using the "==" operator
R2 == 0.8976
test_predefined_objects("ssr")
test_predefined_objects("tss")
test_predefined_objects("mod")
test_object("R2")
test_function("round", args="digits", eq_condition="equal")
test_student_typed("==", not_typed_msg = "Something is wrong. Make sure you type `R2 ==` followed by the value mentioned above.")
success_msg("Great!")