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.

# sample mean
sm <- (65+77)/2
sm
## [1] 71
# margin of error is b-a/2 for cpnf interval (a,b)
me <- (77-65)/2
me
## [1] 6
# me = t*se and se = sd/sqrt(n)

t <- qt(0.95, 24)

# standard deviation
sd <- me * sqrt(25) / t
sd
## [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.

  1. Raina wants to use a 90% confidence interval. How large a sample should she collect?
sd <- 250
me <- 25

# for 90% confidence interval
z_val <- 1.65

size_90 <- (z_val*250/25)^2
size_90
## [1] 272.25

Raina would need 273 participants

  1. Luke wants to use a 99% confidence interval. Without calculating the actual sample size, determine whether his sample should be larger or smaller than Raina’s, and explain your reasoning.

For 99% confidence interval, z will be higher so sample size would be higher as well.

  1. Calculate the minimum required sample size for Luke.
# for 99% confidence interval
z_val <- 2.58

size_99 <- (z_val*250/25)^2
size_99
## [1] 665.64

The minimum required sample size for Luke is 666.


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.

  1. Is there a clear difference in the average reading and writing scores?

There is no clear difference in the average reading and writing scores.

  1. Are the reading and writing scores of each student independent of each other?

The reading and writing scores of each student are paired.

  1. Create hypotheses appropriate for the following research question: is there an evident difference in the average scores of students in the reading and writing exam?

\(H_0\): The difference in the average scores of students is 0. \(H_A\): The difference in the average scores of students is not equal to 0.

  1. Check the conditions required to complete this test.

The difference distribution doesnt seem skewed and fairly normal. Students were selected randomly and we can assume the difference between reading and wrting scores for one student is independent of another one.

  1. The average observed difference in scores is \({ \widehat { x } }_{ read-write }=-0.545\), and the standard deviation of the differences is 8.887 points. Do these data provide convincing evidence of a difference between the average scores on the two exams?
n <- 200
df <- n-1
sd <- 8.887
mean_diff <- -0.545

se <- sd / sqrt(n)

# t-statistic
t_val <- (mean_diff - 0) / se
p_val <- pt(t_val, df)
p_val
## [1] 0.1934182

Since the p-value is more than 0.05, we fail to reject null hypothesis.

  1. What type of error might we have made? Explain what the error means in the context of the application.

Since we fail to reject NULL hypothesis, we might have made Type II error since we reject alternate hypothesis.

  1. Based on the results of this hypothesis test, would you expect a confidence interval for the average difference between the reading and writing scores to include 0? Explain your reasoning.

Since the test indicates that there is no difference in the reading and writing scores, I would expect 0 to be included in confidence interval.


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.

\(H_0\): The difference between average highway mileage of manual and automatic cars is 0. \(H_A\): The difference between average highway mileage of manual and automatic cars is not equal to 0.

mean_auto <- 22.92
mean_manual <- 27.88
sd_auto <- 5.29
sd_manual <- 5.01

n <- 26
df <- n-1
mean_diff <- mean_auto - mean_manual

se_auto <- sd_auto / sqrt(n)
se_manual <- sd_manual / sqrt(n)

se_diff <- sqrt(se_auto^2 + se_manual^2)

# t-statistic
t_val <- (mean_diff - 0) / se_diff
p_val <- pt(t_val, df)
p_val
## [1] 0.0009486853

Since the p-value is less than 0.05, we reject the null hypothesis.


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%?

sd <- 2.2
d <- 0.5

n <- 2*(2.8^2*sd^2)/d^2
n
## [1] 303.5648

They would need 304 enrollees.


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.

  1. Write hypotheses for evaluating whether the average number of hours worked varies across the five groups.

\(H_0\): The average number of hours worked is same across the five groups \(H_A\): Theremis at least one average which is not equal to others.

  1. Check conditions and describe any assumptions you must make to proceed with the test.

The observations are independent across groups. The data within each group is nearly normal and the variability across the groups is about equal which satisfies the conditions for ANOVA.

  1. Below is part of the output associated with this test. Fill in the empty cells.
mean <- c(38.67, 39.6, 41.39, 42.55, 40.85)
sd <- c(15.81, 14.97, 18.1, 13.62, 15.51)
n <- c(121, 546, 97, 253, 155)
d_frame <- data.frame(mean, sd, n)

n <- sum(d_frame$n)

k <- 5
df <- k-1

df_residual <- n-k
prf <- 0.0682

f_statistic <- qf(1-prf, df, df_residual)

mse <- 501.54/f_statistic
sum_sq <- df * 501.54
sum_sq_total <- sum_sq + 267382
  1. What is the conclusion of the test?

Since the p-value is 0.0682 which is greater than 0.05 so we fail to reject null hypothesis.