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.
- sample mean: 71
- margin of error (SEx1.71): 6
- sample sd: 17.54
The population is approximately normal. The sample is below 30. I am going to use the t distribution with df = 24.
Critical value of t-distribution df=24 two-tail for 90%: 1.71
sample_mean + SE1.71 = 77 sample_mean - SE1.71 = 65 2*sample_mean = 77 + 65
sample_mean = 71
71 + SE*1.71 = 77 SE = 3.51
margin_of_error = SE * 1.71 margin_of_error = 3.51 * 1.71 = 6.00
SE = sample_sd/sqrt(n) 3.51 = sample_sd/sqrt(25) sample_sd = 17.54
sample_mean <- (77 + 65)/2
sample_mean
## [1] 71
SE <- (77 - 71)/1.71
margin_of_error <- SE * 1.71
margin_of_error
## [1] 6
sample_sd = SE * sqrt(25)
sample_sd
## [1] 17.54386
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.
SAT scores
CI: 90%
Assume that the distribution of SAT score is approximately normal. I’m going to use the normal distribution table to determine the critical value at 90% confidence interval.
Z_.90 of normal distribution 2-tail: 1.64
SE*Z_.90 <= 25 points
(sd/sqrt(n))*z_.90 <= 25
(250/sqrt(n))*1.64 <= 25
((250*1.64)/25)^2 <= n
268.96 <= n
ANSWER: The sample size needs to be at least 269 to create a 90% CI of the average SAT score.
z_score <- qnorm(.05)
z_score
## [1] -1.644854
((250*1.64)/25)^2
## [1] 268.96
determine whether his sample should be larger or smaller than Raina’s, and explain your reasoning.
A 99% confidence interval has a z-score that is larger than 90% because it covers more in the distribution. Assuming that Luke’s margin of error is 25 points or less (same as Raina), then a larger z-score would mean a bigger sample size.
z_.99 = 2.58 z_.90 = 1.64
SEZ_.90 <= 25 points SEZ_.99 <= 25 points
((250/25)1.64)^2 —> floor for Raina’s sample size (250/25)^2 1.64^2
((250/25)2.58)^2 —> floor for Luke’s sample size (250/25)^2 2.58^2
(2.582)/(1.642) = 2.474866 ~ 2.5
Luke’s sample size is approximately going to be at least 2.47 times larger than Raina’s sample size to create a 99% confidence interval of the average SAT score.
qnorm(.01/2)
## [1] -2.575829
(2.58^2)/(1.64^2) #2.474866
## [1] 2.474866
z_.99 = 2.58
SE*Z_.99 <= 25 points
(sd/sqrt(n))*z_.90 <= 25
(250/sqrt(n))*2.58 <= 25
((250*2.58)/25)^2 <= n
665.64 <= n
ANSWER: Luke’s sample size should be at least 666.
((250*2.58)/25)^2 #665.64
## [1] 665.64
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.
My interpretation is that a simple random sample of 200 students was taken. The reading and writing score of each student is a paired data so that each (reading, writing) pair refers to a single student only. So there are 200 (reading,writing) data pairs in the data set.
The boxplots shows that there is some difference in reading and writing scores. The median for the writing appears to be higher. The 75th and 25th percentile line are somewhat close. The maximum for reading appears to be much higher than maximum score for writing.
The reading - writing
histogram show a spread from around -20 to 20. So there is a difference, but we can’t tell if this difference is significant.
The same is random, and the size of 200 would be less than 10% of the population. So it sounds reasonable to assume independence in this case.
in the average scores of students in the reading and writing exam?
H_0: There is no difference in the reading and writing scores –> reading - writing
= 0. H_A: There is a difference in the reading and writing scores –> reading - writing
!= 0.
reading - writing
looks approximately normal. I don’t see any strong skew.Do these data provide convincing evidence of a difference between the average scores on the two exams?
n: 200 avg_read-write: -0.545 sd_read-write: 8.887 SE: 8.887/sqrt(200) = 0.6284058
H_0: There is no difference in the reading and writing scores –> reading - writing
= 0. H_A: There is a difference in the reading and writing scores –> reading - writing
!= 0.
The t distribution is used in this example.
T_score = (avg_read-write - null)/ SE T_score = (-0.545 - 0)/ 0.6284058 T_score = -0.867274 P_value = 0.1934182
The p-value is about 0.20 or about 20% likelihood of seeing an average difference of -0.545 if the the null hypothesis is true that there is no difference. This is strong evidence to fail to reject the null hypothesis.
No, the data does not provide convincing evidence that there is a difference between the average scores on the reading and writing exams.
SE <- 8.887/sqrt(200)
SE
## [1] 0.6284058
T <- (-0.545 - 0)/SE
T
## [1] -0.867274
pt(q=-0.867274, df=199, lower.tail = TRUE)
## [1] 0.1934182
application.
If there is a difference, then we would have made a type II error since we failed to reject the null hypothesis.
It means that there is really a difference in the average scores between reading and writing and we failed to detect it.
average difference between the reading and writing scores to include 0? Explain your reasoning.
Based on the findings above, I would expect the confidence interval to include 0.
Critical value at 95% CI: 1.971957 CI: avg_read-write +- SE*
95% confidence interval includes zero: (-1.7841889 0.6941889)
SE <- 8.887/sqrt(200)
critical_value <- qt(p=(.05/2), df=199, lower.tail=FALSE)
critical_value
## [1] 1.971957
avg_read_minus_write <- -0.545
c(avg_read_minus_write - SE * critical_value, avg_read_minus_write + SE * critical_value)
## [1] -1.7841889 0.6941889
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_0: There is no difference –> diff_auto_manual = 0. H_A: There is a difference –> diff_auto_manual != 0.
Based on the calculations below, the p-value is 0.002883615.
Using a significance level of .05, we would need to reject the null hypothesis.
Assuming that there is no difference in average fuel efficiency between automatic and manual cars, the chances of seeing difference of 3.73 miles/gallon would only be around 0.002883615 or less than 1%.
Yes, the data provide strong evidence of a difference between the average fuel efficiency of cars with manual and automatic transmissions at p-value of 0.002883615.
n <- 26 #both groups
mean_a <- 16.12
sd_a <- 3.58
var_a <- sd_a^2
mean_m <- 19.85
sd_m <- 4.51
var_m <- sd_m^2
diff_auto_manual <- mean_a - mean_m
diff_auto_manual
## [1] -3.73
SE <- sqrt((var_a/n) + (var_m/n))
SE
## [1] 1.12927
t_score <- (diff_auto_manual - 0)/SE
t_score
## [1] -3.30302
p_value <-
pt(q=t_score, df=n-1, lower.tail = TRUE) * 2
p_value
## [1] 0.002883615
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.
five groups.
H_0: The average number of hours worked on all 5 groups are the same. H_a: There is at least one group amount the 5 groups with a different average number of hours worked.
n = 1,172
The respondents is less than 10% of the population. I am going to assume that the sample was selected randomly from the survey database. So it is reasonable to say that the observations are independent within and across groups.
I am going to assume that data within each group is approximately normal. Number of hours worked should be roughly normal. Most people work the typical number of hours for week.
Looking at the side by side plots, the groups are somewhat the same in terms of the range of number of hours worked. The mean are roughly the same. So variability across groups is about the same.
Calculations:
http://statpages.info/anova1sm.html
https://screencast-o-matic.com/watch/cFeTYoDzO8
degree:
df=k-1: 4
sum sq: 2004.0793
F value: 2.1868
residuals:
df=n-k=1167
mean sq: 229.1120
P(>F): 0.0682
At significance level of 0.05, we fail to reject the null hypothesis that the means of the groups are different. There is about a 7% chance that this kind of variability is present when the means of the groups are the same.