开始使用免费开始使用

评估与比较插补

在构建插补模型时,将其与另一种方法进行比较通常是明智的做法。本课中,我们将把之前使用 impute_lm() 创建的已插补数据集,与基于均值的插补数据集进行比较。两个数据集都已在本练习中提供,分别为 ocean_imp_lm_windocean_imp_mean

本练习是课程的一部分

在 R 中处理缺失数据

查看课程

练习说明

  • 使用 bind_rows() 将模型合并:把 ocean_imp_mean 放在 mean,把 ocean_imp_lm_wind 放在 lm_wind
  • 以散点图查看 air_temphumidity 的取值:将 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(~___)
编辑并运行代码