Predict your child's height

Katherine Vance
July 3, 2020

How tall will my child be?

  • My kids' pediatrician likes to make predictions about how tall his patients will be as adults
  • The prediction is made based on the parents' heights and the doctor's experience
  • This app allows parents (or anyone else) to make a similar prediction using the power of data!

User Interface

The app is user-friendly and takes simple inputs:

  • the mother's height, in inches
  • the father's height, in inches

With these inputs, the app displays a graph and gives an easy-to-understand sentence predicting the child's height.

The Graph

If the user inputs a mother's height of 65 inches and a father's height of 70 inches, the following graph will be displayed:

plot of chunk unnamed-chunk-1

The code underlying the prediction

library(tidyverse)
library(UsingR)
data(galton)

    # Build the model to predict child's height from parent height
    fit <- lm(child ~ parent, galton)
    # Process the inputs and predict the child's height
    parentAvg <- (1.08*input$mother + input$father)/2
    childPred <- predict(fit, newdata = data.frame(parent = parentAvg))