Spring 2024 Quiz 4

Appearance

← 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 17-19 of the Spring 2024 offering of DSC 10.

⚠️ PDF version available here .


That's the end of the quiz.

Problem 1

Lecture 16


Problem 1.1

Suppose that the trees on UCSD’s campus have a mean height of 100 feet and a variance of 36 feet. If the height of a specific tree is 124 feet, what would its height be in standard units for this distribution? Simplify your answer.

Answer: 4

To convert to standard units, we subtract the mean and divide by the standard deviation. We’re given the variance, so we first take its square root:

\text{SD} = \sqrt{36} = 6

\frac{124 - 100}{6} = \frac{24}{6} = 4

A common mistake is to divide by the variance instead, which gives \frac{24}{36} \approx 0.67.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 73%.



Problem 1.2

Let A be the answer to the previous question. Choose the best interpretation of A.

Answer: A 124 foot tree is A standard deviations taller than the average tree on UCSD’s campus.

A value in standard units tells us how many standard deviations above or below the mean it is. A value of 4 means the tree is 4 standard deviations above the mean height.

  • Option 1: Standard units are not probabilities or percentages.
  • Option 2: A 124 foot tree is \frac{124}{100} = 1.24 times as tall as the average tree, not 4 times. Standard units measure distance from the mean in units of SD, not a ratio to the mean.
  • Option 4: Chebyshev’s inequality only guarantees that at least 1 - \frac{1}{4^2} = 93.75\% of the data falls within 4 SDs of the mean, not 95%. It also describes the whole distribution, not what this one tree’s standard units mean.

Difficulty: ⭐️⭐️

The average score on this problem was 84%.



Problem 2

Lecture 16

You are told that scipy.stats.norm.cdf(-1.4) evaluates to 0.08075665923377107. Suppose you have a standard normal curve with mean at x=0 and standard deviation 1. What is the area under the curve from x=0 to x=1.4? Give your answer as a number rounded to 2 decimal places.

Answer: 0.42

scipy.stats.norm.cdf(-1.4) is the area under the standard normal curve to the left of -1.4, which is about 0.08.

The standard normal curve is symmetric around 0, and the area on each side of 0 is 0.5. The area from -1.4 to 0 is the left half minus the left tail:

0.5 - 0.0808 = 0.4192

By symmetry, the area from 0 to 1.4 is the same as the area from -1.4 to 0, so the answer is about 0.42.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 57%.


Problem 3

Lecture 18

Suppose we measure the height in feet of a sample of trees on UCSD’s campus and use this sample to generate a 95% CLT-based confidence interval for the mean height of trees on campus. Let W be the width of this confidence interval.

If we instead were to measure the height of the same sample in inches, and again generate a 95% CLT-based confidence interval for the mean, what would be the width of this confidence interval in terms of W? There are 12 inches in 1 foot.

Answer: 12W

The width of a 95% CLT-based confidence interval for the mean is

4 \cdot \frac{\text{sample SD}}{\sqrt{n}}

Converting from feet to inches multiplies every height by 12. That multiplies the sample SD by 12 too, because every distance from the mean is 12 times bigger. The sample size n is the same, since it’s the same trees. So the new width is

4 \cdot \frac{12 \cdot \text{sample SD}}{\sqrt{n}} = 12W

It makes sense that the width scales by 12, because we’re describing the same interval in a different unit. 144W would be the answer if we scaled by the change in variance (12^2), but the width depends on the SD.


Difficulty: ⭐️⭐️⭐️

The average score on this problem was 63%.


Problem 4

Lecture 17

Which of the following quantities must be known in order to construct a CLT-based confidence interval for the population mean? Select all that apply.

Answer: Mean of the sample, Standard deviation of the sample, Size of the sample

A 95% CLT-based confidence interval for the population mean is

\left[\text{sample mean} - 2 \cdot \frac{\text{sample SD}}{\sqrt{\text{sample size}}}, \ \text{sample mean} + 2 \cdot \frac{\text{sample SD}}{\sqrt{\text{sample size}}}\right]

So the only things we need are the sample mean, the sample SD, and the sample size.

  • Shape of the population or sample: The CLT says the distribution of the sample mean is roughly normal for large samples, no matter what the population looks like. We don’t need either one to be normal.
  • Mean of the population: This is the parameter we’re trying to estimate. If we knew it, we wouldn’t need a confidence interval.
  • SD of the population: We usually don’t know it, so we use the sample SD as an estimate.
  • Size of the population: This doesn’t appear in the formula.

Difficulty: ⭐️⭐️⭐️

The average score on this problem was 73%.


Problem 5

Lecture 18

We want to collect a sample of trees and use this sample to determine the proportion of all trees that are oak trees (a population parameter). We want to create a 95% confidence interval that is at most 0.04 wide. Which of the following inequalities should we use to find the smallest viable sample size we could collect?

Answer: \text{sample size} \geq (4 * \frac{0.5}{0.04})^2

The width of a 95% confidence interval for the population mean is about

4 \cdot \frac{\text{sample SD}}{\sqrt{n}}

A proportion is the mean of a collection of 0s and 1s, so the same formula works. We don’t know the sample SD before collecting the sample. But for a collection of 0s and 1s, the SD is \sqrt{p(1-p)}, which is never more than 0.5. Using 0.5 gives the widest possible interval:

4 \cdot \frac{0.5}{\sqrt{n}} \leq 0.04 \implies \sqrt{n} \geq 4 \cdot \frac{0.5}{0.04} \implies n \geq \left(4 \cdot \frac{0.5}{0.04}\right)^2 = 2500

  • Option 2 uses 2 instead of 4. The 2 is how far each endpoint is from the sample mean, but the full width of the interval is twice that.
  • Option 3 uses 1 for the SD, but the largest possible SD of 0s and 1s is 0.5.
  • Option 4 forgets to square, so it bounds \sqrt{n} instead of n.

Difficulty: ⭐️⭐️⭐️

The average score on this problem was 52%.


Problem 6

Lecture 18

Suppose that the trees on UCSD’s campus are 35% eucalyptus, 25% pine, and the remaining 40% some other variety. Write one line of code to simulate the act of randomly sampling 40 trees from this distribution, with replacement. Your code should output an array of length 3 where the elements represent the number of eucalyptus, pine, and other trees, respectively.

Answer: np.random.multinomial(40, [0.35, 0.25, 0.40])

np.random.multinomial(n, pvals) simulates drawing n items at random, with replacement, from a categorical distribution with probabilities pvals. It returns an array of counts, one for each category, in the same order as pvals. Here we draw 40 trees, and the probabilities are listed in the order eucalyptus, pine, other. The counts in the result always add up to 40.

np.random.choice(["eucalyptus", "pine", "other"], 40, p=[0.35, 0.25, 0.40]) would simulate the same sampling, but it returns 40 individual labels instead of 3 counts. Getting counts from it would take more than one line.


Difficulty: ⭐️⭐️

The average score on this problem was 85%.


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