For this assignment, use the normal approximation discussed in class. The critical values \(C=1\), \(C=2\), and \(C=3\) correspond to approximately 68%, 95%, and 99.7% confidence, respectively. You do not need any additional distributions or inference functions.
Suppose a population of Gentoo penguins has mean bill length \(\mu=47.5\) millimeters and standard deviation \(\sigma=3\) millimeters. Assume observations are independent and that the sampling distributions of the means below are approximately normal. Two researchers independently collect random samples from this population:
| Researcher | Sample size | Observed sample mean |
|---|---|---|
| Vixie | 25 | 48.7 mm |
| Tayo | 100 | 48.4 mm |
Part A Identify the population parameter the researchers want to estimate and each researcher’s observed statistic. If Vixie repeated the sampling procedure, which quantities would remain fixed and which would change: \(n\), \(\mu\), \(\sigma\), and \(\overline{x}\)?
Part B Find the standard error of each researcher’s sample mean. Explain what Vixie’s standard error describes in this context. Why do the two researchers have different standard errors even though they sampled the same population?
Part C Standardize each observed sample mean using \[z=\frac{\overline{x}-\mu}{\sigma/\sqrt{n}}.\] Which mean is farther above the population mean in millimeters? Which is farther above it in standard errors? Explain how your two comparisons can differ. (The original version of this had Tayo mean of 48.7, which resulted in identical z-scores. This has been corrected, but either version of your submission is fine)
Part D Use the empirical rule to give a range containing approximately the middle 95% of sample means for each sample size. Use two standard errors for this part. Would these ranges also contain approximately 95% of individual penguins’ bill lengths? Explain.
Part E Vixie says, “If I increase my sample size from 25 to 50, my standard error will be cut in half.” Is that correct? Calculate the standard error at \(n=50\), and determine the sample size needed to halve Vixie’s original standard error.
Part F A friend says, “Once you standardize any variable, its distribution is normal.” Explain the mistake. In this problem, what justifies using a normal distribution for the standardized sample means?
We will use the tips dataset and the variable
total_bill, measured in dollars. For Problems 2–4, treat
the recorded bills as our population: each draw
independently selects one recorded bill, with every row equally likely.
This lets us know the population mean and check what happens over
repeated samples.
The code chunk below does three things: (1) load in the
tips data, (2) finds the population parameters
mu and sigma, and (3) creates a data.frame
called sampling, where each row represents the sample mean
from a sample of size either \(n = 25\)
or \(n = 50\).
## Read in dataset
tips <- read.csv("https://collinn.github.io/data/tips.csv")
## Parameters of our population
mu <- mean(tips$total_bill)
sigma <- sqrt(mean((tips$total_bill - mu)^2))
## Create two sampling distributions
set.seed(123)
B <- 1000
means_25 <- replicate(B, {
mean(sample(tips$total_bill, size = 25, replace = TRUE))
})
means_100 <- replicate(B, {
mean(sample(tips$total_bill, size = 100, replace = TRUE))
})
sampling <- data.frame(
xbar = c(means_25, means_100),
sample_size = rep(c(25, 100), each = B)
)
Part A Report mu and
sigma, and create a histogram of the population bills.
Describe its shape. What does one observation in this histogram
represent?
Part B Create histograms of the two sets of
sample means using facet_wrap(). What does one observation
in either of these histograms represent? Explain why the histogram for
\(n=25\) contains 1,000 means rather
than 25 means.
Part C Make a summary table giving the mean and
SD (sd()) of the simulated sample means for each sample
size. Also calculate the theoretical standard errors, \(\sigma/\sqrt{25}\) and \(\sigma/\sqrt{100}\). Compare the simulated
centers with mu and the simulated SDs with the theoretical
standard errors. Should they match exactly? Explain.
Part D Compare the population histogram with the histograms of sample means. Does collecting larger samples make the distribution of individual bills more normal? Explain what the Central Limit Theorem says becomes approximately normal and what becomes less variable as \(n\) increases.
Part E Suppose we keep the sample size at 25 but
increase B from 1,000 to 10,000. Would the theoretical
standard error change? What would improve about our simulation?
Distinguish the roles of the number of observations per sample and the
number of repeated samples.
Part F Use the code below to standardize the
means from samples of 100 bills. Report the mean and SD of
z100, and the proportion of its values between \(-2\) and \(2\) (an example of how to do this are
included in the slides from 10/7). Compare your results with what you
would expect from a standard normal distribution. Does a standardized
value outside this range necessarily indicate a mistake in the
sample?
z100 <- (means_100 - mu) / (sigma / sqrt(100))
# A logical comparison is TRUE (1) or FALSE (0), so its mean is a proportion.
# For example, mean(z100 > 0) is the proportion of standardized means above 0.
In practice, we generally observe one sample and do not know \(\mu\) or \(\sigma\). For this problem, imagine that the following 100 bills are the only observations available to you. Use this sample, rather than the known population parameters, to construct your interval. Assume the independent sampling model from Problem 2 and that a normal approximation is reasonable at this sample size.
set.seed(123)
one_sample <- data.frame(
total_bill = sample(tips$total_bill, size = 100, replace = TRUE)
)
Part A Calculate the sample size \(n\), sample mean \(\overline{x}\), and sample standard deviation \(s\). Use \(s/\sqrt{n}\) to estimate the standard error. Explain the difference between what \(s\) describes and what \(s/\sqrt{n}\) describes.
Part B Following the large-sample approximation used in class, construct an approximate 95% confidence interval using \[\overline{x}\pm 2\times\frac{s}{\sqrt{n}}.\] Report the point estimate, margin of error, lower endpoint, and upper endpoint. Explain which population quantity the interval is intended to estimate.
Part C A classmate sees this interval and states, “Because this is a 95% confidence interval, 95% of individual restaurant bills will fall between these endpoints.” Why is this statement incorrect? How would you change it so that it is correct?
Part D Construct approximate 68% and 99.7% confidence intervals from the same sample, using \(C=1\) and \(C=3\). Compare their widths with the interval in Part B. Explain the trade-off between confidence and precision. Specifically, comment on the change in interval size going from 68% to 95% confidence and going from 95% to 99% confidence. Why might somebody choose 95% over 99%?
Part E Suppose you could collect 400 observations instead of 100. If the sample SD stayed the same, how would the margin of error and total width of a 95% interval change? Would its confidence level change?