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.
## [1] 71
## [1] 6
## [1] 17.53481
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.
90% CI \(\rightarrow\) qnrom(0.95)
## [1] 271
Luke’s sample would be larger than Raina’s. A 99% condifence interval requires a higher z score so the n in the denominator would have to increase to keep the marking of error at 25.
99% CI \(\rightarrow\) qnrom(0.995)
## [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.
There appears to be a slight difference in the averages scores, but it is not “clear”.
The reading and writing scores are probably dependent on each other since being good at one usually implies being good at the other.
Ho: \(\mu_{diff} = 0\)
Ho: \(\mu_{diff} \neq 0\)
The conditions are:
- The distribution is normal. True
- The data are symmetric, unimodal, without outliers. True
Calculate test statistic
## [1] -0.867274
Calculate propability of observing the test statistic or a more extreme outcome
## [1] 0.3868365
Since the p value is greater than 0.05 we do not reject the null hypothesis and conclude that there is no difference in reading and writing scores.
We may have made a type II error which is failing to reject Ho when you should have.
We would expect the confidence interval to include 0 meaning that it would take a large point estimate deviation to not have the null hypothesis mean of 0 included in the interval.
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.
98% CI \(\rightarrow\) qt(0.99, df)
x_diff <- x_b - x_a
s_diff <- sqrt(s_a^2/n_a+s_b^2/n_b)
df <- min(n_a-1, n_b-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
The condifence interval does not include 0 which would be expected if the means were the same. The results suggest that average fuel efficiency of manual cars is indeed higher than automatic cars.
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%?
## [1] 0.1784704
## [1] 304
304 new enrollees would be needed to detect an effect size of 0.5 at the desired power level of 80% at 95% significance???
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.
Ho: \(\mu_{lhs} = \mu_{hs} = \mu_{jcol} = \mu_{bach} = \mu_{grad}\)
Ha: \(\mu_{lhs} \neq \mu_{hs} \neq \mu_{jcol} \neq \mu_{bach} \neq \mu_{grad}\)
The conditions are: 1. Independence within groups, independence between groups (not paired)
2. Approximately normal 3. Roughly equal variance
Assumptions: 1. random sample/assignment
2. less than 10%
## ── Attaching packages ───────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.1 ✔ purrr 0.3.2
## ✔ tibble 2.1.3 ✔ dplyr 0.8.3
## ✔ tidyr 0.8.3 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## ── Conflicts ──────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
y <- gss_sub$hrs1
y_bar <- mean(gss_sub$hrs1)
sse <- 267382
msg <- 501.54
sst <- sum((y - y_bar)^2)
ssg <- sum(data$n*(data$mean - y_bar)^2)
df_tot <- length(gss_sub$degree) - 1
df_deg <- length(data$degree) - 1
df_res <- df_tot - df_deg
mse <- sse/df_res
f <- msg/mse
sst## [1] 269388.3
## [1] 2006.162
## [1] 1171
## [1] 4
## [1] 1167
## [1] 229.1191
## [1] 2.188992
## [1] 0.06819325
The p value is larger than 0.05 so we fail to reject the null hypothesis and conclude that the data does not provide convincing edivdence that at least one pair of population means are different.