Working backwards, Part II. (5.24, p. 203) 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.
Answer
x1<-65
x2<-77
n<-25
paste("Sample Mean is",(x2+x1)/2)
## [1] "Sample Mean is 71"
paste("Margin of error is",ME<-(x2-x1)/2)
## [1] "Margin of error is 6"
df <- 25-1
p <- 0.9
p2tails <- p + (1-p)/2
tval <- qt(p2tails, df)
SE <- ME / tval
sd <- SE * sqrt(n)
paste("Sample standard deviation is",sd)
## [1] "Sample standard deviation is 17.5348145569379"
SAT scores. (7.14, p. 261) 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
z <- qnorm(.95)
n <- ((z*sd)/ME)^2
n
## [1] 270.5543
Answer
Luke’s sample should be larger since it will require a higher z number.
z <- qnorm(.995)
sd <- 250
ME <- 25
n <- ((z*sd)/ME)^ 2
n
## [1] 663.4897
High School and Beyond, Part I. (7.20, p. 266) 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.
Answer
There does not seem to be much difference between the reading and writng scores.
Answer
The scores are not independent.
Answer
H0: Has no difference between the average reading and writing score.
HA: There is difference between the average reading and writing score.
Answer
Our sample size is fairly large, we have independence, and the distribution of the differences appears roughly normal.
Answer
n <- 200
sd <- 8.887
xdiff <- -.545
sediff <- sd/(sqrt(n))
t <- (xdiff-0)/sediff
df <- n-1
p <- pt(t, df = df)
p
## [1] 0.1934182
The p-value is not less than 0.05, therefore, there is not enough evidence of a difference in the reading and writing scores.
Answer
Type error I: Incorrectly reject the null hypothesis. Type error II: Incorrectly reject the alternative hypothesis. Could have possibly made a type II error by rejecting the alternative hypothesis.
Answer
I would expect it to contain 0 because we are fairly certain that the difference between reading and math scores are 0.
Fuel efficiency of manual and automatic cars, Part II. (7.28, p. 276) 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.
Answer
n <- 26
x_a <- 22.92
s_a <- 5.29
x_b <- 27.88
s_b <- 5.01
x_diff <- x_b - x_a
s_diff <- sqrt(s_a^2/n+s_b^2/n)
df <- min(n-1, n-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
Email outreach efforts. (7.34, p. 284) 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%?
Answer
x_bar <- 4
s <- 2.2
mu_diff <- 0.5
se <- mu_diff/(qnorm(0.8)+qnorm(0.975))
se
## [1] 0.1784704
n <- (s^2+s^2)/se^2
ceiling(n)
## [1] 304
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.
Answer
H0: The difference of all averages is equal HA: At least one average is different
Answer
The observations are independent and data within each group is nearly normal.
Answer
n <- 1172
k <- 5
dfG <- k-1
dfR <- n-k
totaldf <- dfG + dfR
# Using P determine F Stat
p <- .0682
F <- qf(1-p, dfR, dfG)
# Using MSR and F determine MSG
MSG <- 501.54
MSR <- MSG / F
# Using MSR determine SSR
SSG <- dfG * MSG
SSR <- 267382
SST <- SSG + SSR
ANOVA <- c("degree", "residuals", "Total")
Df <- c(dfG, dfR, totaldf)
Sum_Sq <- c(SSG, SSR, SST)
Mean_Sq <- c(MSG, MSR, "")
F_value <- c(F, "", "")
P <- c(p, "", "")
ANOVA_df <- data.frame(ANOVA, Df, Sum_Sq, Mean_Sq, F_value, P)
ANOVA_df
Answer
Since p>0.05 we conclude that there is no significant difference between the groups.