Statistics begins with curiosity:
Can vitamins actually make guinea pigs teeth grow longer?
We will use real data to answer this question instead of just guessing.
2026-02-04
Statistics begins with curiosity:
Can vitamins actually make guinea pigs teeth grow longer?
We will use real data to answer this question instead of just guessing.
This dataset measures tooth length of guinea pigs based on:
## len supp dose ## Min. : 4.20 OJ:30 Min. :0.500 ## 1st Qu.:13.07 VC:30 1st Qu.:0.500 ## Median :19.25 Median :1.000 ## Mean :18.81 Mean :1.167 ## 3rd Qu.:25.27 3rd Qu.:2.000 ## Max. :33.90 Max. :2.000
## supp len ## 1 OJ 20.66333 ## 2 VC 16.96333
## dose len ## 1 0.5 10.605 ## 2 1.0 19.735 ## 3 2.0 26.100
We want to know: Does the type of supplement affect tooth growth?
Null Hypothesis: There is no difference in mean tooth length.
\[ H_0: \mu_{OJ} = \mu_{VC} \]
Alternative hypothesis: There is a difference in mean tooth length.
\[ H_a: \mu_{OJ} \neq \mu_{VC} \]
ggplot(ToothGrowth, aes(x = factor(dose), y = len, fill = supp)) +
geom_boxplot(alpha = 0.8) +
scale_fill_manual(
name = "Supplement",
values = c("OJ" = "#E69F00", "VC" = "#56B4E9")) +
labs(
title = "Tooth Length by Dose and Supplement",
x = "Dose (mg/day)",
y = "Tooth Length"
) +
theme_minimal() +
theme(legend.position = "right",
plot.title = element_text(hjust = 0.5))
The p-value helps answer:
“If there were really no difference between supplements, how likely is it to see the data we observed?”
\[ p = P(\text{observed data} \mid H_0 \text{ is true}) \]
Interpretation:
Plot not showing up when knitted or in rpubs, but displays in RStudio