Added an exercise
This commit is contained in:
+226
-153
@@ -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>
|
||||||
@@ -173,162 +202,206 @@
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<exercises xml:id="exercises-Confidence-Intervals">
|
<exercises xml:id="exercises-Confidence-Intervals">
|
||||||
<exercise>
|
<exercise>
|
||||||
<statement>
|
|
||||||
<p>
|
|
||||||
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.
|
|
||||||
Give an approximate 95% confidence interval for the value of <m>p</m>.
|
|
||||||
</p>
|
|
||||||
</statement>
|
|
||||||
|
|
||||||
<answer>
|
|
||||||
<p>
|
|
||||||
<m>[0.504, 0.696]</m>.
|
|
||||||
</p>
|
|
||||||
</answer>
|
|
||||||
</exercise>
|
|
||||||
|
|
||||||
<exercise>
|
|
||||||
<introduction>
|
|
||||||
<p>
|
|
||||||
Suppose in a sample of 100 people, 12 are left-handed.
|
|
||||||
</p>
|
|
||||||
</introduction>
|
|
||||||
|
|
||||||
|
|
||||||
<task>
|
|
||||||
<statement>
|
<statement>
|
||||||
<p>
|
<p>
|
||||||
Give a 95% confidence interval for the proportion <m>p</m> of left-handed people.
|
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.
|
||||||
|
Give an approximate 95% confidence interval for the value of <m>p</m>.
|
||||||
</p>
|
</p>
|
||||||
</statement>
|
</statement>
|
||||||
|
|
||||||
<answer>
|
<answer>
|
||||||
<p>
|
<p>
|
||||||
<m>[0.056, 0.184]</m>.
|
<m>[0.504, 0.696]</m>.
|
||||||
</p>
|
</p>
|
||||||
</answer>
|
</answer>
|
||||||
</task>
|
</exercise>
|
||||||
|
|
||||||
|
<exercise>
|
||||||
|
<introduction>
|
||||||
|
<p>
|
||||||
|
Suppose in a sample of 100 people, 12 are left-handed.
|
||||||
|
</p>
|
||||||
|
</introduction>
|
||||||
|
|
||||||
<task>
|
<task>
|
||||||
|
<statement>
|
||||||
|
<p>
|
||||||
|
Give a 95% confidence interval for the proportion <m>p</m> of
|
||||||
|
left-handed people.
|
||||||
|
</p>
|
||||||
|
</statement>
|
||||||
|
|
||||||
|
<answer>
|
||||||
|
<p>
|
||||||
|
<m>[0.056, 0.184]</m>.
|
||||||
|
</p>
|
||||||
|
</answer>
|
||||||
|
</task>
|
||||||
|
|
||||||
|
<task>
|
||||||
|
<statement>
|
||||||
|
<p>
|
||||||
|
Give a 90% confidence interval.
|
||||||
|
</p>
|
||||||
|
</statement>
|
||||||
|
|
||||||
|
<answer>
|
||||||
|
<p>
|
||||||
|
<m>[0.066, 0.174]</m>.
|
||||||
|
</p>
|
||||||
|
</answer>
|
||||||
|
</task>
|
||||||
|
</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>
|
||||||
<statement>
|
<statement>
|
||||||
<p>
|
<p>
|
||||||
Give a 90% confidence interval.
|
The weights of five mice are measured and recorded below.
|
||||||
|
Give a 95% confidence interval for the sample mean weight of mice.
|
||||||
|
(Pretend 5 measurements is large enough for the CLT to apply.)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<title/>
|
||||||
|
<tabular halign="center">
|
||||||
|
<row header="yes" bottom="minor">
|
||||||
|
<cell>mouse <m>i</m></cell>
|
||||||
|
<cell>weight <m>W_i</m> (g)</cell>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<cell>1</cell>
|
||||||
|
<cell>26</cell>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<cell>2</cell>
|
||||||
|
<cell>32</cell>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<cell>3</cell>
|
||||||
|
<cell>33</cell>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<cell>4</cell>
|
||||||
|
<cell>20</cell>
|
||||||
|
</row>
|
||||||
|
|
||||||
|
<row>
|
||||||
|
<cell>5</cell>
|
||||||
|
<cell>29</cell>
|
||||||
|
</row>
|
||||||
|
</tabular>
|
||||||
|
</table>
|
||||||
</statement>
|
</statement>
|
||||||
|
|
||||||
<answer>
|
<answer>
|
||||||
<p>
|
<p>
|
||||||
<m>[0.066, 0.174]</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>
|
||||||
</task>
|
</exercise>
|
||||||
</exercise>
|
|
||||||
|
|
||||||
<exercise>
|
<exercise>
|
||||||
<statement>
|
<statement>
|
||||||
<p>
|
<p>
|
||||||
The weights of five mice are measured and recorded below.
|
The heights of five plants are measured and recorded below.
|
||||||
Give a 95% confidence interval for the sample mean weight of mice.
|
Give a 95% confidence interval around the sample mean for the heights
|
||||||
(Pretend 5 measurements is large enough for the CLT to apply.)
|
of the plants.
|
||||||
</p>
|
(Pretend 5 measurements is large enough for the CLT to apply.)
|
||||||
|
</p>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<title></title>
|
<title/>
|
||||||
|
<tabular halign="center">
|
||||||
|
<row header="yes" bottom="minor">
|
||||||
|
<cell>plant <m>i</m></cell>
|
||||||
|
<cell>height <m>H_i</m> (in)</cell>
|
||||||
|
</row>
|
||||||
|
|
||||||
<tabular halign="center">
|
<row>
|
||||||
<row header="yes" bottom="minor">
|
<cell>1</cell>
|
||||||
<cell>mouse <m>i</m></cell>
|
<cell>15</cell>
|
||||||
<cell>weight <m>W_i</m> (g)</cell>
|
</row>
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<cell>1</cell>
|
<cell>2</cell>
|
||||||
<cell>26</cell>
|
<cell>14</cell>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<cell>2</cell>
|
<cell>3</cell>
|
||||||
<cell>32</cell>
|
<cell>18</cell>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<cell>3</cell>
|
<cell>4</cell>
|
||||||
<cell>33</cell>
|
<cell>21</cell>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
<cell>4</cell>
|
<cell>5</cell>
|
||||||
<cell>20</cell>
|
<cell>17</cell>
|
||||||
</row>
|
</row>
|
||||||
|
</tabular>
|
||||||
|
</table>
|
||||||
|
</statement>
|
||||||
|
|
||||||
<row>
|
<answer>
|
||||||
<cell>5</cell>
|
<p>
|
||||||
<cell>29</cell>
|
<!-- avg weight = 17 --> <!-- sum of squares = 1475 -->
|
||||||
</row>
|
<!-- s^2 = 7.5 --> <!-- \sqrt{s^2/n} \approx 1.22 -->
|
||||||
</tabular>
|
<m>[14.61, 19.39]</m>.
|
||||||
</table>
|
</p>
|
||||||
</statement>
|
</answer>
|
||||||
|
</exercise>
|
||||||
<answer>
|
|
||||||
<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>.
|
|
||||||
</p>
|
|
||||||
</answer>
|
|
||||||
</exercise>
|
|
||||||
|
|
||||||
<exercise>
|
|
||||||
<statement>
|
|
||||||
<p>
|
|
||||||
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.
|
|
||||||
(Pretend 5 measurements is large enough for the CLT to apply.)
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<title></title>
|
|
||||||
|
|
||||||
<tabular halign="center">
|
|
||||||
<row header="yes" bottom="minor">
|
|
||||||
<cell>plant <m>i</m></cell>
|
|
||||||
<cell>height <m>H_i</m> (in)</cell>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
|
||||||
<cell>1</cell>
|
|
||||||
<cell>15</cell>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
|
||||||
<cell>2</cell>
|
|
||||||
<cell>14</cell>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
|
||||||
<cell>3</cell>
|
|
||||||
<cell>18</cell>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
|
||||||
<cell>4</cell>
|
|
||||||
<cell>21</cell>
|
|
||||||
</row>
|
|
||||||
|
|
||||||
<row>
|
|
||||||
<cell>5</cell>
|
|
||||||
<cell>17</cell>
|
|
||||||
</row>
|
|
||||||
</tabular>
|
|
||||||
</table>
|
|
||||||
</statement>
|
|
||||||
|
|
||||||
<answer>
|
|
||||||
<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>.
|
|
||||||
</p>
|
|
||||||
</answer>
|
|
||||||
</exercise>
|
|
||||||
</exercises>
|
</exercises>
|
||||||
</section>
|
</section>
|
||||||
Reference in New Issue
Block a user