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

x1<-65
x2<-77
n<-25
paste("Sample Mean is",(x2+x1)/2)
## [1] "Sample Mean is 71"
paste("Margin of error is",ME<-(x2-x1)/2)
## [1] "Margin of error is 6"
df <- 25-1
p <- 0.9
p2tails <- p + (1-p)/2
tval <- qt(p2tails, df)
SE <- ME / tval
sd <- SE * sqrt(n)
paste("Sample standard deviation is",sd)
## [1] "Sample standard deviation is 17.5348145569379"

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
z <- qnorm(.95) 
n <- ((z*sd)/ME)^2
n
## [1] 270.5543
  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.

Answer

Luke’s sample should be larger since it will require a higher z number.

  1. Calculate the minimum required sample size for Luke.
z <- qnorm(.995)
sd <- 250
ME <- 25
n <- ((z*sd)/ME)^ 2 
n
## [1] 663.4897

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?

Answer

There does not seem to be much difference between the reading and writng scores.

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

Answer

The scores are not independent.

  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?

Answer

H0: Has no difference between the average reading and writing score.

HA: There is difference between the average reading and writing score.

  1. Check the conditions required to complete this test.

Answer

Our sample size is fairly large, we have independence, and the distribution of the differences appears roughly normal.

  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?

Answer

n <- 200
sd <- 8.887
xdiff <- -.545
sediff <- sd/(sqrt(n))
t <- (xdiff-0)/sediff

df <- n-1

p <- pt(t, df = df)
p
## [1] 0.1934182

The p-value is not less than 0.05, therefore, there is not enough evidence of a difference in the reading and writing scores.

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

Answer

Type error I: Incorrectly reject the null hypothesis. Type error II: Incorrectly reject the alternative hypothesis. Could have possibly made a type II error by rejecting the alternative 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.

Answer

I would expect it to contain 0 because we are fairly certain that the difference between reading and math scores are 0.


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

n <- 26

x_a <- 22.92
s_a <- 5.29

x_b <- 27.88
s_b <- 5.01

x_diff <- x_b - x_a
s_diff <- sqrt(s_a^2/n+s_b^2/n)
df <- min(n-1, n-1)
t <- (x_diff-0)/(s_diff)


me <- qt(0.99, df)*s_diff
ci <- c(x_diff-me, x_diff+me)
ci
## [1] 1.409078 8.510922

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

x_bar <- 4
s <- 2.2
mu_diff <- 0.5

se <- mu_diff/(qnorm(0.8)+qnorm(0.975))
se
## [1] 0.1784704
n <- (s^2+s^2)/se^2
ceiling(n)
## [1] 304

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.

Answer

H0: The difference of all averages is equal HA: At least one average is different

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

Answer

The observations are independent and data within each group is nearly normal.

  1. Below is part of the output associated with this test. Fill in the empty cells.

Answer

n <- 1172
k <- 5
dfG <- k-1
dfR <- n-k
totaldf <- dfG + dfR

# Using P determine F Stat
p <- .0682
F <- qf(1-p, dfR, dfG)

# Using MSR and F determine MSG
MSG <- 501.54
MSR <- MSG / F

# Using MSR 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
  1. What is the conclusion of the test?

Answer

Since p>0.05 we conclude that there is no significant difference between the groups.