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.
m<-(65+77)/2
m
## [1] 71
ME<-(77-61)/2
ME
## [1] 8
t = 1.711
SE<-ME/t
sd<-SE*sqrt(25)
sd
## [1] 23.37814
mean = 71 Margin of error = 8 Standard Deviation = 23.38
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.
Raina needs at least a sample size of 271 students
z<-1.645
sd<-250
sds<-250^2
ME <-25
#25=z*sqrt(sds/n)
#ME^2=z^2*sds/n
#ME^2*n=z^2*sds
n<-(z^2*sds)/(ME^2)
n
## [1] 270.6025
Luke’s sample should be larger than Raina’s. If he wants to be sure there is a 99% probability that the population mean falls within his interval he will need a larger sample size to reduce the impact of outliers on his analysis.
Luke’s minimum sample size is 664
z<-2.576
sd<-250
sds<-250^2
ME <-25
#25=z*sqrt(sds/n)
#ME^2=z^2*sds/n
#ME^2*n=z^2*sds
n<-(z^2*sds)/(ME^2)
n
## [1] 663.5776
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.
There is not a clear difference between the average reading and writing scores.
No, I would say that students with good reading scores will generally have good wrting scores and visa versa.
H0: The difference between the averag of reading scores and writing score is zero. HA: The difference between the averag of reading scores and writing score is not zero.
n>30 is true sample is random is true independence is false
d <- -.545
df <- 200-1
sd <- 8.887
SE <- sd/sqrt(200)
t <- (d)/SE
p <- pt(t, df)
p
## [1] 0.1934182
With a p-value of .197 we cannot reject the null hypothesis in fvor of the alternative hypothesis.
WE may have a type 2 error since we failed to reject the null hypothesis. This means there was actually a difference in the average scores but we failed to recognized that and declared there was no difference.
Yes, it is likely that the confidence interval would include 0. This is because it is possible that the population average reading score could be higher or lower than the population average writing score.
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.
manual <- c(rnorm(26, mean = 27.88, sd = 5.01))
auto <- c(rnorm(26, mean = 22.92, sd = 5.29))
t.test(manual,auto, conf.level=.98)
##
## Welch Two Sample t-test
##
## data: manual and auto
## t = 3.4625, df = 48.439, p-value = 0.001128
## alternative hypothesis: true difference in means is not equal to 0
## 98 percent confidence interval:
## 1.553632 8.628366
## sample estimates:
## mean of x mean of y
## 26.62849 21.53749
The confidence interval is (1.026,8.82). WE are 98% confident that the difference between the population means falls within our interval.
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%?
n=((z+p)/((d)/sd))^2
z=1.96
p=0.84
d=.5
sd=2.2
ES<-(4.5-4)/2.2
ES
## [1] 0.2272727
n<-((z+p)/ES)^2
n
## [1] 151.7824
They would need 152 additonal enrollees.
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: All averages of hours worked per week are equal across educational attainment.
H0: At least one average of hours worked per week differ across educational attainment.
normal distribution or n>30 = TRUE variability is similar accross groups : TRUE Samples are idenepedent of one another : TRUE
degreedf<-5-1
residdf<-1172-5
F <- qf( 1 - 0.0682, degreedf , residdf)
F
## [1] 2.188931
#F=MSG/MSE
MSE<-501.54/F
MSE
## [1] 229.1255
SSG<-degreedf*501.54
SSG
## [1] 2006.16
TSG<-SSG+267382
TSG
## [1] 269388.2
This depends on the significance level. The p-value = 0.0682 which at alpha = .05 fails to reject the null hypothesis but using alpha = .1 we would reject the null hypothesis in favor of the alternate.