Fall 2023 Quiz 3

← return to practice.dsc10.com


This quiz was administered in-person. It was closed-book and closed-note; students were not allowed to use the DSC 10 Reference Sheet. Students had 20 minutes to work on the quiz.

This quiz covered Lectures 14-17 of the Fall 2023 offering of DSC 10.

⚠️ PDF version available here .


That's the end of the quiz.

Ciro is an avid fan of Costco, a members-only warehouse store. On his recent trip to the Morena Boulevard location near campus, he was surprised by how full shoppers’ carts were and was inspired to investigate how much people typically spend at Costco.


Problem 1

Lecture 17

Among all Costco members in San Diego, the average monthly spending in October 2023 was $350 with a standard deviation of $40.


Problem 1.1

The amount Ciro spent at Costco in October 2023 was -1.5 in standard units. What is this amount in dollars? Give your answer as an integer.

Answer: 290

The formula for converting a value x_i to standard units is

x_{i \text{ (su)}} = \frac{x_i - \text{mean of } x}{\text{SD of } x}.

We’re given that Ciro’s amount is -1.5 in standard units, and that the mean is $350 and the SD is $40. Plugging these in and solving for x_i:

-1.5 = \frac{x_i - 350}{40}

-1.5 \cdot 40 = x_i - 350

x_i = 350 - 60 = 290.


Difficulty: ⭐️

The average score on this problem was 93%.


Problem 1.2

What is the minimum possible percentage of San Diego members that spent between $250 and $450 in October 2023?

Answer: 84%

We don’t know the shape of the distribution, so we use Chebyshev’s inequality: at least 1 - \frac{1}{z^2} of the data lies within z standard deviations of the mean.

$250 to $450 is $100 on either side of the mean of $350. Since one SD is $40, that is \frac{100}{40} = 2.5 SDs. Then

1 - \frac{1}{2.5^2} = 1 - \frac{1}{6.25} = 1 - 0.16 = 0.84.

So at least 84% of members spent between $250 and $450.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 61%.


Problem 1.3

Now, suppose we’re given that the distribution of monthly spending in October 2023 for all San Diego members is roughly normal. Given this fact, fill in the blanks:

"In October 2023, 95% of San Diego members spent between __(m)__ dollars and __(n)__ dollars."


What are m and n? Give your answers as integers rounded to the nearest multiple of 10.

Answer: m: 270, n: 430

For a (roughly) normal distribution, about 95% of values lie within 2 standard deviations of the mean. So

350 \pm 2(40) = 350 \pm 80,

which gives m = 270 and n = 430.


Difficulty: ⭐️⭐️

The average score on this problem was 81%.



Problem 2

Lecture 15

Suppose we have access to a simple random sample of all US Costco members of size 145. Our sample is stored in a DataFrame named us_sample, in which the "Spend" column contains the October 2023 spending of each sampled member in dollars.


Problem 2.1

Fill in the blanks:

"The average of the "Spend" column in us_sample is a ____, while the average October 2023 spending of all US members is a ____."


Answer: sample statistic; population parameter

A number computed from a sample (the average of the "Spend" column in us_sample) is a statistic. A number that describes the entire population (the average spending of all US members) is a parameter.


Difficulty: ⭐️

The average score on this problem was 94%.


Problem 2.2

Fill in the blanks below so that us_left and us_right are the left and right endpoints of a 46% confidence interval for the average October 2023 spending of all US members.

costco_means = np.array([])
for i in np.arange(5000):
    resampled_spends = __(x)__
    costco_means = np.append(costco_means, resampled_spends.mean())
left = np.percentile(costco_means, __(y)__)
right = np.percentile(costco_means, __(z)__)

Which of the following could go in blank (x)? Select all that apply.

What goes in blanks (y) and (z)? Give your answers as integers.

Answer:

  • x:
    • us_sample.sample(145, replace=True).get("Spend")
    • np.random.choice(us_sample.get("Spend"), 145)
    • np.random.choice(us_sample.get("Spend"), 145, replace=True)
  • y: 27
  • z: 73

To bootstrap, we resample from our original sample, with replacement, using the same size as the original sample (145).

  • us_sample.sample(145, replace=True).get("Spend") is correct.
  • us_sample.sample(145, replace=False).get("Spend") is incorrect. Sampling 145 rows without replacement from 145 rows just reshuffles the sample, so every resample has the same mean.
  • np.random.choice(us_sample.get("Spend"), 145) is correct, since np.random.choice samples with replacement by default.
  • np.random.choice(us_sample.get("Spend"), 145, replace=True) is correct.
  • np.random.choice(us_sample.get("Spend"), 145, replace=False) is incorrect, for the same reason as the second option.

For a 46% confidence interval, we want the middle 46% of the bootstrapped means. That leaves 100\% - 46\% = 54\% in the tails, or 27% in each tail. So the left endpoint is the 27th percentile and the right endpoint is the 100 - 27 = 73rd percentile.


Difficulty: ⭐️⭐️

The average score on this problem was 79%.


Problem 2.3

True or False: 46% of all US members in us_sample spent between left and right in October 2023.

Answer: False

The interval is a confidence interval for the population mean (the average spending of all US members). It says nothing about what fraction of individual members’ spending falls between left and right.


Difficulty: ⭐️⭐️

The average score on this problem was 85%.


Problem 2.4

True or False: If we repeat the code from part (b) 200 times, each time bootstrapping from a new random sample of 145 members drawn from all US members, then about 92 of the intervals we create will contain the average October 2023 spending of all US members.

Answer: True

This is the correct interpretation of a confidence interval. If we repeatedly draw a new random sample from the population, bootstrap from it, and build an interval, about 46% of those intervals will contain the population mean. Since 0.46 \times 200 = 92, about 92 of the 200 intervals will contain the average spending of all US members.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 51%.


Problem 2.5

True or False: If we repeat the code from part (b) 200 times, each time bootstrapping from us_sample, then about 92 of the intervals we create will contain the average October 2023 spending of all US members.

Answer: False

The difference from the previous part is that here we bootstrap from the same us_sample every time. Each interval is built from the same sample, so all 200 intervals will be nearly identical (centered around the same sample mean). Either almost all of them will contain the population mean or almost none will, depending on whether this one sample happened to be representative. The “about 46%” interpretation only works when each interval comes from a new random sample from the population.


Difficulty: ⭐️⭐️⭐️⭐️

The average score on this problem was 30%.



👋 Feedback: Find an error? Still confused? Have a suggestion? Let us know here.