In: Statistics and Probability
PLEASE WRITE IN R CODE. Has to output on R software.
(1) The stem length of soybeans from an experiment are:
20.2, 22.9, 23.3, 20.0, 19.4, 22.0, 22.1, 22.0, 21.9, 21.5, 20.9
a. Create a histogram to visualize the data
b. Test "t.test" whether the population mean is different from 22
c. Obtain a 2 sided 98% confidence interval on the true mean using "t.test".
d. The researcher, by using "t.test" on a sample size of 11 was assuming that the data was normally distributed. Is that a valid claim? Create a QQ plot and interpret.
R-codes are given in bold text
1)
R-code for Histogram
stem_length=c(20.2, 22.9, 23.3, 20.0, 19.4, 22.0, 22.1, 22.0, 21.9, 21.5, 20.9)
hist(stem_length,main="Histogram For Stem length of Soyabean",xlab="Stem length of Soyabean",col="darkmagenta")
b) R-code
t.test(sepallength,mu=22,conf.level=0.98,alternative='two.sided')
One Sample t-test
data: stem_length
t = -1.4316, df = 10, p-value = 0.1828
alternative hypothesis: true mean is not equal to 22
98 percent confidence interval:
20.45480 22.49065
sample estimates:
mean of x
21.47273
Here Ho = population mean is different from 22
vs H1 = population mean is not different from 22
Here p-value= 0.1828 which is greater than 0.05 level of significance so we accept null hypothesis and conclude that population mean is different from 22
3) 2 sided 98% confidence interval on the true mean using "t.test"
98 percent confidence interval:
20.45480 22.49065
d) R-code
qqnorm(stem_length)
qqline(stem_length, col = "steelblue", lwd = 2)
Conclusion: By observing above Q-Q plot all points are lies near to line so the data follows normality assumption.