8.14

library(ISwR)
data(react)
### H0: measurement of the tuberculin reaction is 0
### H1: measurement of the tuberculin reaction is not 0
lower<- mean(react) - qt(0.99,length(react)-1)* sd(react)/ sqrt(length(react))

upper <- mean(react)-qt(0.99, length(react)-1)*sd(react)/ sqrt(length(react))

t.test(react, conf.level=0.98)
## 
##  One Sample t-test
## 
## data:  react
## t = -7.7512, df = 333, p-value = 1.115e-13
## alternative hypothesis: true mean is not equal to 0
## 98 percent confidence interval:
##  -1.0365875 -0.5562269
## sample estimates:
##  mean of x 
## -0.7964072

8.16

library(ISwR)
data(bp.obese)
### H0: Blood pressure of population is 120
### H1: Blood pressure of population is not 120
t.test(bp.obese$bp, mu=120)
## 
##  One Sample t-test
## 
## data:  bp.obese$bp
## t = 3.8986, df = 101, p-value = 0.0001743
## alternative hypothesis: true mean is not equal to 120
## 95 percent confidence interval:
##  123.4479 130.5914
## sample estimates:
## mean of x 
##  127.0196

8.17

library(ISwR)
head(bp.obese)
mean(bp.obese$obese)
## [1] 1.313039
### H0: the mean obese in the population is 1.31
### H1: the mean obese in the population is not 1.31
t.test(bp.obese$obese, mu=1.313039, alternative= "two.sided")
## 
##  One Sample t-test
## 
## data:  bp.obese$obese
## t = 8.4484e-06, df = 101, p-value = 1
## alternative hypothesis: true mean is not equal to 1.313039
## 95 percent confidence interval:
##  1.262395 1.363684
## sample estimates:
## mean of x 
##  1.313039