開始使用免費開始

評估不良的插補

在評估插補之前,先知道「不好的情況」長什麼樣子會很有幫助。為了探索這點,我們來看一種常見但不理想的插補方法:用平均值進行插補。

在這個練習中,你將用盒狀圖來觀察平均值插補的效果,資料使用 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()
編輯並執行程式碼