การปรับแก้ความคลาดเคลื่อนที่ไม่คงที่
ในตัวอย่างนี้ จะเห็นว่าความแปรปรวนของตัวแปร response เพิ่มขึ้นตามตัวแปร explanatory โปรดสังเกตว่าการแก้ไขในแบบฝึกหัดนี้จะส่งผลต่อทั้งความแปรปรวนและความเป็นเส้นตรงของความสัมพันธ์ด้วย
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
การอนุมานสำหรับการถดถอยเชิงเส้นใน R
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Run this to see how the model looks
ggplot(hypdata_nonequalvar, aes(x = explanatory, y = response)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE)
# Model response vs. explanatory
model <- ___
# Extract observation-level information
modeled_observations <- ___
# See the result
modeled_observations
# Using modeled_observations, plot residuals vs. fitted values
___