2025-10-19

ToothGrowth Dataset

Toothgrowth Dataset: Data from experiment where Vitamin C was delivered in 2 different methods to predict tooth growth in guinea pigs. 2 methods were Orange Juice (OJ) and Ascorbic Acid (VC)

Goal

Use simple linear regression to predict the effect a dose of 1.5 mg/day of Vitamin C (from Orange Juice and Ascorbic Acid respectively) will have for guinea pig toothgrowth

##     len supp dose
## 31 15.2   OJ  0.5
## 32 21.5   OJ  0.5
## 33 17.6   OJ  0.5
## 34  9.7   OJ  0.5
## 35 14.5   OJ  0.5
## 36 10.0   OJ  0.5

OJ Dose(mg/day) vs Length (mm)

Training Our Linear Model

Equation to create model: \[ y = \beta_1 x + \beta_0 \] \[ \beta_1 \] controls the slope of the regression line \[ \beta_0 \] controls the bias (or y intercept) of the regression line

OJ Dose(mg/day) vs Length (mm)

## `geom_smooth()` using formula = 'y ~ x'

R Code for Previous Graph

g = ggplot(data = data_OJ, aes (x = dose, y = len))+ geom_point() g+geom_smooth(method = ‘lm’)

VC Dose(mg/day) vs Length (mm)

## `geom_smooth()` using formula = 'y ~ x'

Predicting with model

What is expected toothgrowth for orange juice? From equation: \[ y = \beta_1 x + \beta_0 \]

## (Intercept)        dose 
##   11.550000    7.811429

\[ \beta _0 \approx 7.8\] \[ \beta_1 \approx 11.6\] \[ y = 11.6(1.5)+7.8 \approx 25.2 mm \]

Mean line and Regression Line Plotly