การถดถอยใน R เบื้องต้น
Richie Cotton
Data Evangelist at DataCamp
| n_claims | total_payment_sek |
|---|---|
| 108 | 392.5 |
| 19 | 46.2 |
| 13 | 15.7 |
| 124 | 422.2 |
| 40 | 119.4 |
| ... | ... |
library(dplyr)
swedish_motor_insurance %>%
summarize_all(mean)
# A tibble: 1 x 2
n_claims total_payment_sek
<dbl> <dbl>
1 22.9 98.2
swedish_motor_insurance %>%
summarize(
correlation = cor(n_claims, total_payment_sek)
)
# A tibble: 1 x 1
correlation
<dbl>
1 0.881
| n_claims | total_payment_sek |
|---|---|
| 108 | 392.5 |
| 19 | 46.2 |
| 13 | 15.7 |
| 124 | 422.2 |
| 40 | 119.4 |
| 200 | ??? |
ตัวแปรที่ต้องการพยากรณ์
ตัวแปรที่อธิบายว่าตัวแปรตอบสนองจะเปลี่ยนแปลงอย่างไร
library(ggplot2)
ggplot(
swedish_motor_insurance,
aes(n_claims, total_payment_sek)
) +
geom_point()

library(ggplot2)
ggplot(
swedish_motor_insurance,
aes(n_claims, total_payment_sek)
) +
geom_point() +
geom_smooth(
method = "lm",
se = FALSE
)

การแสดงภาพและสร้างโมเดลการถดถอยเชิงเส้น
การพยากรณ์จากโมเดลการถดถอยเชิงเส้นและการทำความเข้าใจค่าสัมประสิทธิ์ของโมเดล
การประเมินคุณภาพของโมเดลการถดถอยเชิงเส้น
เนื้อหาเดิม แต่ใช้โมเดลการถดถอยโลจิสติก
การถดถอยใน R เบื้องต้น