Week 5 Homework
5.6 Working backwards, Part II. A 90% con???dence interval for a population mean is (65, 77). The population distribution is approximately normal and the population standard deviation is unknown. This con???dence interval is based on a simple random sample of 25 observations. Calculate the sample mean, the margin of error, and the sample standard deviation.
n<-25
dfn<-n-1
dft<-qt(.010, dfn)
smn<-(65+77)/2
ssd<-sqrt((65*5)/(1-qnorm(.025)))
sme<-ssd/sqrt(n)
The sample mean is 71, standard deviation is 10.4784843 with a standard error of 2.0956969
5.14 SAT scores. 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 wants to use a 90% con???dence interval. How large a sample should she collect?
ceiling(pnorm(.9)*25+25*1.96)
## [1] 70
- Luke wants to use a 99% con???dence interval. Without calculating the actual sample size, determine whether his sample should be larger or smaller than Raina’s, and explain your reasoning.
At a higher conifdence Lukes sample should be lager. Higher confidence interval may cause higher chanse of type 2 errors.
- Calculate the minimum required sample size for Luke.
floor(pnorm(.99)*25+25*qnorm(.99))
## [1] 79
5.20 High School and Beyond, Part I. 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 di???erences in scores are shown below.
- Is there a clear di???erence in the average reading and writing scores?
Writing scores are slightly higher than reading scores.
- Are the reading and writing scores of each student independent of each other?
Reading and writing scores of students are dependent. If better reading scores should correlate to better writing scores.
- Create hypotheses appropriate for the following research question: is there an evident di???erence in the average scores of students in the reading and writing exam?
Null hypothesis states that there is no difference between student average reading and writing scores. The alternate hypothesis states that there is a difference between student reading and writing scores.
- Check the conditions required to complete this test.
The sample seems nearly norm and random with no extreme skewing and number of samples is over 30 so it is large enough for the test.
- The average observed di???erence in scores is ¯ xreadwrite =0.545, and the standard deviationof the di ???erences is 8.887 points. Do these data provide convincing evidence of a di???erence between the average scores on the two exams?
se<-8.887/sqrt(200)
zs<-(-.545-0)/(se)
pnorm(zs)
## [1] 0.192896
With pvalue 0.192896 it does not provide enough evidence to reject the null hypothesis.
- What type of error might we have made? Explain what the error means in the context of the application.
A type 1 error could have been made if we rejected the null hypothesis when in fact the should have failed to reject the null hypothesis.
- Based on the results of this hypothesis test, would you expect a con???dence interval for the average di???erence between the reading and writing scores to include 0? Explain your reasoning.
Since we are rejecting the Null hypothesis of 0 we do not expect the confidence interval to include 0.
5.32 Fuel eciency of manual and automatic cars, Part I. Each year the US Environmental Protection Agency (EPA) releases fuel economy data on cars manufactured in that year. Below are summary statistics on fuel eciency (in miles/gallon) from random samples of cars with manual and automatic transmissions manufactured in 2012. Do these data provide strong evidence of a di???erence between the average fuel eciency of cars with manual and automatic transmissions in terms of their average city mileage? Assume that conditions for inference are satis???ed.
pes<- 19.85-16.12
sem<-round(sqrt(3.58^2/26 + 4.51^2/26),2)
ts<-pes-0/sem
qt(.95,df=25)
## [1] 1.708141
sem/sqrt(25)
## [1] 0.226
2 * pt(sem, 25, lower.tail = FALSE)
## [1] 0.2692017
c(round((19.85-16.12)-1.96*sem,2),round((19.85-16.12)+1.96*sem,2))
## [1] 1.52 5.94
The pvalue 0.9999043, is larger than significance value of .05 so we fail to reject the NULL hypothesis.
5.48 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.
- Write hypotheses for evaluating whether the average number of hours worked varies across the ???ve groups.
The Null hypothesis states that average number of hours do NOT vary among 5 groups. The Alternative hypothesis states that average number of hours vary among 5 groups.
- Check conditions and describe any assumptions you must make to proceed with the test.
The sample seems nearly norm and random with no extreme skewing and number of samples is over 30 for all groups, so they are large enough for the test.
- Below is part of the output associated with this test. Fill in the empty cells.
Df Sum Sq Mean Sq F value Pr(>F)
degree 4 2006 501.5 2.18 0.0682
Residuals 1167 `267,382 229.976
Total 1171 269,388
pf(2.18, 4, 1167, lower.tail = FALSE)
## [1] 0.0691914
- What is the conclusion of the test?
The conclusion is pvalue is greater than .05 we are 95% certain that average number of hours do NOT vary between the 5 groups and therefor we do not reject the null hypothesis.