Problem 1

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.

Answer: Sample Mean:

sample_mean <- (65+77)/2
sample_mean
## [1] 71

Margin of Error

margin_of_error <- (77-65)/2
margin_of_error
## [1] 6

Sample Standard Deviation

degree_of_freedom <- 25-1
t_value <- qt(0.95,degree_of_freedom)
standard_error <- margin_of_error/t_value
standard_deviation <- standard_error*sqrt(25)
standard_deviation
## [1] 17.53481

Problem 2

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.

(a) Raina wants to use a 90% confidence interval. How large a sample should she collect? (b) 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. (c) Calculate the minimum required sample size for Luke.

Answer:

  1. the sample size should be at least 271.
standard_deviation <- 250
margin_of_error <- 25
z<-qnorm(0.95)
standard_error <- margin_of_error/z
n <- (standard_deviation/standard_error)^2
n
## [1] 270.5543
  1. Luke’s sample size should be larger than Raina’s. Generally speaking, to use a more precise confidence interval, we need larger sample size. When the value of confidence interval increases, the critical value increases. Assume a constant margin of error and standard deviation, when critical value increases, standard_error decreases,so sample size n increases.

  2. the sample size sould be at least 664.

standard_deviation <- 250
margin_of_error <- 25
z<-qnorm(0.995)
standard_error <- margin_of_error/z
n <- (standard_deviation/standard_error)^2
n
## [1] 663.4897

Problem 3

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.

(a) Is there a clear difference in the average reading and writing scores?

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

(b) Are the reading and writing scores of each student independent of each other?

Answer: Treading and writing scores are a pair of scores from the same student, therefore they are dependent.

(c) 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?

answer:

H0: There isn’t an evident difference in the average scores of students in the reading and writing exam.

H1: There is an evident difference in the average scores of students in the reading and writing exam.

(d) Check the conditions required to complete this test.

Answer:

Conditions: 1) Each pair of scores are independent from each other pairs; 2) Assume the sample size is less than 10% of the population.

(e) 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?

Answer:

The p-value is 0.386 > 0.05, therefore we don’t reject the null hypotheses that there isn’t an evident difference in the average scores of students in the reading and writing exam.

margin_of_error <- -0.545
standard_deviation <- 8.887
standard_error <- standard_deviation / sqrt(200)
z <- margin_of_error/standard_error
p_value <- pnorm(z)*2
p_value
## [1] 0.3857919

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

Answer: When we don’t reject the null hypothesis, we may make type II error that we fail to reject the null hypotheses. In this question, type II error means that there is an evident difference in the average scores of students in the reading and writing exam however we fail to prove it.

(g) 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.

Answer: Yes, based on the results, there is no evident difference in the average scores of students in the reading and writing exams, which means the difference = 0. Therefore, we would expect a confidence interval to include 0.


Problem 4

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.

Answer:

The 98% confidence interval is (-8.510922 -1.409078), which means the average of difference between average highway mileage of manual and automatic cars falls in the range from -8.510922 to -1.409078 98% of the time.

mean_automatic <- 22.92
mean_manual <- 27.88
sd_automatic <- 5.29
sd_manual <- 5.01
n <- 26
standard_error <- sqrt(sd_automatic^2/n+sd_manual^2/n)
t_val <- qt(0.99, n-1)
margin_of_error <- standard_error*t_val
mean_difference <- mean_automatic - mean_manual
c98 <- c(mean_difference-margin_of_error, mean_difference+margin_of_error)
c98
## [1] -8.510922 -1.409078

Problem 5

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

Answer:

Assuming significance level is \(\alpha\) = 0.05, 304 new enrollees are needed for each interface to detect an effect size of 0.5 surveys per enrollee, if the desired power level is 80%.

sd1 <- 2.2
sd2 <- 2.2
effect_size <- 0.5
standard_error <- 0.5/(0.84+1.96)
n <- (sd1^2+sd2^2)/standard_error^2
n
## [1] 303.5648

Problem 6

Work hours and education. The General Social Survey collects data on demographics, education, and work, among many other characteristics of US residents. 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.

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

Answer:

H0: The average number of hours worked doesn’t vary accross the five groups.

H1: The average number of hours worked varies accross the five groups.

(b) Check conditions and describe any assumptions you must make to proceed with the test.

Answer:

Assumption:

  1. The cases are independent from each other.

  2. The distribution of the data is nearly normal.

  3. The deviation across groups are similar.

(c) Below is part of the output associated with this test. Fill in the empty cells.

k <- 5
df_g <- k-1
df_g
## [1] 4
n <- 1172
df_e <- n-k
df_e
## [1] 1167
df_t <- df_g + df_e
df_t
## [1] 1171
MSG <- 501.54
SSG <- MSG*df_g
SSG
## [1] 2006.16
SSE <- 267382
SST <- SSE+SSG
SST
## [1] 269388.2
MSE <- SSE/df_e
MSE
## [1] 229.1191
f<-MSG/MSE
f
## [1] 2.188992
Df Sum Sq Mean Sq F-value Pr(>F)
degree 4 2006.16 501.54 2.188992 0.0682
Residuals 1167 267,382 229.1191
Total 1171 269388.2

(d) What is the conclusion of the test?

Answer:

The P-value is 0.0682 > 0.05, we don’t reject the null hypothesis. The average number of hours worked doesn’t vary accross the five groups.