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.
90% CI
71+/- 1.645(sd/sqrt(n))
(65+77)/2 u<-71 sd<-18.237 ME<-6
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.
The sample she should collect is 270.
#find n the sample size
z<-1.645
sd<-250
ME=25
#ME<-z*(sd/sqrt(n))
(sd/ME*z)^2
## [1] 270.6025
His sample size would be larger to include 99% CI.
The minimum required sample size for Luke would be 665.5
#find n the sample size
z<-2.58
sd<-250
ME=25
#ME<-z*(sd/sqrt(n))
(sd/ME*z)^2
## [1] 665.64
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.
No there is no clear difference in the average reading and writing scores.
Yes the scores of each student is independent of each other. However this appears to be a pair data question.
H0- There is no difference in the average scores of students in the reading and writing exam. HA-There is a difference in the average scores of students in the reading and writing exam.
n is 200. The cases are independent of each other.
df<-n-1 df<-199 SE_x of diff= 0.6284058
n<-200
SE<-8.887
SE_xdiff<-SE/(sqrt(n))
xdiff<-0.545
T<-(xdiff-0)/SE_xdiff
T
## [1] 0.867274
What type of error might we have made? Explain what the error means in the context of the application.
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.
Yes,
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.
fuel_eff <- read.csv("https://github.com/jbryer/DATA606Fall2019/raw/master/course_data/fuel_eff.csv")
man_rows <- which(fuel_eff$transmission == "M")
aut_rows <- which(fuel_eff$transmission == "A")
set.seed(3583)
man_rows_samp <- sample(man_rows, 26)
aut_rows_samp <- sample(aut_rows, 26)
fuel_eff_samp <- fuel_eff[c(man_rows_samp,aut_rows_samp), ]
fuel_eff_samp$transmission <- droplevels(fuel_eff_samp$transmission)
levels(fuel_eff_samp$transmission) <- c("automatic", "manual")
boxPlot(fuel_eff_samp$hwy_mpg, fact = fuel_eff_samp$transmission, ylim = c(10, 37),
xlab = "Hwy MPG", axes = FALSE, xlim = c(0.5, 2.5))
axis(1, at = c(1,2), labels = c("automatic","manual"))
axis(2, at = c(15,25,35))
z score of 98% CI is 2.33.
df<-25
#info of auto cars
mean_auto<-22.92
sd_auto<-5.29
n_auto<-26
#info of manual cars
mean_manual<-27.88
sd_manual<-5.01
n_manual<-26
#find the differences of the means
mean_diff<-mean_auto-mean_manual
mean_diff
## [1] -4.96
SE<-sqrt(((sd_auto^2)/n_auto)+((sd_manual^2)/n_manual))
SE
## [1] 1.428881
With a df<-25 and 98% CI, the t* is 2.485.
-4.96 + (2.485* 1.428881)
## [1] -1.409231
-4.96 - (2.485* 1.428881)
## [1] -8.510769
(-8.510769,-1.409231)
We are 98% confident that the difference of highway mileage between automatic and manual cars are between (-8.51 and -.141).
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%?
They need 303.5648 new enrollees.
sd<-2.2
#0.5 = 2.8×SE
n<-(2.8^2/0.5^2)*(2.2^2+2.2^2)
n
## [1] 303.5648
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.
H0<-The average number of hours worked are the same across the five groups.
HA<- The average number of hours worked varies across the five groups.
• the observations are independent within and across groups • the data within each group are nearly normal • the variability across the groups is about equal
All these three conditions are met.
There are 5 groups. k<-5-1=4 n=total observations 1172
Dfe<-n-k= 1172-4= 1168
X1<-c("Df", "sumsq", "mean sq", "f value", "PR(>F)")
depth<-c("4", "2006.16", "501.54", "2.189","0.0682")
Residuals<-c("1167", "267,382", "229.12", "NA", "NA")
Total<-c("1171", "269388.16", "NA", "NA", "NA")
df<-data.frame(X1, depth, Residuals, Total, stringsAsFactors=FALSE)
The conclusion of this test is the average hours worked is different for at least one group.