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 is (x2+x1) / 2 where the confidence interval is (x1, x2)
n <- 25
x1 <- 65
x2 <- 77
SM <- (x2 + x1) / 2
cat("The Sample Mean is", SM)
## The Sample Mean is 71
Margin of error is (x2−x1) / 2 where the confidence interval is (x1, x2)
n <- 25
x1 <- 65
x2 <- 77
ME <- (x2 - x1) / 2
cat("The Margin of error is", ME)
## The Margin of error is 6
sample standard devation using ME = t(.05)*s/sqrt(n). Using the qt function and df = 25-1
df <- 25-1
tval <- qt(.95, df)
sd <- (ME/tval)*5
sd
## [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.
25 = z ∗ 250 / √n
or n=(10∗z)2
# estimate z score of 90% confidence interval is 1.645
z <- 1.645
margin <- 25
stand_dev <- 250
z90Raina <- round(((stand_dev/margin) * z)^2, 0)
z90Raina
## [1] 271
## Luke’s sample should be larger because it requires a higher z number multiplied by the standard deviation and then squared.
# estimate z score of 99% confidence interval is 2.576
z <- 2.576
margin <- 25
stand_dev <- 250
z99Luke <- round(((stand_dev/margin) * z)^2, 0)
z99Luke
## [1] 664