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.

smean= (77+65)/2
smean
## [1] 71
#since sample is 25, df = 25-1 = 24
tdf=round(qt(c(.05, .95), df=24)[2],3)
#using upper limit 77
serror = (77-smean)/tdf
serror
## [1] 3.506721
sd=serror*sqrt(25)
sd
## [1] 17.53361

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.

25 = \(z * \frac{250}{\sqrt{n}}\)

or

\(n = (10 * z)^2\)

  1. Raina wants to use a 90% confidence interval. How large a sample should she collect?
# Calculating using Z

z90=1.65
samplesize=round((10*z90)^2,0)
samplesize
## [1] 272
  1. Luke wants to use a 99% confidence interval. Without calculating the actual sample size, determine whether his sample should be larger or smaller than Raina’s, and explain your reasoning.

We require large sample size compared to Raina, since confidence is more.

  1. Calculate the minimum required sample size for Luke.
# Calculating using Z

z99=2.58
samplesize=round((10*z99)^2,0)
samplesize
## [1] 666

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.

  1. Is there a clear difference in the average reading and writing scores?

Ans : The means seem slighly different, but the distribution of differences looks quite normal.

  1. Are the reading and writing scores of each student independent of each other?

Ans : No. The scores of either reading or writing are independant, but one student is likely to have scores for both sides in the sample. PAIRED DATA.

  1. Create hypotheses appropriate for the following research question: is there an evident difference in the average scores of students in the reading and writing exam?

\(H_O\): \(\mu_r - \mu_w = 0\), No difference between the average reading and writing scores.

\(H_A\): \(\mu_r - \mu_w \neq 0\), There is a difference.

  1. Check the conditions required to complete this test.

Ans : There are 200 students in the sample and were randomly collected. The box plots indicate a little enough skew that we can use the t distribution. Conditions are satisfied.

  1. The average observed difference in scores is \(\bar{x}_{read-write}\) = -0.545, and the standard deviation of the differences is 8.887 points. Do these data provide convincing evidence of a difference between the average scores on the two exams?
se <- round(8.887 / sqrt(200), 3)
se
## [1] 0.628
tdf <- round((-0.545-0)/se, 3)
tdf
## [1] -0.868
p <- round(2 * pt(tdf, 199), 3)
p
## [1] 0.386

\(H_A\) cane be rejected, because not convicing evidence of diff in avg means.

  1. What type of error might we have made? Explain what the error means in the context of the application.

Since we have rejected \(H_A\), if it were actually true, we would have made a type II error. If we took a larger sample, we would decrease our chances of making a type II error.

  1. 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.

We would expect confidence intervals to include 0, as it has been determined that there is no convincing evidence of a difference in average means.

5.32 Fuel efficiency 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 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.

\(H_O\): \(\mu_a - \mu_m = 0\), No difference between the average automatic and manual MPG.

\(H_A\): \(\mu_a - \mu_m \neq 0\), There is a difference.

\(\sigma = .05\)

n = 26
mdiff = 16.12 - 19.85
sddiff = 3.58 - 4.51
SEdiff = sqrt((3.58^2)/n + (4.51^2)/n)
t = (mdiff-0)/SEdiff
p = round(2 * pt(t, n-1), 3)
p
## [1] 0.003

With \(\sigma = .05\) and p = 0.003, we reject \(H_0\). There is convincing evidence of a difference in the means of miles per gallon in manual and automatic transmissions.

5.48 Work hours and education

The General Social Survey collects data on demographics, education, and work, among many other characteristics of US residents. 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.

  1. Write hypotheses for evaluating whether the average number of hours worked varies across the five groups.

\(H_0: \mu{<HS} = \mu{HS} = \mu_{JR} = \mu_{B} = \mu_{G}\). The avg hours worked arcross all five groups does not vary.__

\(H_A:\) The avg hours across some or all groups does vary.

  1. Check conditions and describe any assumptions you must make to proceed with the test.

The data in each group appears relatively normal and the variability is similar across each group. Assumption for ANOVA, that obsrvtns are independent.

  1. Below is part of the output associated with this test. Fill in the empty cells.
k = 5
df_G = k-1
n = 1172
df_E = n - k
df_T = df_G + df_E

gmean = 40.45

SSE = round(sum((121-1)*15.81^2, (546-1)*14.97^2, (97-1)*18.1^2,
           (253-1)*13.62^2, (155-1)*15.51^2), 0)
SSG = round(sum(121*(38.67-gmean)^2, 546*(39.6-gmean)^2, 97*(41.39-gmean)^2, 
           253*(42.55-gmean)^2, 155*(40.85-gmean)^2), 0)
SST = round(SSE + SSG, 0)
MSG = round(SSG / (k-1), 2)
MSE = round(SSE / (n-k), 2)
f = round(MSG / MSE, 3)

df=data.frame(c("ANOVA","degree","Residuals","Total"))
df[2]=c("Df",df_G,df_E,df_T)
df[3]=c("Sum Sq",SSG,267382,269378)
df[4]=c("Mean Sq",501.54,MSE,NA)
df[5]=c("F Value",f,NA,NA)
df[6]=c("Pr(>F)",0.0682,NA,NA)
knitr::kable(df)
c..ANOVA….degree….Residuals….Total.. V2 V3 V4 V5 V6
ANOVA Df Sum Sq Mean Sq F Value Pr(>F)
degree 4 2004 501.54 2.187 0.0682
Residuals 1167 267382 229.11 NA NA
Total 1171 269378 NA NA NA
  1. What is the conclusion of the test?

There is not enough evidence for us to reject \(H_0\), thus we accept and conclude there is no difference in avg work hours per week among diff groups.