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.

Problem 1

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

Problem 2

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)
)
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.

Problem 3

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)
)