Graded: 5.6, 5.14, 5.20, 5.32, 5.48
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.
The sample mean would be exactly in the middle between the upper and lower bounds of the confidence interval, so…
# Sample Mean
mu = (65 + 77) / 2
mu
## [1] 71
If we have a 90% confidence interval then the difference of each of the bounds from the mean is equal to the margin of error and is also equal to \(t^{\star}\) times the standard error which is the sample standard deviation divided by the square root of \(n\).
# Calculate the Margin or Error
ME <- 77-71
ME
## [1] 6
# Calculate the T-score
t <- qt(.05, df=24)
t
## [1] -1.710882
# Use the t-score to calculate the sample standard error
s = ME/t * sqrt(25)
round(s, 2)
## [1] -17.53
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.
For a confidence interval of 90% we want our ME which equals \(1.65 \times \frac{250}{\sqrt{n}}\) to be less than 25.
z <- qnorm(.95, mean = 0, sd = 1)
n <- ((z^2) / (25^2)) * 250^2
ceiling(n)
## [1] 271
z <- qnorm(.995, mean = 0, sd = 1)
n <- ((z^2) / (25^2)) * 250^2
ceiling(n)
## [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.
Ex5.20
There is no clear difference in the average reading and writing scores based on the boxplots and histogram of the distribution of differences alone. The distribution looks fairly normal centered around zero and the boxplots have similar medians and variances.
No they are paired observations since each case has both a reading and a writing score.
\(H_0: \mu_{diff} = 0\) – There is no difference in the average scores of students in the reading and writing exams.
\(H_A: \mu_{diff} \neq 0\) – There is a difference in the average scores of students in the reading and writing exams.
First calculate the T-score…
SE <- 8.887/sqrt(200)
t = (-0.545-0)/SE
t
## [1] -0.867274
Then use the T-Score to calculate the P-Value…
p = pt(q=t, df=199, lower.tail = TRUE)
2 * p
## [1] 0.3868365
Since p-value greater than 0.05, we fail to reject the null hypothesis. There is not enough statistical evidence to say the difference between the average reading and writing scores is not due to normal sampling differences.
We have have made a Type 2 error, failing to reject the null when there is actually a difference in the students’ reading and writing scores and the alternative hypothesis is true.
Yes, since a p-value of .387 means that if the null hypothesis is true we would expect to get a sample with a mean difference equal to or greater than our sample mean difference about 38.7% of the time, I would expect our confidence interval to include 0 our null value.
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.
Ex5.32
auto_mu <- 16.12
auto_s <- 3.58
man_mu <- 19.85
man_s <- 4.51
n <- 26
diff <- man_mu - auto_mu
# standard error
se <- sqrt((auto_s^2/n) + (man_s^2/n))
# T-score
t <- (diff - 0)/se
t
## [1] 3.30302
p = pt(q=t, df=n-1, lower.tail = FALSE)
p
## [1] 0.001441807
Since the p-value is 0.0014, there is strong evidence of a difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage.
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.
Ex5.48a
\(H_0:\) The mean hours worked is the same across all educational attainment groups
\(H_A:\) There is a difference in the mean hours worked in at least one group.
Ex5.48b
# Not sure why I had to do this but my number format came out wacky if I didn't...
# Solution found here:
# https://stackoverflow.com/questions/9397664/force-r-not-to-use-exponential-notation-e-g-e10
options(scipen = 999)
# dfg = number of groups minus 1
dfg <- 4
# dfe = total number of cases minus the number of groups
dfe <- 1167
# Known values
MSG <- 501.54
sse <- 267382
# Calculate the missing values
MSE <- sse / dfe
ssg <- dfg * MSG
f <- MSG / MSE
dft <- dfg + dfe
sst <- ssg + sse
p <- pf(q = f, dfg, dfe, lower.tail = FALSE)
p
## [1] 0.06819325
| ANOVA Summary | Df | Sum Sq | Mean Sq | F Value | Pr(>F) |
|---|---|---|---|---|---|
| degree | 4 | 2006.16 | 501.54 | 2.1889925 | 0.0681932 |
| Residuals | 1167 | 267382 | 229.1191088 | ||
| Totals | 1171 | 269388.16 |
If we use the typical \(\alpha = 0.05\) significance level then our p-value at 0.07 is greater than our significance level, so we would fail to reject the null hypothesis. There is not enough statistical evidence to support our alternative hypothesis in favor of the null.