Added an exercise

This commit is contained in:
2026-11-05 09:40:17 -05:00
parent ac71393bdd
commit 9395bdce9e
+108 -35
View File
@@ -2,28 +2,37 @@
<title>Confidence Intervals</title> <title>Confidence Intervals</title>
<p> <p>
When estimating the value of some parameter, the maximum likelihood estimation provides the single estimate with highest possible likelihood. When estimating the value of some parameter, the maximum likelihood
But we might prefer to have a range of values, with some quantitative measure of how certain we are that the true parameter value could be in the range. estimation provides the single estimate with highest possible likelihood.
But we might prefer to have a range of values, with some quantitative
measure of how certain we are that the true parameter value could be in the
range.
</p> </p>
<p> <p>
Suppose some measurement has a mean <m>\mu</m> and variance <m>\sigma^2</m> across the entire population. Suppose some measurement has a mean <m>\mu</m> and variance <m>\sigma^2</m>
Independent measurements <m>X_1, X_2, \dotsc, X_n</m> and calculate the sample mean across the entire population.
Independent measurements <m>X_1, X_2, \dotsc, X_n</m> and calculate the
sample mean
<md> <md>
<mrow> A_n = \frac{X_1 + \dotsb + X_n}{n}. </mrow> <mrow> A_n = \frac{X_1 + \dotsb + X_n}{n}. </mrow>
</md> </md>
Then, according to <xref ref="thm-CLT"/>, <m>A_n \approx \Norm\left(\mu, \frac{\sigma^2}{n}\right)</m> as long as we take a sufficient number of measurements. Then, according to <xref ref="thm-CLT"/>,
<m>A_n \approx \Norm\left(\mu, \frac{\sigma^2}{n}\right)</m> as long as we
take a sufficient number of measurements.
However, we don't have access to the true values of <m>\mu, \sigma^2</m>. However, we don't have access to the true values of <m>\mu, \sigma^2</m>.
</p> </p>
<p> <p>
We can make an estimate <m>s^2</m> of <m>\sigma^2</m> from the collected data, so we know how spread out the normal distribution should be. We can make an estimate <m>s^2</m> of <m>\sigma^2</m> from the collected
data, so we know how spread out the normal distribution should be.
</p> </p>
<definition xml:id="def-sample-variance"> <definition xml:id="def-sample-variance">
<statement> <statement>
<p> <p>
Let <m>X_1, X_2, \dotsc, X_n</m> be independent samples taken from a population. Let <m>X_1, X_2, \dotsc, X_n</m> be independent samples taken from a
population.
Let <m>A_n = \frac{X_1 + \dotsb + X_n}{n}</m> be the sample mean. Let <m>A_n = \frac{X_1 + \dotsb + X_n}{n}</m> be the sample mean.
The <term>sample variance</term> is: The <term>sample variance</term> is:
<md> <md>
@@ -39,26 +48,35 @@
</definition> </definition>
<p> <p>
Note that <m>s^2</m> is an estimate of the variance of each individual measurement <m>X_i</m> taken from the population. Note that <m>s^2</m> is an estimate of the variance of each individual
Therefore, <m>\frac{s^2}{n}</m> is an estimate of the variance of the mean <m>A_n</m>. measurement <m>X_i</m> taken from the population.
Hence "standard error of the mean" is an estimate of the standard deviation of the mean. Therefore, <m>\frac{s^2}{n}</m> is an estimate of the variance of the mean
<m>A_n</m>.
Hence "standard error of the mean" is an estimate of the standard deviation
of the mean.
</p> </p>
<p> <p>
Next, we want to pick a distance <m>c</m> so that our measured sample mean <m>A_n</m> is within <m>c</m> of the true population mean <m>\mu</m> with a high probability. Next, we want to pick a distance <m>c</m> so that our measured sample mean
We can pick some value <m>\alpha \in (0, 1)</m>, and let <m>c_{\alpha} = \Phi^{-1}\left(1 - \frac{\alpha}{2}\right)</m>. <m>A_n</m> is within <m>c</m> of the true population mean <m>\mu</m> with a
high probability.
We can pick some value <m>\alpha \in (0, 1)</m>, and let
<m>c_{\alpha} = \Phi^{-1}\left(1 - \frac{\alpha}{2}\right)</m>.
Then the interval: Then the interval:
<md> <md>
<mrow> \left[A_n - c_{\alpha} \left(\frac{s}{\sqrt{n}}\right), A_n + c_{\alpha} \left(\frac{s}{\sqrt{n}}\right)\right] </mrow> <mrow> \left[A_n - c_{\alpha} \left(\frac{s}{\sqrt{n}}\right), A_n + c_{\alpha} \left(\frac{s}{\sqrt{n}}\right)\right] </mrow>
</md> </md>
is called a <term>confidence interval</term> with confidence level <m>1 - \alpha</m>. is called a <term>confidence interval</term> with confidence level
<m>1 - \alpha</m>.
</p> </p>
<!-- TODO: explanation of c_{\alpha} --> <!-- TODO: explanation of c_{\alpha} -->
<theorem xml:id="thm-CI"> <theorem xml:id="thm-CI">
<statement> <statement>
<p> <p>
Let <m>X_1, X_2, \dotsc, X_n</m> be independent samples taken from a population. Let <m>X_1, X_2, \dotsc, X_n</m> be independent samples taken from a
Suppose <m>A_n</m> is the sample mean and <m>s^2</m> the sample variance. population.
Suppose <m>A_n</m> is the sample mean and <m>s^2</m> the sample
variance.
Then the 95% confidence limits are: Then the 95% confidence limits are:
<md> <md>
<mrow> \mu_{\ell} \amp = A_n - 1.96 \left(\frac{s}{\sqrt{n}}\right) </mrow> <mrow> \mu_{\ell} \amp = A_n - 1.96 \left(\frac{s}{\sqrt{n}}\right) </mrow>
@@ -71,10 +89,13 @@
<example> <example>
<statement> <statement>
<p> <p>
Suppose measurements are taken of the heights of several plants in a garden plot. Suppose measurements are taken of the heights of several plants in a
garden plot.
The measurements are given below. The measurements are given below.
(Note: for the sake of a managable calculation, only five measurements are given. (Note: for the sake of a managable calculation, only five measurements
However, for <xref ref="thm-CLT"/> to apply, the number of measurements would need to be greater.) are given.
However, for <xref ref="thm-CLT"/> to apply, the number of measurements
would need to be greater.)
</p> </p>
<table> <table>
@@ -140,10 +161,16 @@
</example> </example>
<p> <p>
If the individual measurements <m>X_1, \dotsc, X_n</m> are indicator random variables, then the mean <m>A_n</m> represents the proportion which take on the value 1. If the individual measurements <m>X_1, \dotsc, X_n</m> are indicator random
For example, if the <m>X_i</m>'s indicate heads on coin flips, then <m>A_n</m> represents the proportion which come up heads. variables, then the mean <m>A_n</m> represents the proportion which take on
In this setting, we have a nice shortcut formula (<xref ref="example-binomial-variance"/>) for the variance of <m>S_n = X_1 + \dotsc + X_n</m>. the value 1.
We can make use of this formula to get the variance of <m>A_n</m> without going through the sample variance calculation above: For example, if the <m>X_i</m>'s indicate heads on coin flips, then
<m>A_n</m> represents the proportion which come up heads.
In this setting, we have a nice shortcut formula
(<xref ref="example-binomial-variance"/>) for the variance of
<m>S_n = X_1 + \dotsc + X_n</m>.
We can make use of this formula to get the variance of <m>A_n</m> without
going through the sample variance calculation above:
<md> <md>
<mrow> \Var(S_n) \amp = np(1 - p) </mrow> <mrow> \Var(S_n) \amp = np(1 - p) </mrow>
<mrow> \Var(A_n) \amp = \Var\left(\frac{S_n}{n}\right) </mrow> <mrow> \Var(A_n) \amp = \Var\left(\frac{S_n}{n}\right) </mrow>
@@ -151,14 +178,16 @@
<mrow> \amp = \frac{1}{n^2} (np(1 - p)) </mrow> <mrow> \amp = \frac{1}{n^2} (np(1 - p)) </mrow>
<mrow> \amp = \frac{p(1 - p)}{n}. </mrow> <mrow> \amp = \frac{p(1 - p)}{n}. </mrow>
</md> </md>
Since we won't have access to the true value of <m>p</m>, we can use the maximum likelihood estimate <m>\widehat{p}</m>. Since we won't have access to the true value of <m>p</m>, we can use the
maximum likelihood estimate <m>\widehat{p}</m>.
</p> </p>
<example> <example>
<statement> <statement>
<p> <p>
Suppose in a sample of 100 people, 40 have a particular trait. Suppose in a sample of 100 people, 40 have a particular trait.
The maximum likelihood estimate for the probability <m>p</m> of a random person having the trait is <m>\widehat{p} = \frac{40}{100} = 0.4</m>. The maximum likelihood estimate for the probability <m>p</m> of a random
person having the trait is <m>\widehat{p} = \frac{40}{100} = 0.4</m>.
So the standard error will be: So the standard error will be:
<md> <md>
<mrow> \sqrt{\frac{(0.4)(1 - 0.4)}{100}} = \sqrt{\frac{0.24}{100}} \approx 0.049. </mrow> <mrow> \sqrt{\frac{(0.4)(1 - 0.4)}{100}} = \sqrt{\frac{0.24}{100}} \approx 0.049. </mrow>
@@ -177,7 +206,8 @@
<statement> <statement>
<p> <p>
Suppose we flip a coin 100 times and count 60 heads. Suppose we flip a coin 100 times and count 60 heads.
Let <m>p</m> be the (unknown) probability that the coin comes up heads on a flip. Let <m>p</m> be the (unknown) probability that the coin comes up heads
on a flip.
Give an approximate 95% confidence interval for the value of <m>p</m>. Give an approximate 95% confidence interval for the value of <m>p</m>.
</p> </p>
</statement> </statement>
@@ -196,11 +226,11 @@
</p> </p>
</introduction> </introduction>
<task> <task>
<statement> <statement>
<p> <p>
Give a 95% confidence interval for the proportion <m>p</m> of left-handed people. Give a 95% confidence interval for the proportion <m>p</m> of
left-handed people.
</p> </p>
</statement> </statement>
@@ -211,7 +241,6 @@
</answer> </answer>
</task> </task>
<task> <task>
<statement> <statement>
<p> <p>
@@ -227,6 +256,47 @@
</task> </task>
</exercise> </exercise>
<exercise>
<introduction>
<p>
Suppose a sample of measurements are taken, and the sample is found to
have a mean of <m>20.2</m> with a standard error of <m>4.3</m>.
</p>
</introduction>
<task>
<statement>
<p>
Find the 95% confidence limits.
</p>
</statement>
</task>
<task>
<statement>
<p>
Find the 92% confidence limits.
</p>
</statement>
</task>
<task>
<statement>
<p>
Find the 97% confidence limits.
</p>
</statement>
</task>
<task>
<statement>
<p>
Find the 99% confidence limits.
</p>
</statement>
</task>
</exercise>
<exercise> <exercise>
<statement> <statement>
<p> <p>
@@ -236,8 +306,7 @@
</p> </p>
<table> <table>
<title></title> <title/>
<tabular halign="center"> <tabular halign="center">
<row header="yes" bottom="minor"> <row header="yes" bottom="minor">
<cell>mouse <m>i</m></cell> <cell>mouse <m>i</m></cell>
@@ -274,7 +343,9 @@
<answer> <answer>
<p> <p>
<!-- avg weight = 28 --> <!-- sum of squares = 4030 --> <!-- s^2 = 27.5 --> <!-- \sqrt{s^2/n} \approx 2.35 --> <m>[23.39, 32.61]</m>. <!-- avg weight = 28 --> <!-- sum of squares = 4030 -->
<!-- s^2 = 27.5 --> <!-- \sqrt{s^2/n} \approx 2.35 -->
<m>[23.39, 32.61]</m>.
</p> </p>
</answer> </answer>
</exercise> </exercise>
@@ -283,13 +354,13 @@
<statement> <statement>
<p> <p>
The heights of five plants are measured and recorded below. The heights of five plants are measured and recorded below.
Give a 95% confidence interval around the sample mean for the heights of the plants. Give a 95% confidence interval around the sample mean for the heights
of the plants.
(Pretend 5 measurements is large enough for the CLT to apply.) (Pretend 5 measurements is large enough for the CLT to apply.)
</p> </p>
<table> <table>
<title></title> <title/>
<tabular halign="center"> <tabular halign="center">
<row header="yes" bottom="minor"> <row header="yes" bottom="minor">
<cell>plant <m>i</m></cell> <cell>plant <m>i</m></cell>
@@ -326,7 +397,9 @@
<answer> <answer>
<p> <p>
<!-- avg weight = 17 --> <!-- sum of squares = 1475 --> <!-- s^2 = 7.5 --> <!-- \sqrt{s^2/n} \approx 1.22 --> <m>[14.61, 19.39]</m>. <!-- avg weight = 17 --> <!-- sum of squares = 1475 -->
<!-- s^2 = 7.5 --> <!-- \sqrt{s^2/n} \approx 1.22 -->
<m>[14.61, 19.39]</m>.
</p> </p>
</answer> </answer>
</exercise> </exercise>