Chapter 5 - Inference for Numerical Data Practice: 5.5, 5.13, 5.19, 5.31, 5.45 Graded: 5.6, 5.14, 5.20, 5.32, 5.48

Practice: 5.5 Working backwards, Part I. A 95% confidence interval for a population mean, μ, is given as (18.985, 21.015). This confidence interval is based on a simple random sample of 36 observations. Calculate the sample mean and standard deviation. Assume that all conditions necessary for inference are satisfied. Use the t-distribution in any calculations.

Graded: 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.

The mean is the midpoint: xbar =

x   <- (65 + 77) / 2
ME  <- (77-65)/2
t25 <- qt(.95, 25-1)
sd  <- (ME/t25)

cat("the mean is the midpoin; xbar = ", x, "the margin of error: ME =", ME, "the SD is:", sd)
## the mean is the midpoin; xbar =  71 the margin of error: ME = 6 the SD is: 3.506963

Practice: 5.13 Car insurance savings. A market researcher wants to evaluate car insurance savings at a competing company. Based on past studies he is assuming that the standard deviation of savings is $100. He wants to collect data such that he can get a margin of error of no more than $10 at a 95% confidence level. How large of a sample should he collect?

Graded: 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. (a) Raina wants to use a 90% confidence interval. How large a sample should she collect?

#s <- (1.96 * 100)/sqrt(n)

#25 <= (1.65 * 250)/sqrt(n)
#move around the equation
sampSize <- ((1.65*250)/25)^2
cat (ceiling(sampSize))
## 273
  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.
sampSize <- ((2.575*250)/25)^2
cat("Luke's sample size is: ", (ceiling(sampSize)), "which is bigger than Rainas because the size of z increases exponentially as z approaches infinity when the sample size is larger than the number of points")
## Luke's sample size is:  664 which is bigger than Rainas because the size of z increases exponentially as z approaches infinity when the sample size is larger than the number of points
  1. Calculate the minimum required sample size for Luke. See answer to b above

Practice: 5.19 Global warming, Part I. Is there strong evidence of global warming? Let’s consider a small scale example, comparing how temperatures have changed in the US from 1968 to 2008. The daily high temperature reading on January 1 was collected in 1968 and 2008 for 51 randomly selected locations in the continental US. Then the di↵erence between the two readings (temperature in 2008 - temperature in 1968) was calculated for each of the 51 di↵erent locations. The average of these 51 values was 1.1 degrees with a standard deviation of 4.9 degrees. We are interested in determining whether these data provide strong evidence of temperature warming in the continental US. (a) Is there a relationship between the observations collected in 1968 and 2008? Or are the observations in the two groups independent? Explain. (b) Write hypotheses for this research in symbols and in words. (c) Check the conditions required to complete this test. (d) Calculate the test statistic and find the p-value. (e) What do you conclude? Interpret your conclusion in context. (f) What type of error might we have made? Explain in context what the error means. (g) Based on the results of this hypothesis test, would you expect a confidence interval for the average di↵erence between the temperature measurements from 1968 and 2008 to include 0? Explain your reasoning.

Graded: 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. (a) Is there a clear difference in the average reading and writing scores? No, read does have a slightly bigger range. (b) Are the reading and writing scores of each student independent of each other? no, each student has both a reading and writing score. One could categorize reading and writing as functions of Student (f(R) and f(W) respectively.) (c) 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? F(0): mean(reading = writing) F(A): mean(reading <> writing) (d) Check the conditions required to complete this test. Nearly normal distributions and independance of observations. (e) The average observed difference in scores is xread -xwrite = -

SE <- 8.887/sqrt(200)
t  <- (-.0545)/SE 
p  <- pt(t, 200-1)
p
## [1] 0.4654877
cat("The p value is greater than .05 at p =", p, "So we accept our null hypothesis" )
## The p value is greater than .05 at p = 0.4654877 So we accept our null hypothesis
  1. What type of error might we have made? Explain what the error means in the context of the application. **https://en.wikipedia.org/wiki/Type_I_and_type_II_errors type I error is the rejection of a true null hypothesis (also known as a "false positive" finding), i.e. we reject H(0), but it is infact correct. a type II error is failing to reject a false null hypothesis (also known as a "false negative" finding) i.e. we accept H(0), bt it is infact incorrect.
  2. 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. Since it is not a one sided test, 0 should be included.

Graded: 5.32 Fuel efficiency of manual and automatic cars, Part I. Each year the US Environ- 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. Does this data provide strong evidence of a difference between the average fuel efficiency of cars with manual and automatic transmissions in terms of its average city mileage? Assume that conditions for inference are satisfied.

If the conditions for inference are satisfied, then the number of samples are enough to give strong evidence between MPG for manual vs automatic transmissions.

Graded: 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.

H(0): mean(LH = HS = JRCol = Bach = Grad) H(A): mean(LH <> HS <> JRCol <> Bach <> Grad) (b) Check conditions and describe any assumptions you must make to proceed with the test. None of the sets are categorical, so they all represent different data points. (c) 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 | Sum Sq | 501.54 | 2.18 | .0682 Residuals | 1167 | 267,382 | 229.12 | | _____________________________________________________ Total | 1171 | 269,388 | (d) What is the conclusion of the test? Pr(>F) is .0682 which is > .05, so we accept H(0)