From the textbook: • 1.6.11 (a)

nA<-c(29.1, 29.6, 30, 30.5, 30.8)
nB<-c(21,26,30,35,38)
cat("\tSample mean of car type A: ",mean(nA),"\n")
cat("\tSample mean of car type B: ",mean(nB))
##  Sample mean of car type A:  30
##  Sample mean of car type B:  30
  1. If the random sample for both types accurately represents the population then, then an estimate of 30 gas mileage as the population mean is valid.
cat("\tSample variance of car type A: ",var(nA),"\n")
cat("\tSample variance of car type B: ",var(nB))
##  Sample variance of car type A:  0.465
##  Sample variance of car type B:  46.5
  1. In terms of quality, car type A is of higher quality. This is because each car’s gas mileage in type A’s sample are very close to each other, with a variance of 0.465. A stark contrast to type B’s variance of 46.5. This means that from any population of type A, it’s more likely to get a car with gas mileage close to the mean. It would be terrible if you got a car that only has a gas mileage of 21 when it was advertised to have 30.

• 1.6.16 (a)

salaries1stYear <- c(152, 169, 178, 179, 185, 188, 195, 196, 198, 203, 204, 209, 210, 212, 214)
cat("\tSample mean of first-year salaries: ",mean(salaries1stYear),"\n")
cat("\tSample variance of first-year salaries: ",var(salaries1stYear))
##  Sample mean of first-year salaries:  192.8
##  Sample variance of first-year salaries:  312.3143
    1. If each engineer in their second year receive a $5000 raise,
salaries2ndYear5k <- salaries1stYear + rep(5, times = 15)
cat("\tSample mean of second-year salaries with $5000 raise: ",mean(salaries2ndYear5k),"\n")
cat("\tSample variance of second-year salaries with $5000 raise: ",var(salaries2ndYear5k),"\n")
##  Sample mean of second-year salaries with $5000 raise:  197.8
##  Sample variance of second-year salaries with $5000 raise:  312.3143
    1. If each engineer in their second year receive a 5% raise,
salaries2ndYear5Percent <- 1.05 * salaries1stYear
cat("\tSample mean of second-year salaries with 5% raise: ",mean(salaries2ndYear5Percent),"\n")
cat("\tSample variance of second-year salaries with 5% raise: ",var(salaries2ndYear5Percent),"\n")
##  Sample mean of second-year salaries with 5% raise:  202.44
##  Sample variance of second-year salaries with 5% raise:  344.3265

• 1.7.2 (do a and b in R, c by hand)

t <- read.table(url("https://media.pearsoncmg.com/cmg/pmmg_mml_shared/mathstatsresources/Akritas/RobotReactTime.txt"), header = TRUE)
t1 = sort(t$Time[t$Robot==1])

populationMedian = median(t1)
populationQ1 = quantile(t1,probs = .25, type = 1)
populationQ3 = quantile(t1,probs = .75, type = 1)
cat("Median of Population: ", populationMedian,"\n")
cat("1st Quartile of Population: ", populationQ1,"\n")
cat("3rd Quartile of Population: ", populationQ3,"\n")
## Median of Population:  30.55
## 1st Quartile of Population:  29.59
## 3rd Quartile of Population:  31.41
interQuartileRange <- IQR(t1)
cat("Inter Quartile Range of the population: ",interQuartileRange)
## Inter Quartile Range of the population:  1.7425
  1. Optional Caption

• 1.7.4 (a)

si <- read.table(url("https://media.pearsoncmg.com/cmg/pmmg_mml_shared/mathstatsresources/Akritas/SolarIntensAuData.txt"), header = TRUE)
si1 <- si$SI
boxplot(si, main="Solar Intensity Measurements")

cat("30th percentile: ", quantile(si1, probs=0.3),"\n")
cat("60th percentile: ", quantile(si1, probs=0.6),"\n")
cat("90th percentile: ", quantile(si1, probs=0.9))
## 30th percentile:  700.7
## 60th percentile:  720.8
## 90th percentile:  746