Heights of fathers and sons

father_son <- read_tsv("father_son.tsv")
head(father_son)
## # A tibble: 6 × 2
##   Father   Son
##    <dbl> <dbl>
## 1   65.0  59.8
## 2   63.3  63.2
## 3   65.0  63.3
## 4   65.8  62.8
## 5   61.1  64.3
## 6   63.0  64.2

p <- qplot(data = father_son, x = Father, y = Son, 
           geom = "point", size = I(0.25)) +
  geom_smooth(method = "lm", se = FALSE, color = "red")
p

Simple linear regression

model <- lm(Son ~ 1 + Father, data = father_son)
summary(model)

## 
## Call:
## lm(formula = Son ~ 1 + Father, data = father_son)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.8910 -1.5361 -0.0092  1.6359  8.9894 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 33.89280    1.83289   18.49   <2e-16 ***
## Father       0.51401    0.02706   19.00   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.438 on 1076 degrees of freedom
## Multiple R-squared:  0.2512, Adjusted R-squared:  0.2505 
## F-statistic: 360.9 on 1 and 1076 DF,  p-value: < 2.2e-16

Confidence interval

p <- qplot(data = father_son, x = Father, y = Son, 
           geom = "point", size = I(0.25)) +
  geom_smooth(method = "lm", color = "red", size=.1)
p