In: Statistics and Probability
Using the R package to answer the following two questions. You MUST submit your R code for analysis.
2. Below are heights for a simple random sample of n = 15 young
trees (in cm). (50 pts) 27, 33, 33, 34, 36, 37, 39, 40, 40, 41, 41,
42, 44, 46, 47.
(a) Test the hypothesis that the mean tree height is equal to 38
cm.
(b) Calculate the 95% confidence interval for the population mean
of young trees.
(c) Test the null hypothesis that the mean tree height is not greater than 36.5 cm.
R code
hts=c(27,33,33,34,36,37,39,40,40,41,41,42,44,46,47)
a=t.test(hts,mu=38)
c=t.test(hts,mu=36.5,alternative = "less")
---------------------------------Output
hts=c(27,33,33,34,36,37,39,40,40,41,41,42,44,46,47)
> ?t.test
> a=t.test(hts,mu=38)
> a
One Sample t-test
data: hts
t = 0.47751, df = 14, p-value = 0.6404
alternative hypothesis: true mean is not equal to 38
95 percent confidence interval:
35.67224 41.66109
sample estimates:
mean of x
38.66667
> c=t.test(hts,mu=36.5,alternative = "less")
> c
One Sample t-test
data: hts
t = 1.5519, df = 14, p-value = 0.9285
alternative hypothesis: true mean is less than 36.5
95 percent confidence interval:
-Inf 41.1257
sample estimates:
mean of x
38.66667
-------------------------------------------
a) From the output, p value is 0.64 which is greater than alpha, so we fail to reject H0 that mean height is 38
b) From the code of 'a', the 95% confidence interval for mean height is (35.67224, 41.66109)
c) H0 : Mean height is 36.5
H1: Mean Height is less than 36.5
This is one sided left tailed test, from the R outpput, p value is 0.9285 which is greater than alpha = 0.05, hence we fail to reject H0 and conclude that there is no evidence to reject the claim that mean height of trees is 36.5