In: Statistics and Probability
This question involves coding in RStudio Problem 3 (Verzani problem 8.18):
The data set normtemp (Data set can be found in the UsingR package) contains measurements of 130 healthy, randomly selected individuals. The variable temperature contains normal body temperature. Does the data appear to come from a normal distribution? Is so, find a 90% confidence interval for the mean normal body temperature of the population that was sampled. Does it include 98.6 degrees Fahrenheit?
Rcode:
library(UsingR)
attach(normtemp)
print(normtemp)
hist(normtemp$temperature)
shapiro.test(normtemp$temperature)
qqnorm(normtemp$temperature)
qqline(normtemp$temperature)
From histogram and qq plot we see that data follows normal distribution
From qqplot the points fall on staright line,follows normal distribution.
From shapiro test , p-value = 0.2332,p>0.05
Fail to reject null
Accept null hypothesis. that data follows normal distribution
#to get the 90% confidence interval
t.test(normtemp$temperature,conf.level = 0.90)
output:
One Sample t-test
data: normtemp$temperature
t = 1527.9, df = 129, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
90 percent confidence interval:
98.14269 98.35577
sample estimates:
mean of x
98.24923
INTREPRETATION:
We are 90 percent confidence interval that the true mean normal body temperature lies in between 98.14269 and 98.35577
90% confidence interval does not include 98.6