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.
n <- 25
z <- 1.65
cil <- 65
cir <- 77
mu <- (cil + cir)/2
mu
## [1] 71
ME <- (cir - cil)/2
ME
## [1] 6
sigma <- ME*sqrt(n)/z
sigma
## [1] 18.18182
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.
z <- 1.65
sigma <- 250
ME <- 25
n <- (sigma*z/ME)**2
n
## [1] 272.25
The z* for 99% confidence interval is greater than the z* of 90% confidence interval. since n is proportional to \((z*)^2\), \(n_{99}\) will be greater than \(n_{90}\).
Minimal required sample size for Luke n = 666
z <- 2.58
sigma <- 250
ME <- 25
n <- (sigma*z/ME)**2
n
## [1] 665.64
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.
The reading and writing of each student are indepedent because the sample is randomly collected.
The observations are independent. There is no clear reletionship between reading and writing for one student. There are 200 cases greater than 30 and less than 10% of student population. The difference in scores is normal distributed.
The p-value is greater than 5%. There is no convincing evidence that prove the difference between the average scores on reading and writing.
n <- 200
sd <- 8.8817
rwdif <- -.545
se <- sd/sqrt(n)
t <- (rwdif-0)/se
pv <- pt(t, df = n-1)
pv
## [1] 0.1932769
Type 2 error. Failing to reject the null hypothesis when the alternative is true. We fail to find a difference between average test scores in reading and in writing.
The absolute value of the difference in the average scores is less than the margin error. The confidence interval will include zero.
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.
n <- 26
MA <- 16.12
SDA <- 3.58
MM <- 19.85
SDM <- 4.51
DM <- MA - MM
SE <- sqrt(((SDA**2)/n) + ((SDM**2)/n))
t <- (DM-0)/SE
pv <- pt(t, df = n-1)
pv
## [1] 0.001441807
There is a convincing evidence that highway fuel economy is different between automatic and manual cars.
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%?
2*(2.8*2.2)**2/0.5**2
## [1] 303.5648
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.
\(H_0:\) The average number of hours worked is the same across all groups. \(\mu_1 = \mu_2 = \mu_3 = \mu_4 = \mu_5\) where \(\mu_i\) represents the average number of hours worked for observations in category i. \(H_A:\) The average number of hours worked varies per group.
Generally we must check three conditions on the data before performing ANOVA: • the observations are independent within and across groups, • the data within each group are nearly normal, and • the variability across the groups is about equal.
n <- 1172
k <- 5
dfG <- k-1
dfR <- n-k
totaldf <- dfG + dfR
# Using P to determine F Stat
p <- .0682
F <- qf(1-p, dfR, dfG)
# Using MSR and F to determine MSG
MSG <- 501.54
MSR <- MSG / F
# Using MSR to determine SSR
SSG <- dfG * MSG
SSR <- 267382
SST <- SSG + SSR
ANOVA <- c("degree", "residuals", "Total")
Df <- c(dfG, dfR, totaldf)
Sum_Sq <- c(SSG, SSR, SST)
Mean_Sq <- c(MSG, MSR, "")
F_value <- c(F, "", "")
P <- c(p, "", "")
ANOVA_df <- data.frame(ANOVA, Df, Sum_Sq, Mean_Sq, F_value, P)
ANOVA_df