R 的行銷分析機器學習
Verena Pflieger
Data Scientist at INWT Statistics

summary(multipleLM2)
Residual standard error: 13.87 on 4179 degrees of freedom
Multiple R-squared: 0.3522, Adjusted R-squared: 0.3504
F-statistic: 206.5 on 11 and 4179 DF, p-value: < 2.2e-16

stats 套件的 AIC()MASS 套件的 stepAIC()AIC(multipleLM2)
33950.45
head(clvData2)
# A tibble: 6 x 14
customerID nOrders nItems daysSinceLastOrder margin returnRatio
<int> <int> <int> <int> <dbl> <dbl>
1 2 16 40 2 57.62 0.18
2 3 1 5 124 29.69 1.00
3 4 15 30 68 56.26 0.16
4 5 23 41 103 58.84 0.03
5 6 2 4 104 29.31 0.00
6 7 6 10 41 35.72 0.06
#... with 8 more variables: shareOwnBrand <dbl>, shareVoucher <dbl>,
# shareSale <dbl>, gender <chr>, age <int>, marginPerOrder <dbl>,
# marginPerItem <dbl>, itemsPerOrder <dbl>
predMargin <- predict(multipleLM2,
newdata = clvData2)
head(predMargin)
1 2 3 4 5 6
51.10204 31.63335 51.90008 52.62200 36.65194 33.84383
mean(predMargin, na.rm = TRUE)
33.95147
| 線性迴歸重點 | |
|---|---|
| 你學到… | 預測未來的顧客終身價值 |
| 使用線性迴歸建模連續變數 | |
| 建模與預測所用變數名稱必須一致 |
| 模型啟示 | |
|---|---|
| 你學到… | 一年內的利潤可良好預測下一年的利潤 |
| 距離上次下單越久,預期利潤越小 | |
| 性別與年齡等特徵對利潤預測影響不大 | |
| 等等 |
R 的行銷分析機器學習