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.
n = 25 ci = (65, 77) The sample mean is the midpoint of the confidence interval:
x1 <- 65
x2 <- 77
sample_mean <- (x1+x2)/2
sample_mean## [1] 71
The margin of error is:
ME <- (x2-x1)/2
ME## [1] 6
The sample standard deviation is calculated from ci = ¯x +_ tdf*SE:
SE = (ME/t∗24)√n
n <- 25
df <- n-1
c <- .9
ci <- c +(1-c)/2
ci## [1] 0.95
t24 <- qt(ci, df)
t24## [1] 1.710882
s <- (ME*sqrt(25))/(t24)
s## [1] 17.53481
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.
ME <- 25
SD <- 250
T = qnorm(0.95)
X = ((SD * T) / ME)^2
X## [1] 270.5543
The smallest sample Raina should collect is 271.
Luke’s sample size would need to be larger than Raina’s because making the confidence interval more narrow would require a larger data set.
ME <- 25
SD <- 250
T = qnorm(0.995)
X = ((SD * T) / ME)^2
X## [1] 663.4897
Luke’s sample size would need to be at least 664.
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.
Yes there is a noticeable difference in the means of the reading and writing scores but it is not a large difference. The histogram does seem to be centered close to 0 which suggests it is a very small difference.
The reading and writing scores are paired as they both relate to one student.
H0: µ(reading) = µ(writing) There is no difference in the student’s average scores on the reading and writing exam. H1: µ(reading) < or > µ(writing) There is a difference in the student’s average scores on the reading and writing exam.
The conditions required to use the t distribution are indepedence and nearly normal.
Independence is met as we have a simple, random sample of less than 10% of the population. The nearly normal requirement is met also as the sample is greater than 30 which helps correct any skewing.
We can see from the boxplot that the difference in the means is negative as writing is subtracted from reading.
xRW <- -0.545
SDRW <- 8.887
n <- 200
df <- n - 1
SE <- SDRW / sqrt(n)
Tdf <- (xRW - 0)/(SE)
p <- pt(Tdf, df) * 2
p## [1] 0.3868365
The p-value is 0.387 which is greater than 0.05. We cannot reject the null hypothesis that there is no difference.
A Type II error which is failing to reject a false null hypothesis also known as a “false negative” finding.
Yes, a confidence interval which includes zero would support our result of not rejecting the null hypothesis. If there is no difference in a student’s average scores on the reading and writing exams then µ(reading) = µ(writing) or µ(reading) - µ(writing) = 0.
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 difference 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 satisfied.
City MPG Automatic Manual Mean 16.12 19.85 SD 3.58 4.51 n 26 26
mu_auto <- 16.12
mu_man <- 19.85
SD_auto <- 3.58
SD_man <- 4.51
n <- 26
df <- n - 1
diff_mu <- mu_auto - mu_man
SE = sqrt((SD_auto^2/n) + (SD_man^2/n))
t = (diff_mu)/(SE)
p = pt(t,df) * 2
p## [1] 0.002883615
The p-value is 0.00288 and would suggest that there is a difference between the average fuel eciency of cars with manual and automatic transmissions in terms of their average city mileage.
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.
Educational attainment Less than HS HS Jr Coll Bachelor’s Graduate Total Mean 38.67 39.6 41.39 42.55 40.85 40.45 SD 15.81 14.97 18.1 13.62 15.51 15.17 n 121 546 97 253 155 1,172
H0: µ(hours_LessthanHS) = µ(HS) µ(JrColl) = µ(Bachelors) = µ(Grad) The average hours across all educated groups are equal. H1: µ(hours_LessthanHS) - µ(HS) - µ(JrColl) - µ(Bachelors) - µ(Grad) not = 0 The average hours across all educated groups are not equal.
These conditions are all satisfied: Independence - 1,172 is less than 10% of population and the population is randomly sampled. Approximately Normal - sample size is greater than 30 and/or not highly skewed. Constant Variance - the variance across groups is approximately equal as the means and standard deviations are all close to each other.
MSG = SSG / df_G SSG = MSG * df_G SSE = SST - SSG MSE = SSE / df_E F = MSG / MSE
n <- 1172
k <- 5
MSG <- 501.54
SSE <- 267382
#df_groups
df_G <- k-1
df_G## [1] 4
#df_res
df_E <- n-k
df_E## [1] 1167
#dfTotal
df_Total <- df_G + df_E
df_Total## [1] 1171
#SumSq_groups
SSG <- df_G * MSG
SSG## [1] 2006.16
#SumSq_res
SSE## [1] 267382
#Mean_res
MSE <- SSE / df_E
MSE## [1] 229.1191
#Fvalue
F <- MSG / MSE
F## [1] 2.188992
Our p-value is 0.0682 which is larger than 0.05, so we fail to reject H0.