2025-10-15

1) Question:

  • Is the average tree height greater than 70 ft?
  • We will use a one-sample t-test on Height (right-tailed).

2) Data:

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

3) Formula:

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\)

4) Plot: Histogram of Height

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")

5) Plot: Q–Q (Normality Check)

ggplot(trees, aes(sample = Height)) +
  stat_qq() + stat_qq_line() +
  labs(title = "Q–Q Plot for Height")

6) Run the T-Test:

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

7) Numbers:

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

8) Conclusion:

  • If p-value < 0.05, reject Hâ‚€.
  • The result shows strong evidence that average tree height > 70 ft.