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 <- (65 + 77)/2
sample_mean
## [1] 71

Critical value of t-distribution df=24 two-tail for 90%: 1.71

SE <- (77 - 71)/1.71
margin_of_error <- SE * 1.71
margin_of_error
## [1] 6
sample_sd = SE * sqrt(25)
sample_sd
## [1] 17.54386

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.

a, Raina wants to use a 90% confidence interval. How large a sample should she collect?

Z_.90 of normal distribution 2-tail: 1.64

((250*1.64)/25)^2
## [1] 268.96

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

Answer: Since Luke wants a narrower confidence interval, he needs to collect a larger sample to have higher confidence that the sample is representative of the population.

c, Calculate the minimum required sample size for Luke.

z_.99 = 2.58

((250*2.58)/25)^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.

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. Box plots show some difference, but the mean scores are fairly close to each other. Additionally, it looks like the histogram of the difference may be centered at 0.

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

Answer: The same is random, and the size of 200 would be less than 10% of the population. So it sounds reasonable to assume independence in this case.

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: H_0: There is no difference in the reading and writing scores -> reading - writing = 0. H_A: There is a difference in the reading and writing scores -> reading - writing != 0.

d, Check the conditions required to complete this test.

Answer: The reading and writing scores of each student are independent from each other. Sample is random. Size of 200 is less than 10% of the population. The distribution of reading - writing looks approximately normal. I don’t see any strong skew. A sample size of 200 should be big enough when there is moderate skew.

e, The average observed difference in scores is ¯xread-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, avg_read-write = -0.545, sd_read-write = 8.887

SE <- 8.887/sqrt(200)
SE
## [1] 0.6284058
T <- (-0.545 - 0)/SE
T
## [1] -0.867274
pt(q=-0.867274, df=200 - 1, lower.tail = TRUE)
## [1] 0.1934182

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

Answer: If there is a difference, then we would have made a type II error since we failed to reject the null hypothesis. It means that there is really a difference in the average scores between reading and writing and we failed to detect 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.

SE <- 8.887/sqrt(200)
critical_value <- qt(p=(.05/2), df=199, lower.tail=FALSE)
critical_value
## [1] 1.971957
avg_read_minus_write <- -0.545
c(avg_read_minus_write - SE * critical_value, avg_read_minus_write + SE * critical_value)
## [1] -1.7841889  0.6941889

5.32 Fuel efficiency 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.

H_0: There is no difference -> diff_auto_manual = 0

H_A: There is a difference -> diff_auto_manual != 0.

n <- 26

mean_a <- 16.12
sd_a <- 3.58
var_a <- sd_a^2

mean_m <- 19.85
sd_m <- 4.51
var_m <- sd_m^2

diff_auto_manual <- mean_a - mean_m
diff_auto_manual
## [1] -3.73
SE <- sqrt((var_a/n) + (var_m/n))
SE 
## [1] 1.12927
t_score <- (diff_auto_manual - 0)/SE
t_score
## [1] -3.30302
p_value <- 
pt(q=t_score, df= n-1, lower.tail = TRUE) * 2
p_value
## [1] 0.002883615

5.48 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: H_0: The average number of hours worked on all 5 groups are the same. H_a: There is at least one group amount the 5 groups with a different average number of hours worked.

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

Answer:

1, observations are independent within and across groups.

2, data within each group are nearly normal.

3, variability across groups is about the same.

4, The respondents is less than 10% of the population. I am going to assume that the sample was selected randomly from the survey database. So it is reasonable to say that the observations are independent within and across groups.

5, assume that data within each group is approximately normal. Number of hours worked should be roughly normal. Most people work the typical number of hours for week.

6, Looking at the side by side plots, the groups are somewhat the same in terms of the range of number of hours worked. The mean are roughly the same. So variability across groups is about the same.

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

Answer:

k = 5

n = 1,172

df=k-1: 4

sum sq: 2004.0793

F value: 2.1868

df=n-k=1167

mean sq: 229.1120

d, What is the conclusion of the test?

Answer: P(>F): 0.0682. At significance level of 0.05, we fail to reject the null hypothesis that the means of the groups are different. There is about a 7% chance that this kind of variability is present when the means of the groups are the same.