模型驗證

R 的實驗設計

Joanne Xiong

Data Scientist

建模前的 EDA

  • 以關注變數計算結果的平均與變異
lendingclub %>% summarise(median(loan_amnt),
                          mean(int_rate), 
                          mean(annual_inc))

lendingclub %>% group_by(verification_status) %>% summarise(mean(funded_amnt), var(funded_amnt))
# A tibble: 3 x 3
verification_status `mean(funded_amnt)` `var(funded_amnt)`
<chr>                             <dbl>              <dbl>
1 Not Verified                   114.15          349.41953
2 Source Verified                156.14          723.53265
3 Verified                       166.08          848.54561
R 的實驗設計

建模前的 EDA(續)

  • 依關注變數繪製結果的盒狀圖(y 軸)與分組(x 軸)。
ggplot(data = lendingclub,
       aes(x = verification_status, y = funded_amnt)) +
    geom_boxplot()
R 的實驗設計

盒狀圖:依驗證狀態的撥款金額

R 的實驗設計

建模後的模型驗證

  • 殘差圖
  • 常態性 QQ 圖
  • 檢驗 ANOVA 假設
    • 變異數齊一
  • 嘗試 ANOVA 的非母數替代法
R 的實驗設計

模型驗證圖:撥款金額模型

R 的實驗設計

一起來練習吧!

R 的實驗設計

Preparing Video For Download...