Practice: 5.5, 5.13, 5.19, 5.31, 5.45
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
sample mean = \(\frac{X2+X1}{2}\)
MARGING OF ERROR
Marging of Error = \(\frac{X2-X1}{2}\)
obb <- 25
SampleMean <- (65+77)/2
ME <-(77-65)/2
tdf <- round(qt(c(.05, .95), df=24)[2], 3)
SE <- round((77-SampleMean)/tdf, 3)
sd <- SE * sqrt(25)Our \(\bar{x}\) is 71, The margin of error is 6 and the sample SD is 17.535.
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.
25 = \(z * \frac{250}{\sqrt{n}}\)
or simplified
\(n = (10 * z)^2\)
A. Raina wants to use a 90% confidence interval. How large a sample should she collect?
# estimate z score of 90% confidence interval is 1.645
z.90 <- round(((250/25) * 1.645)^2, 0)
z.90## [1] 271
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.
Luke’s sample should be larger since it will require a higher z number multiplied by the standard deviation and then squared.
C. Calculate the minimum required sample size for Luke.
# estimate z score of 99% confidence interval is 2.576
z.99 <- round(((250/25) * 2.576)^2, 0)
z.99## [1] 664
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.
5.20
A. Is there a clear difference in the average reading and writing scores?
No. The means seem slighly different, but the distribution of differences looks normal.
B. Are the reading and writing scores of each student independent of each other?
No. The scores of either reading or writing are independant.
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?
\(H_O\): \(\mu_r - \mu_w = 0\), No difference between the average reading and writing scores.
\(H_A\): \(\mu_r - \mu_w \neq 0\), There is a difference.
D. Check the conditions required to complete this test.
1.Independence of observations: The difference histogram suggested the data are paired. If paired, then they wouldn’t be independent.
2.Observations come from nearly normal distribution: The box plot provided in the text suggests the data are reasonably normally distributed and no outliers exist.
E. The average observed difference in scores is \(\bar{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?
SE <- round(8.887 / sqrt(200), 3)
t <- round((-0.545-0)/SE, 3)
p <- round(2 * pt(t, 199), 3)Our calculated p score is 0.386, which causes us to reject \(H_A\). There is not convincing evidence of a difference between the average means.
F. What type of error might we have made? Explain what the error means in the context of the application.
Since we have rejected \(H_A\), if it were actually true, we would have made a type II error. That means that although we chose to accept \(H_0\), there actually is convincing evidence of a difference in means. If we took a larger sample, we would decrease our chances of making a type II error.
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.
We would expect confidence intervals to include 0, as it has been determined that there is no convincing evidence of a difference in average means.
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_O\): \(\mu_a - \mu_m = 0\), No difference between the average automatic and manual MPG.
\(H_A\): \(\mu_a - \mu_m \neq 0\), There is a difference.
\(\sigma = .05\)
n <- 26
mdiff <- 16.12 - 19.85
sddiff <- 3.58 - 4.51
SEdiff <- sqrt((3.58^2)/n + (4.51^2)/n)
t <- (mdiff-0)/SEdiff
p <- round(2 * pt(t, n-1), 3)
p## [1] 0.003
With \(\sigma = .05\) and p = 0.003, we reject \(H_0\). There is convincing evidence of a difference in the means of miles per gallon in manual and automatic transmissions.
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.
\(H_0: \mu_{<HS} = \mu_{HS} = \mu_{JR} = \mu_{B} = \mu_{G}\). The avg hours worked arcross all five groups does not vary.
\(H_A:\) The avg hours across some or all groups does vary.
B. Check conditions and describe any assumptions you must make to proceed with the test.
The data in each group appears relatively normal and the variability is similar across each group. In order to perform an ANOVA test, we are assuming that the observations are independant.
C. Below is part of the output associated with this test. Fill in the empty cells
k <- 5
df_G <- k-1
n <- 1172
df_E <- n - k
df_T <- df_G + df_E
gmean <- 40.45
SSW <- round(sum((121-1)*15.81^2, (546-1)*14.97^2, (97-1)*18.1^2,
(253-1)*13.62^2, (155-1)*15.51^2), 0)
SSB <- round(sum(121*(38.67-gmean)^2, 546*(39.6-gmean)^2, 97*(41.39-gmean)^2,
253*(42.55-gmean)^2, 155*(40.85-gmean)^2), 0)
SST <- round(SSW + SSB, 0)
MSB <- round(SSB / (k-1), 2)
MSW <- round(SSW / (n-k), 2)
f <- round(MSB / MSW, 3).
D. What is the conclusion of the test? There is not enough evidence for us to reject \(H_0\), thus we accept and conclude there is not convincing eveidence that the avg hours worked per week is any different for the 5 educational groups.