From 490dc8f254b4bfe724367e45e20e28a55c327bad Mon Sep 17 00:00:00 2001
From: a1ho Answer: The function
+ The average score on this problem was 57%. Which expression best estimates the mean of Answer: Note that
+ The average score on this problem was 89%. What expression best estimates the standard deviation of
@@ -175,6 +231,35 @@ Answer: Note that we can use the Central Limit Theorem for this problem which
+states that the standard deviation (SD) of the distribution of sample
+means is equal to
+ The average score on this problem was 91%. What is the dog price of $560 in standard units? Answer: To convert a value to standard units, we take the value, subtract the
+mean from it, and divide by SD. In this case that is
+
+ The average score on this problem was 80%. The distribution of True False Answer: True True. The central limit theorem states that if you have a population
+and you take a sufficiently large number of random samples from the
+population, then the distribution of the sample means will be
+approximately normally distributed.
+ The average score on this problem was 91%. If Oren’s sample was 400 dogs instead of 200, the standard deviation
@@ -204,6 +344,34 @@ Decrease by a factor of \sqrt{2} None of the above Answer: Decrease by a factor of \sqrt{2} Recall that the central limit theorem states that the STD of the
+sample distribution is equal to
+
+ The average score on this problem was 80%. If Oren took 4000 bootstrap resamples instead of 1000, the standard
@@ -215,6 +383,33 @@ Decrease by a factor of 4 None of the above Answer: None of the above Again, from our formula given by the central limit theorem, the
+sample STD doesn’t depend on the number of bootstrap resamples so long
+as it’s “sufficiently large”. Thus increasing our bootstrap sample from
+1000 to 4000 will have no effect on the std of
+ The average score on this problem was 74%. Write one line of code that evaluates to the right
@@ -222,6 +417,40 @@ Answer: Recall that a 92% confidence interval means an interval that consists
+of the middle 92% of the distribution. In other words, we want to “chop”
+off 4% from either end of the ditribution. Thus to get the right
+endpoint, we want the value corresponding to the 96th percentile in the
+mean dog price distribution, or
+
+ The average score on this problem was 48%. The mean will be approximately equal to 400. The mean will be approximately equal to 500. Answer: The mean will be approximately equal to
+400. The distribution of bootstrapped means’ mean will be approximately
+400 since that is the mean of the sample and bootstrapping is taking
+many samples of the original sample. The mean will not be exactly 400 do
+to some randomness though it will be very close.
+ The average score on this problem was 54%. Which of the following is closest to the standard deviation of the
@@ -249,6 +506,32 @@ 4 0.4 Answer: 4 To find the standard deviation of the distribution, we can take the
+sample standard deviation S divided by the square root of the sample
+size. From plugging in, we get 40 / 10 = 4.
+ The average score on this problem was 51%.Problem 1.1
b / np.sqrt(c)
b * np.sqrt(c)
+
+
+
+b
np.std
directly calculated the standard
+deviation of array oren
. Even though oren
is
+sample of the population, its standard deviation is still a pretty good
+estimate for the standard deviation of the population because it is a
+random sample. The other options don’t really make sense in this
+context.
+Difficulty: ⭐️⭐️⭐️
+Problem 1.2
boots
?Problem 1.2
(oren - a).mean()
(oren - a) / b
+
+
+
+a
a
is equal to the mean of oren
,
+which is a pretty good estimator of the mean of the overall population
+as well as the mean of the distribution of sample means. The other
+options don’t really make sense in this context.
+Difficulty: ⭐️⭐️
+Problem 1.3
Problem 1.3
b / np.sqrt(c)
(a -b) / np.sqrt(c)
+
+
+
+b / np.sqrt(c)
(population SD) / np.sqrt(sample size)
.
+Since the SD of the sample is also the SD of the population in this
+case, we can plug our variables in to see that
+b / np.sqrt(c)
is the answer.
+Difficulty: ⭐️
+Problem 1.4
Problem 1.4
abs(560 - a) / b
abs(560 - a) / (b / np.sqrt(c))
+
+
+
+(560 - a) / b
(560 - a) / b
, because a
is the mean of our
+dog prices sample array and b
is the SD of the dog prices
+sample array.
+Difficulty: ⭐️⭐️
+Problem 1.5
boots
is normal because of the
@@ -193,6 +306,33 @@ Problem 1.5
+
+
+
+
+Difficulty: ⭐️
+Problem 1.6
Problem 1.6
+
+
+
+(population STD) / np.sqrt(sample size)
. So if we increase
+the sample size by a factor of 2, the STD of the sample distribution
+will decrease by a factor of \sqrt{2}.
+Difficulty: ⭐️⭐️
+Problem 1.7
Problem 1.7
+
+
+
+boots
+Difficulty: ⭐️⭐️⭐️
+Problem 1.8
Problem 1.8
dog price. The following expressions may help:1.75) # => 0.96
stats.norm.cdf(1.4) # => 0.92 stats.norm.cdf(
+
+
+
+a + 1.75 * b / np.sqrt(c)
mean + 1.75 * (SD of population / np.sqrt(sample size)
or
+a + 1.75 * b / np.sqrt(c)
(we divide by
+np.sqrt(c)
due to the central limit theorem). Note that the
+second line of information that was given
+stats.norm.cdf(1.4)
is irrelavant to this particular
+problem.
+Difficulty: ⭐️⭐️⭐️⭐️
+
Problem 2
@@ -239,6 +468,34 @@ Problem 2.1
+
+
+
+
+Difficulty: ⭐️⭐️⭐️
+Problem 2.2
Problem 2.2
+
+
+
+
+Difficulty: ⭐️⭐️⭐️
+
Problem 3
@@ -256,6 +539,77 @@ Problem 3
and standard deviation 15. What is the probability that your sample has
a mean between 50 and 53? Input the probability below, as a number
between 0 and 1, rounded to two decimal places.
Answer: 0.48
+This problem is testing our understanding of the Central Limit +Theorem and normal distributions. Recall, the Central Limit Theorem +tells us that the distribution of the sample mean is roughly normal, +with the following characteristics:
+\begin{align*} +\text{Mean of Distribution of Possible Sample Means} &= +\text{Population Mean} = 50 \\ +\text{SD of Distribution of Possible Sample Means} &= +\frac{\text{Population SD}}{\sqrt{\text{Sample Size}}} = +\frac{15}{\sqrt{100}} = 1.5 +\end{align*} +
+Given this information, it may be easier to express the problem as +“We draw a value from a normal distribution with mean 50 and SD 1.5. +What is the probability that the value is between 50 and 53?” Note that +this probability is equal to the proportion of values between 50 +and 53 in a normal distribution whose mean is 50 and 1.5 (since +probabilities can be thought of as proportions).
+In class, we typically worked with the standard normal +distribution, in which the mean was 0, the SD was 1, and the x-axis represented values in standard units. +Let’s convert the quantities of interest in this problem to standard +units, keeping in mind that the mean and SD we’re using now are the mean +and SD of the distribution of possible sample means, not of the +population.
+Now, our problem boils down to finding the proportion of +values in a standard normal distribution that are between 0 and +2, or the proportion of values in a normal distribution +that are in the interval [\text{mean}, +\text{mean} + 2 \text{ SDs}].
+From class, we know that in a normal distribution, roughly 95% of +values are within 2 standard deviations of the mean, i.e. the proportion +of values in the interval [\text{mean} - 2 +\text{ SDs}, \text{mean} + 2 \text{ SDs}] is 0.95.
+Since the normal distribution is symmetric about the mean, half of +the values in this interval are to the right of the mean, and half are +to the left. This means that the proportion of values in the interval +[\text{mean}, \text{mean} + 2 \text{ +SDs}] is \frac{0.95}{2} = 0.475, +which rounds to 0.48, and thus the desired result is 0.48.
++
+The average score on this problem was 48%.
+The DataFrame apps
contains application data for a
@@ -275,6 +629,42 @@
Give the endpoints of the CLT-based 95% confidence interval for the
mean age of all applicants in apps
, based on the data in
hundred_apps
.
Answer: Left endpoint = 33, Right endpoint = 37
+According to the Central Limit Theorem, the standard deviation of the +distribution of the sample mean is \frac{\text{sample SD}}{\sqrt{\text{sample size}}} = +\frac{10}{\sqrt{100}} = 1. Then using the fact that the +distribution of the sample mean is roughly normal, since 95% of the area +of a normal curve falls within two standard deviations of the mean, we +can find the endpoints of the 95% CLT-based confidence interval as 35 - 2 = 33 and 35 ++ 2 = 37.
+We can think of this as using the formula below: +\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]. Plugging in the appropriate quantities yields [35 - 2\cdot\frac{10}{\sqrt{100}}, 35 - +2\cdot\frac{10}{\sqrt{100}}] = [33, 37].
++
+The average score on this problem was 67%.
+BruinCard reinstates our access to apps
so that we can
@@ -292,6 +682,41 @@
sample_means
?
Answer: Option 1
+As we found in the previous part, the distribution of the sample mean +should have a standard deviation of 1. We also know it should be +centered at the mean of our sample, at 35, but since all the options are +centered here, that’s not too helpful. Only Option 1, however, has a +standard deviation of 1. Remember, we can approximate the standard +deviation of a normal curve as the distance between the mean and either +of the inflection points. Only Option 1 looks like it has inflection +points at 34 and 36, a distance of 1 from the mean of 35.
+If you chose Option 2, you probably confused the standard deviation +of our original sample, 10, with the standard deviation of the +distribution of the sample mean, which comes from dividing that value by +the square root of the sample size.
++
+The average score on this problem was 57%.
+Which of the following statements are guaranteed to be true? Select @@ -311,6 +736,83 @@
apps
.
None of the above.
Answer: A CLT-based 90% confidence interval for the
+mean age of credit card applicants, based on the data in
+hundred_apps
, would be narrower than the interval you gave
+in part (a).
Let’s analyze each of the options:
+Option 1: We are not using bootstrapping to compute sample means
+since we are sampling from the apps
DataFrame, which is our
+population here. If we were bootstrapping, we’d need to sample from our
+first sample, which is hundred_apps
.
Option 2: We can’t be sure what the distribution of the ages of
+credit card applicants are. The Central Limit Theorem says that the
+distribution of sample_means
is roughly normally
+distributed, but we know nothing about the population
+distribution.
Option 3: The CLT-based 95% confidence interval that we +calculated in part (a) was computed as follows: \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] A CLT-based 90% confidence interval would be computed as +\left[\text{sample mean} - z\cdot +\frac{\text{sample SD}}{\sqrt{\text{sample size}}}, +\text{sample mean} + z\cdot \frac{\text{sample SD}}{\sqrt{\text{sample +size}}} +\right] for some value of z less +than 2. We know that 95% of the area of a normal curve is within two +standard deviations of the mean, so to only pick up 90% of the area, +we’d have to go slightly less than 2 standard deviations away. This +means the 90% confidence interval will be narrower than the 95% +confidence interval.
Option 4: The left endpoint of the interval from part (a) was
+calculated using the Central Limit Theorem, whereas using
+np.percentile(sample_means, 2.5)
is calculated empirically,
+using the data in sample_means
. Empirically calculating a
+confidence interval doesn’t necessarily always give the exact same
+endpoints as using the Central Limit Theorem, but it should give you
+values close to those endpoints. These values are likely very similar
+but they are not guaranteed to be the same. One way to see this is that
+if we ran the code to generate sample_means
again, we’d
+probably get a different value for
+np.percentile(sample_means, 2.5)
.
Option 5: The key observation is that if we used the data in
+hundred_apps
to create 1,000 CLT-based 95% confidence
+intervals for the mean age of applicants in apps
, all of
+these intervals would be exactly the same. Given a sample, there is only
+one CLT-based 95% confidence interval associated with it. In our case,
+given the sample hundred_apps
, the one and only CLT-based
+95% confidence interval based on this sample is the one we found in part
+(a). Therefore if we generated 1,000 of these intervals, either they
+would all contain the parameter or none of them would. In order for a
+statement like the one here to be true, we would need to collect 1,000
+different samples, and calculate a confidence interval from each
+one.
+
+The average score on this problem was 49%.
+Answer: 625
+Note: Before reviewing these solutions, it’s highly recommended +to revisit the lecture on “Choosing Sample Sizes,” since this problem +follows the main example from that lecture almost exactly.
+While this solution is long, keep in mind from the start that our +goal is to solve for the smallest sample size necessary +to create a confidence interval that achieves certain criteria.
+The Central Limit Theorem tells us that the distribution of the +sample mean is roughly normal, regardless of the distribution of the +population from which the samples are drawn. At first, it may not be +clear how the Central Limit Theorem is relevant, but remember that +proportions are means too – for instance, the proportion of adults who +want to be vaccinated is equal to the mean of a collection of 1s and 0s, +where we have a 1 for each adult that wants to be vaccinated and a 0 for +each adult who doesn’t want to be vaccinated. What this means (😉) is +that the Central Limit Theorem applies to the distribution of +the sample proportion, so we can use it here too.
+Not only do we know that the distribution of sample proportions is +roughly normal, but we know its mean and standard deviation, too:
+\begin{align*} +\text{Mean of Distribution of Possible Sample Means} &= +\text{Population Mean} = \text{Population Proportion} \\ +\text{SD of Distribution of Possible Sample Means} &= +\frac{\text{Population SD}}{\sqrt{\text{Sample Size}}} +\end{align*} +
+Using this information, we can create a 95% confidence interval for +the population proportion, using the fact that in a normal distribution, +roughly 95% of values are within 2 standard deviations of the mean:
+\left[ \text{Population Proportion} - 2 +\cdot \frac{\text{Population SD}}{\sqrt{\text{Sample Size}}}, \: +\text{Population Proportion} + 2 \cdot \frac{\text{Population +SD}}{\sqrt{\text{Sample Size}}} \right]
+However, this interval depends on the population proportion (mean) +and SD, which we don’t know. (If we did know these parameters, there +would be no need to collect a sample!) Instead, we’ll use the sample +proportion and SD as rough estimates:
+\left[ \text{Sample Proportion} - 2 \cdot +\frac{\text{Sample SD}}{\sqrt{\text{Sample Size}}}, \: \text{Sample +Proportion} + 2 \cdot \frac{\text{Sample SD}}{\sqrt{\text{Sample +Size}}} \right]
+Note that the width of this interval – that is, its right endpoint +minus its left endpoint – is: \text{width} = +4 \cdot \frac{\text{Sample SD}}{\sqrt{\text{Sample Size}}}
+In the problem, we’re told that we want our interval to be accurate +to within 0.04, which is equivalent to wanting the width of our interval +to be less than or equal to 0.08 (since the interval extends the same +amount above and below the sample proportion). As such, we need to pick +the smallest sample size necessary such that:
+\text{width} = 4 \cdot \frac{\text{Sample +SD}}{\sqrt{\text{Sample Size}}} \leq 0.08
+We can re-arrange the inequality above to solve for our sample’s +size:
++\begin{align*} +4 \cdot \frac{\text{Sample SD}}{\sqrt{\text{Sample Size}}} &\leq +0.08 \\ +\frac{\text{Sample SD}}{\sqrt{\text{Sample Size}}} &\leq 0.02 \\ +\frac{1}{\sqrt{\text{Sample Size}}} &\leq \frac{0.02}{\text{Sample +SD}} \\ +\frac{\text{Sample SD}}{0.02} &\leq \sqrt{\text{Sample Size}} \\ +\left( \frac{\text{Sample SD}}{0.02} \right)^2 &\leq \text{Sample +Size} +\end{align*} +
+All we now need to do is pick the smallest sample size that satisfies +the above inequality. But there’s an issue – we don’t know what +our sample SD is, because we haven’t collected our sample! +Notice that in the inequality above, as the sample SD increases, so does +the minimum necessary sample size. In order to ensure we don’t collect +too small of a sample (which would result in the width of our confidence +interval being larger than desired), we can use an upper bound +for the SD of our sample. In the problem, we’re told that the largest +possible SD of a sample of 0s and 1s is 0.5 – this means that if we +replace our sample SD with 0.5, we will find a sample size such that the +width of our confidence interval is guaranteed to be less than or equal +to 0.08. This sample size may be larger than necessary, but that’s +better than it being smaller than necessary.
+By substituting 0.5 for the sample SD in the last inequality above, +we get
++\begin{align*} +\left( \frac{\text{Sample SD}}{0.02} \right)^2 &\leq \text{Sample +Size} \\\ +\left( \frac{0.5}{0.02} \right)^2 &\leq \text{Sample Size} \\ +25^2 &\leq \text{Sample Size} \implies \text{Sample Size} \geq 625 +\end{align*} +
+We need to pick the smallest possible sample size that is greater +than or equal to 625; that’s just 625.
++
+The average score on this problem was 40%.
+It’s your first time playing a new game called Brunch Menu. @@ -353,6 +967,55 @@
\frac{17}{81}
\frac{17}{96}
Answer: \frac{17}{27}
+A Central Limit Theorem-based 95% confidence interval for a +population proportion is given by the following:
+\left[ \text{Sample Proportion} - 2 \cdot +\frac{\text{Sample SD}}{\sqrt{\text{Sample Size}}}, \text{Sample +Proportion} + 2 \cdot \frac{\text{Sample SD}}{\sqrt{\text{Sample Size}}} +\right]
+Note that this interval uses the fact that (about) 95% of values in a +normal distribution are within 2 standard deviations of the mean. It’s +key to divide by \sqrt{\text{Sample +Size}} when computing the standard deviation because the +distribution that is roughly normal is the distribution of the sample +mean (and hence, sample proportion), not the distribution of the sample +itself.
+The width of the above interval – that is, the right endpoint minus +the left endpoint – is
+\text{width} = 4 \cdot \frac{\text{Sample +SD}}{\sqrt{\text{Sample Size}}}
+From the provided hint, we have that
+\text{Sample SD} = \sqrt{(\text{Prop. of +0s}) \cdot (\text{Prop of 1s})} = \sqrt{\frac{3}{9} \cdot \frac{6}{9}} = +\frac{\sqrt{18}}{9}
+Then, since we know that the sample size is 9 and that \sqrt{18} is about \frac{17}{4}, we have
+\text{width} = 4 \cdot \frac{\text{Sample +SD}}{\sqrt{\text{Sample Size}}} = 4 \cdot +\frac{\frac{\sqrt{18}}{9}}{\sqrt{9}} = 4 \cdot \frac{\sqrt{18}}{9 \cdot +3} = 4 \cdot \frac{\frac{17}{4}}{27} = \frac{17}{27}
++
+The average score on this problem was 51%.
+Which of the following are limitations of trying to use the Central @@ -367,6 +1030,44 @@
The CLT is for sample means and sums, not sample proportions.
Answer: Options 1 and 2
+Option 1: We use Central Limit Theorem (CLT) for +large random samples, and a sample of 9 is considered to be very small. +This makes it difficult to use CLT for this problem.
+Option 2: Recall CLT happens when our sample is +drawn with replacement. When we are handed nine cards we are never +replacing cards back into our deck, which means that we are sampling +without replacement.
+Option 3: This is wrong because CLT states that a +large sample is approximately a normal distribution even if the data +itself is not normally distributed. This means it doesn’t matter if our +data had not been normally distributed if we had a large enough sample +we could use CLT.
+Option 4: This is wrong because CLT does apply to +the sample proportion distribution. Recall that proportions can be +treated like means.
++
+The average score on this problem was 77%.
+Answer: \frac{1}{15}
+The average score on this problem was 38%.
+If you decide to survey 450 students instead of 900 students for your @@ -388,6 +1111,29 @@
increase by more than double
increase by less than double
Answer: increase by less than double
++
+The average score on this problem was 60%.
+Answer: 0.025
++
+The average score on this problem was 46%.
+Using the fact that the standard deviation of any dataset of 0s and 1s is no more than 0.5, calculate the minimum number of people you would need to survey so that the width of your confidence interval is at most 0.10. Give your answer as an integer.
+Answer: 400
++
+The average score on this problem was 81%.
+