5.6 Working backwards, Part II. 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:
(77+65)/2
## [1] 71
#margin of error:
me<- (77-65)/2
#sample standard deviation:
t <- qt(.95, 24)
sd <- me/t*5
sd
## [1] 17.53481
5.14 SAT scores. 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.
sd<-250
me<-25
(1.65*sd/me)^2
## [1] 272.25
#She should collect 273 samples
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.
Luke’s sample should be larger than Raina’s because increasing the sample size decreases the width of confidence intervals
Calculate the minimum required sample size for Luke.
(2.58*sd/me)^2
## [1] 665.64
5.20 High School and Beyond, Part I. 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.
Is there a clear difference in the average reading and writing scores?
The mean for writing appears slightly larger than for reading, but the distribution looks relatively normal
Are the reading and writing scores of each student independent of each other?
Yes, reading and writing scores of each student independent of each other
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?
Null hypothesis: The difference between the average reading and writing exam scores is equal to zero
Alternative hypothesis: The difference between the average reading and writing exam scores is not equal to zero
Check the conditions required to complete this test.
The average observed difference in scores is x̄read-x 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?
sdDiff <- 8.887
muDiff <- -0.545
n <- 200
df<-n-1
SE <- sdDiff/sqrt(n)
t <- (muDiff-0)/SE
p <- pt(t, df=df)
p
## [1] 0.1934182
#The p-value is greater than 0.05 so we fail to reject the null hypothesis and conclude that there is not convincing evidence of a difference between the average scores on the two exams
What type of error might we have made? Explain what the error means in the context of the application.
Since we did not reject the null hypothesis we are at risk of making a type II error which is failing to reject a false null hypothesis. So if we made a type II error, we should have concluded that the data provide convincing evidence of a difference between the average scores on the two exams
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.
Yes, based on the results of this hypothesis test I would expect 0 to be in our confidence interval because 0 means there is no difference between the two average test scores
5.32 Fuel effciency of manual and automatic cars, Part I. Each year the US Environmental Protection Agency (EPA) releases fuel economy data on cars manufactured in that year. Below are summary statistics on fuel efficiency (in miles/gallon) from random samples of cars with manual and automatic transmissions manufactured in 2012. Do these data provide strong evidence of a difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage? Assume that conditions for inference are satisfied.
n <- 26
mu.a <- 16.12
sd.a <- 3.58
mu.m <- 19.85
sd.m <- 4.51
muDiff <- mu.a - mu.m
SeDiff <- sqrt((sd.a^2/n) + (sd.m^2/n))
t <- (muDiff-0) / SeDiff
df <- n - 1
p <- pt(t, df = df)
p
## [1] 0.001441807
#The p-value is less than 0.05 so we reject the null hypothesis in favor of the alternative and conclude that these data provide strong evidence of a difference in fuel efficiency between manual and automatic transmissions
5.48 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.
Write hypotheses for evaluating whether the average number of hours worked varies across the five groups.
Null hypothesis: The difference among the average number of hours worked across the five groups is equal to 0.
Alternative hypothesis: The difference among the average number of hours worked across the five groups is not equal to 0.
Check conditions and describe any assumptions you must make to proceed with the test.
By looking at the box plot we see that there are outliers in each plot so we will assume the conditions are met
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)
dataTable <- data.frame (mean, sd, n)
total <- sum(dataTable$n)
k <- 5
df <- k - 1
df
## [1] 4
res <- total - k
res
## [1] 1167
#Use Pr(>F) to find F statistic
prF <- 0.0682
fStat<- qf( 1 - prF, df , res)
fStat
## [1] 2.188931
#F-statistic = MSG/MSE
MSG <- 501.54
MSE <- MSG / fStat
MSE
## [1] 229.1255
#MSG = 1 / df * SSG
SSG <- df * MSG
SSG
## [1] 2006.16
SSE <- 267382
#SST = SSG + SSE and dft = df + res
SST <- SSG + SSE
SST
## [1] 269388.2
dft <- df + res
dft
## [1] 1171
table <- data.frame(
names <- c("degree","Residuals","Total"),
Df <- c("4","1167","1171"),
SumSq <- c("2006.16","*267382","269388.2"),
MeanSq <- c("*501.54","229.13",""),
Fvalue <- c("2.19","",""),
prf <- c("*0.0682","","")
)
colnames(table) <- c("names","Df","Sum Sq","Mean Sq","F value","Pr(>F)")
knitr::kable(table)
| names | Df | Sum Sq | Mean Sq | F value | Pr(>F) |
|---|---|---|---|---|---|
| degree | 4 | 2006.16 | *501.54 | 2.19 | *0.0682 |
| Residuals | 1167 | *267382 | 229.13 | ||
| Total | 1171 | 269388.2 |
What is the conclusion of the test?
Since the p-value is greater than 0.05, we reject the alternative hypothesis is rejected in favor of the null hypothesis that the difference among the average number of hours worked across the five groups is equal to 0