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)
model
## 
## Call:
## lm(formula = Son ~ 1 + Father, data = father_son)
## 
## Coefficients:
## (Intercept)       Father  
##      33.893        0.514

newdata <- as_tibble(data.frame(
  Father = c(72, 64, 70)
))
predict(model, newdata)
##        1        2        3 
## 70.90123 66.78918 69.87321

## # A tibble: 1 × 2
##   Father   Son
##    <dbl> <dbl>
## 1   71.8  72.6