评估糟糕的插补
为了评估插补方法,先了解"糟糕"的样子会很有帮助。为此,我们来看一种通常不理想的插补方法:用均值进行插补。
在本练习中,您将使用箱线图来探索均值插补的效果,数据使用 oceanbuoys 数据集。
本练习是课程的一部分
在 R 中处理缺失数据
练习说明
针对 oceanbuoys 数据集:
- 使用
impute_mean_all()进行均值插补,并用add_label_shadow()跟踪这些插补值。 - 使用箱线图探索湿度(
humidity)中的插补值。 - 使用箱线图探索气温(
air_temp_c)中的插补值。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Impute the mean value and track the imputations
ocean_imp_mean <- bind_shadow(___) %>%
___() %>%
___()
# Explore the mean values in humidity in the imputed dataset
ggplot(___,
aes(x = ___, y = ___)) +
geom_boxplot()
# Explore the values in air temperature in the imputed dataset
ggplot(___,
aes(x = ___, y = ___)) +
geom_boxplot()