Comparing models
Choosing the best of multiple competing models can be tricky if these models are built on incomplete data. In this exercise, you will extend the model you have built previously by adding one more explanatory variable: the race of the movie's subject. Then, you will try to compare it to the previous model.
As a reminder, this is how you have fitted the first model:
model_1 <- lm(earnings ~ country + year + sub_type,
data = biopics)
Let's see if we can judge whether adding the race variable improves the model!
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Handling Missing Data with Imputations in R
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Fit linear regression to predict earnings
model_2 <- ___(___,
___ = ___)