- Is the average tree height greater than 70 ft?
- We will use a one-sample t-test on
Height(right-tailed).
2025-10-15
Height (right-tailed).head(trees, 6)
## Girth Height Volume ## 1 8.3 70 10.3 ## 2 8.6 65 10.3 ## 3 8.8 63 10.2 ## 4 10.5 72 16.4 ## 5 10.7 81 18.8 ## 6 10.8 83 19.7
summary(trees$Height)
## Min. 1st Qu. Median Mean 3rd Qu. Max. ## 63 72 76 76 80 87
length(trees$Height)
## [1] 31
Hypotheses (right-tailed): \(H_0:\mu=70\) vs \(H_1:\mu>70\)
Test statistic: \(t=\dfrac{\bar X-\mu_0}{s/\sqrt{n}},\ \text{df}=n-1\)
ggplot(trees, aes(x = Height)) + geom_histogram(aes(y = after_stat(density)), bins = 8, fill = "blue", color = "white") + geom_density(color = "black") + labs(title = "Distribution of Tree Height", x = "Height (ft)", y = "Density")
ggplot(trees, aes(sample = Height)) + stat_qq() + stat_qq_line() + labs(title = "Q–Q Plot for Height")
t_out <- t.test(trees$Height, mu = 70, alternative = "greater", conf.level = 0.95) t_out
## ## One Sample t-test ## ## data: trees$Height ## t = 5.2429, df = 30, p-value = 5.866e-06 ## alternative hypothesis: true mean is greater than 70 ## 95 percent confidence interval: ## 74.05764 Inf ## sample estimates: ## mean of x ## 76
n <- length(trees$Height) mean_val <- mean(trees$Height) sd_val <- sd(trees$Height) c(n = n, mean = mean_val, sd = sd_val)
## n mean sd ## 31.000000 76.000000 6.371813