size <- 963 #Sample Size
sampleMean <- 121.1 #Sample Mean
stdDev <- 17.6 #Sample Standard Deviation
confidence80 <- (100-80)/100 #Level of significance at 80% confidence interval
sam1 <- qt(1-confidence80/2,size-1)
sam1 #Critical value
## [1] 1.282432
confidenceInterval80 <- c(sampleMean-sam1*stdDev/sqrt(size),sampleMean+sam1*stdDev/sqrt(size)) #80% confidence interval for the mean systolic blood pressure
confidenceInterval80
## [1] 120.3727 121.8273
size <- 963 #Sample Size
sampleMean <- 121.1 #Sample Mean
stdDev <- 17.6 #Sample Standard Deviation
confidence95 <- (100-95)/100 #Level of significance at 80% confidence interval
sam2 <- qt(1-confidence95/2,size-1)
sam2 #Critical value
## [1] 1.962433
confidenceInterval95 <- c(sampleMean-sam2*stdDev/sqrt(size),sampleMean+sam2*stdDev/sqrt(size)) #80% confidence interval for the mean systolic blood pressure
confidenceInterval95
## [1] 119.987 122.213
size <- 963 #Sample Size
sampleMean <- 121.1 #Sample Mean
stdDev <- 17.6 #Sample Standard Deviation
confidence99 <- (100-99)/100 #Level of significance at 80% confidence interval
sam3 <- qt(1-confidence99/2,size-1)
sam3 #Critical value
## [1] 2.58095
confidenceInterval99 <- c(sampleMean-sam3*stdDev/sqrt(size),sampleMean+sam3*stdDev/sqrt(size)) #80% confidence interval for the mean systolic blood pressure
confidenceInterval99
## [1] 119.6362 122.5638
twenty <- read.table("twenty.txt", header = TRUE)
summary(twenty$Weight)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    97.0   126.3   149.9   160.0   183.4   282.9
x.bar <- mean(twenty$Weight)
q <- qnorm(.975)
s <- sd(twenty$Weight)
n <- length(twenty$Weight)
lower = x.bar - q * s / sqrt(n)
upper = x.bar + q * s / sqrt(n)

cat("\n5A: ")
## 
## 5A:
cat("\nThe First Quartile of the Weights of All American 20 year olds is: 126.3")
## 
## The First Quartile of the Weights of All American 20 year olds is: 126.3
cat("\nThe Third Quartile of the Weights of All American 20 years olds is: 183.4")
## 
## The Third Quartile of the Weights of All American 20 years olds is: 183.4
cat("\nThe IQR Range is thus 183.4 - 126.3 = 57.1")
## 
## The IQR Range is thus 183.4 - 126.3 = 57.1
cat("\n5B: ")
## 
## 5B:
cat("\nThe Mean Weight is 160 with its lower bound being 152.90 and upper bound being 167.11. Thus, the confidence interval is narrower than my answer in Part A. ")
## 
## The Mean Weight is 160 with its lower bound being 152.90 and upper bound being 167.11. Thus, the confidence interval is narrower than my answer in Part A.
cat("\nThe Lower Bound is ")
## 
## The Lower Bound is
cat(lower)
## 152.8958
cat("\nThe Upper Bound is: ")
## 
## The Upper Bound is:
cat(upper)
## 167.1091

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.