Example Data Set

## # A tibble: 16 × 4
##    individual    femur_cm tibia_cm stature_cm
##    <chr>            <dbl>    <dbl>      <dbl>
##  1 Individual 1      41.2     34         154.
##  2 Individual 2      42.5     34.7       156.
##  3 Individual 3      43       35.3       158 
##  4 Individual 4      44.1     35.8       160.
##  5 Individual 5      44.8     36.2       161.
##  6 Individual 6      45.3     36.8       162 
##  7 Individual 7      46       37.1       163.
##  8 Individual 8      46.4     37.6       164.
##  9 Individual 9      47.1     38.1       166 
## 10 Individual 10     47.8     38.5       167.
## 11 Individual 11     48.2     39         168.
## 12 Individual 12     48.9     39.4       169.
## 13 Individual 13     49.5     39.9       171 
## 14 Individual 14     50.1     40.3       172.
## 15 Individual 15     50.8     40.8       174.
## 16 Individual 16     51.4     41.2       175

ggplot 1:

LaTeX slide 1: regression model

We model stature as a linear function of femur length:

\[ Y_i = \beta_0 + \beta_1 x_i + \varepsilon_i \]

where

  • \(Y_i\) is the stature of individual \(i\)
  • \(x_i\) is femur length
  • \(\beta_0\) is the intercept
  • \(\beta_1\) is the slope
  • \(\varepsilon_i\) is random error

The fitted regression line is

\[ \hat{Y} = b_0 + b_1 x \]

Regression model results

## # A tibble: 4 × 2
##   Quantity                  Value
##   <chr>                     <dbl>
## 1 Intercept              6.91e+ 1
## 2 Slope for femur length 2.06e+ 0
## 3 R-squared              9.97e- 1
## 4 p-value for slope      1.05e-18

LaTeX slide 2: hypothesis test for the slope

To test whether femur length is a useful predictor of stature, we test

\[ H_0 : \beta_1 = 0 \qquad \text{vs.} \qquad H_a : \beta_1 \ne 0 \]

The test statistic is

\[ t = \frac{b_1 - 0}{SE(b_1)} \]

A confidence interval for the slope is

\[ b_1 \pm t^* SE(b_1) \]

ggplot 2:

Interactive Plot

R Code Plot