开始使用免费开始使用

针对非正态误差进行调整

在最后这个示例中,数据点似乎并未围绕回归线呈正态分布。再次注意,本练习中的修正会同时改变变异性,并且会影响关系的线性程度。

本练习是课程的一部分

R 中的线性回归推断

查看课程

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Run this to see how the model looks
ggplot(hypdata_nonnorm, 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
___
编辑并运行代码