评估与比较插补
在构建插补模型时,将其与另一种方法进行比较通常是明智的做法。本课中,我们将把之前使用 impute_lm() 创建的已插补数据集,与基于均值的插补数据集进行比较。两个数据集都已在本练习中提供,分别为 ocean_imp_lm_wind 和 ocean_imp_mean。
本练习是课程的一部分
在 R 中处理缺失数据
练习说明
- 使用
bind_rows()将模型合并:把ocean_imp_mean放在mean,把ocean_imp_lm_wind放在lm_wind。 - 以散点图查看
air_temp与humidity的取值:将air_temp_c放在 x 轴,humidity放在 y 轴,按缺失情况着色,并按所用的插补模型(imp_model)进行分面。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Bind the models together
bound_models <- bind_rows(mean = ___,
lm_wind = ___,
.id = "imp_model")
# Inspect the values of air_temp and humidity as a scatter plot
ggplot(___,
aes(x = ___,
y = ___,
color = any_missing)) +
geom_point() +
facet_wrap(~___)