Working backwards, Part II. (5.24, p. 203) A 90% confidence interval for a population mean is (65, 77). The population distribution is approximately normal and the population standard deviation is unknown. This confidence interval is based on a simple random sample of 25 observations. Calculate the sample mean, the margin of error, and the sample standard deviation.
low90 <- 65
hi90 <- 77
SM <- (hi90 + low90)/2
ME <- (hi90 - low90) / 2
n <- 25
df <- n -1
p <- 0.9
tVal <- qt((1-p)/2,df)
SE <- ME/tVal
SamSD <- SE * sqrt(n)
SamSD
## [1] -17.53481
SAT scores. (7.14, p. 261) SAT scores of students at an Ivy League college are distributed with a standard deviation of 250 points. Two statistics students, Raina and Luke, want to estimate the average SAT score of students at this college as part of a class project. They want their margin of error to be no more than 25 points.
SAT_sd <- 250
SAT_ME <- 25
SAT_z_90 <- 1.65
samples <- (((SAT_z_90 * SAT_sd)/(SAT_ME))^2)
SAT_z_99 <- 2.58
samples_99 <- (((SAT_z_99 * SAT_sd)/(SAT_ME))^2)
High School and Beyond, Part I. (7.20, p. 266) The National Center of Education Statistics conducted a survey of high school seniors, collecting test data on reading, writing, and several other subjects. Here we examine a simple random sample of 200 students from this survey. Side-by-side box plots of reading and writing scores as well as a histogram of the differences in scores are shown below.
sd_diff <- 8.887
mean_diff <- -0.545
n <- 200
SE <- sd_diff / sqrt(n)
tVal <- (mean_diff)/ SE
pVal <- pt(tVal,n-1)
pVal
## [1] 0.1934182
Fuel efficiency of manual and automatic cars, Part II. (7.28, p. 276) The table provides summary statistics on highway fuel economy of cars manufactured in 2012. Use these statistics to calculate a 98% confidence interval for the difference between average highway mileage of manual and automatic cars, and interpret this interval in the context of the data.
auto_mean <- 22.92
auto_sd <- 5.29
auto_n <- 26
man_mean <- 27.88
man_sd <- 5.01
man_n <- 26
z_98 <- 2.326
mean_diff <- auto_mean - man_mean
SE_diff <- sqrt((auto_sd^2 / auto_n) + (man_sd^2 / man_n))
low <- mean_diff - SE_diff * z_98
high <- mean_diff + SE_diff * z_98
low
## [1] -8.283576
high
## [1] -1.636424
Email outreach efforts. (7.34, p. 284) A medical research group is recruiting people to complete short surveys about their medical history. For example, one survey asks for information on a person’s family history in regards to cancer. Another survey asks about what topics were discussed during the person’s last visit to a hospital. So far, as people sign up, they complete an average of just 4 surveys, and the standard deviation of the number of surveys is about 2.2. The research group wants to try a new interface that they think will encourage new enrollees to complete more surveys, where they will randomize each enrollee to either get the new interface or the current interface. How many new enrollees do they need for each interface to detect an effect size of 0.5 surveys per enrollee, if the desired power level is 80%?
mean_surveys <- 4
sd_surveys <- 2.2
ME_surveys <- 0.5
z_80 <- 1.28
n_surveys <- (z_80 * sd_surveys / ME_surveys)
Work hours and education. The General Social Survey collects data on demographics, education, and work, among many other characteristics of US residents.47 Using ANOVA, we can consider educational attainment levels for all 1,172 respondents at once. Below are the distributions of hours worked by educational attainment and relevant summary statistics that will be helpful in carrying out this analysis.
means <- c(38.67, 39.6, 41.39, 42.55, 40.85)
SDs <- c(15.81, 14.97, 18.1, 13.62, 15.51)
Ns <- c(121, 546, 97, 253, 155)
df <- data.frame(means, SDs, Ns)
Tot_N <- sum(Ns)
DF <- 5 - 1
DF_res <- Tot_N - 5
PrF <- 0.0682
MeanSq <- 501.54
SumSq <- 267382
F_stat <- qf(1 - PrF, DF, DF_res)
MeanSqVar <- MeanSq / F_stat
SumProd <- DF * MeanSq
SumSqTot <- SumSq + SumProd
DFTot <- DF + DF_res
_ | Df | Sum Sq | Mean Sq | F-value | Pr(>F) |
---|---|---|---|---|---|
degree | 4 | 2006.16 | 501.54 | 2.1889312 | 0.0682 |
Residuals | 1167 | 267,382 | 229.1255188 | ||
Total | 1171 | 269388.2 |