5.6 Working backwards, Part II. 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:
n <- 25
margin_error <- (77-65)/2
margin_error
## [1] 6
t_value <- qt(0.95,n-1)
mean <- (77+65)/2
mean
## [1] 71
sd <- (margin_error/t_value)*5
sd
## [1] 17.53481
Mean 71, margin of error 6 and sample standard deviation 17.53481.
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.
Answer:
z <- qnorm(0.95)
n <- (z*250/25)^2
n
## [1] 270.5543
The sample size should be 271.
Answer: Luke’s sample size will be larger than Raina’s since increasing confidence interval will increase the value of Z in the numerator of sample size calculation formula which will in turn increase the sample size.
Answer:
z <- qnorm(0.01/2)
n <- (z*250/25)^2
ceiling(n)
## [1] 664
The Luke’s minimum sample size should be 664
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 differences in scores are shown below.
Answer: There is not clear difference in the average reading and writing scores since the distribution of the difference scores is approximately symmetrical.
Answer: The reading and writing scores of each students are independent of each other.
Answer: Null Hypothesis: There is no difference between mean writing and reading score of the students. Alternative Hypothesis: There is difference between mean writing and reading score of the students.
Answer: The following conditions are true 1. Observations are independent 2. Difference of scores of Observations are approximately normal and the sample size is large.
Answer:
se <- 8.887/sqrt(200)
t_statistics <- 0.545/se
t_statistics
## [1] 0.867274
print("two tailed p-value")
## [1] "two tailed p-value"
pt(t_statistics, 200-1)*2
## [1] 1.613164
Since the p value is > 0.05 at 5% level of significance we accept the null hypothesis.We can say that these data don’t provide convincing evidence of a difference between the average scores on the two exams.
Answer: We might have made type 2 error. The mean difference of the reading and writing score is different than 0.
Answer:I would expect a confidence interval for the average difference between the reading and writing scores to include 0.Because the sample estimate is close to the null estimate. Confidence interval
0.545+t_statistics
## [1] 1.412274
0.545-t_statistics
## [1] -0.322274
5.32 Fuel efficiency of manual and automatic cars, Part I. Each year the US Environs- mental Protection Agency (EPA) releases fuel economy data on cars manufactured in that year. Below are summary statistics on fuel efficiency (in miles/gallon) from random samples of cars with manual and automatic transmissions manufactured in 2012. Do these data provide strong evidence of a difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage? Assume that conditions for inference are satisfied.
Answer: Null Hypothesis: The data provides strong evidence that there is no difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage Alternative Hypothesis:
The data provides strong evidence that there is difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage
t_statistics <- (19.85-16.12)/sqrt((4.51^2+3.58^2)/26)
t_statistics
## [1] 3.30302
# two_tailed p value
pt(t_statistics,26-1, lower.tail = FALSE)*2
## [1] 0.002883615
Since the p value is 0.002883615 < 0.05 at 5% we reject the null hypothesis and conclude that the data provides strong evidence that there is difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of their average city mileage
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.
Answer: Null Hypothesis: Average weekly exercise hour is same for all the groups Alternative Hypothesis: Average weekly exercise hour is not same for all the groups (b) Check conditions and describe any assumptions you must make to proceed with the test. Answer: The observations are independent.
Observations within each groups are approximately normal we can see from the box plot except HS and Bachelor’s seem to exhibit newness. As each group size is large it won’t be a big problem.
Variance of the 5 groups are approximately similar.
Answer:
n <- 1172
group <- 5
MSG <- 501.54
SSE <- 267382
(df_group <- group -1)
## [1] 4
(df_R <- n - group)
## [1] 1167
(df_total <- n-1)
## [1] 1171
(SSG <- MSG * df_group)
## [1] 2006.16
(SST <- SSG + SSE)
## [1] 269388.2
(MSE <- SSE/df_R)
## [1] 229.1191
(F <- MSG / MSE)
## [1] 2.188992
data.frame(X=c("degree","Residuals","Total"),
DF = c(df_group, df_R,df_total),
"Sum Sq" =c(SSG,267382,SST),
"Mean SQ" = c(501.54,MSE," "),"F value" = c(F,NA,NA),"Pr(>F) "= c(0.0682,NA,NA))
## X DF Sum.Sq Mean.SQ F.value Pr..F..
## 1 degree 4 2006.16 501.54 2.188992 0.0682
## 2 Residuals 1167 267382.00 229.11910882605 NA NA
## 3 Total 1171 269388.16 NA NA
Answer: Since the P value 0.0682 > 0.05 at 5% level of significance we conclude that there is no significance difference among the groups for average weekly physical exercise.