Regression to the mean

R में Regression परिचय

Richie Cotton

Data Evangelist

संकल्पना

  • Response value = fitted value + residual
  • "The stuff you explained" + "the stuff you couldn't explain"
  • Residuals exist due to problems in the model and fundamental randomness
  • Extreme cases are often due to randomness
  • Regression to the mean means extreme cases don't persist over time
R में Regression परिचय

पियर्सन का पिता-पुत्र डेटासेट

  • 1078 पिता/पुत्र जोड़ियाँ
  • क्या लंबे पिता के बेटे भी लंबे होते हैं?
father_height_cm son_height_cm
165.2 151.8
160.7 160.6
165.0 160.9
167.0 159.5
155.3 163.3
... ...
1 Adapted from https://www.rdocumentation.org/packages/UsingR/topics/father.son
R में Regression परिचय

स्कैटर प्लॉट

plt_son_vs_father <- ggplot(
  father_son, 
  aes(father_height_cm, son_height_cm)
) +
  geom_point() +
  geom_abline(color = "green", size = 1) +
  coord_fixed()

पुत्रों की लंबाई बनाम पिताओं की लंबाई का स्कैटर प्लॉट, जिसमें वह रेखा भी है जहाँ पिता और पुत्र समान लंबाई के होंगे। जैसे-जैसे पिता लंबे हैं, बेटे भी लंबे होते हैं.

R में Regression परिचय

Regression लाइन जोड़ना

plt_son_vs_father +
  geom_smooth(method = "lm", se = FALSE)

पुत्रों की लंबाई बनाम पिताओं की लंबाई का स्कैटर प्लॉट, जिसमें एक रैखिक ट्रेंड लाइन अंकित है। ट्रेंड लाइन उस रेखा से कम ढलान वाली है जहाँ पिता और पुत्र समान लंबाई के होंगे.

R में Regression परिचय

Regression चलाना

mdl_son_vs_father <- lm(
  son_height_cm ~ father_height_cm, 
  data = father_son
)
Call:
lm(formula = son_height_cm ~ father_height_cm, data = father_son)

Coefficients:
     (Intercept)  father_height_cm  
          86.072             0.514
R में Regression परिचय

प्रेडिक्शन करना

really_tall_father <- tibble(
  father_height_cm = 190
)
predict(mdl_son_vs_father, really_tall_father)
183.7
really_short_father <- tibble(
  father_height_cm = 150
)
predict(mdl_son_vs_father, really_short_father)
163.2
R में Regression परिचय

अभ्यास करते हैं!

R में Regression परिचय

Preparing Video For Download...