Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

368 lines (337 sloc) 21.434 kB
<!DOCTYPE html>
<html data-require="math math-format word-problems stat">
<head>
<meta charset="UTF-8">
<title>Standard deviation</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="DATA_POINTS">randRange( 4, 6 )</var>
<var id="POPULATION">randRange( 20, 50 )</var>
<var id="TGT_MEAN">animalAvgLifespan( 1 )</var>
<var id="TGT_STDDEV">animalStddevLifespan( 1 )</var>
<var id="DATA">$.map( randGaussian( TGT_MEAN, TGT_STDDEV, DATA_POINTS ), function( lifespan ) {
lifespan = lifespan &lt; 1 ? 1 : round( lifespan );
return randRange( 1, lifespan );
} )</var>
<var id="MEAN">roundTo( 1, mean( DATA ) )</var>
<var id="SQR_DEV">$.map( DATA, function( x ) { return roundTo( 2, ( x - MEAN ) * ( x - MEAN ) ); })</var>
<var id="VARIANCE">roundTo( 2, sum( SQR_DEV ) / ( DATA_POINTS - 1 ) )</var>
<var id="VARIANCE_POP">roundTo( 2, sum( SQR_DEV ) / DATA_POINTS )</var>
<var id="STDDEV">roundTo( 1, stdDev( DATA ) )</var>
<var id="STDDEV_POP">roundTo( 1, stdDevPop( DATA ) )</var>
<var id="YEAR">new Plural(function(num) {
return $.ngettext("year", "years", num);
})</var>
<var id="YEARS_OLD">$._("%(years)s old", {years: plural_form(YEAR, MEAN )})</var>
<var id="YEAR_TEXT">$._("year")</var>
<var id="YEARS_TEXT">$._("years")</var>
</div> <!-- vars -->
<div class="problems">
<div id="population" data-calculator="">
<div class="problem">
<p>
You have found the following ages (in years) of all <code><var>DATA_POINTS</var></code>
<var>plural_form(animal( 1 ), DATA_POINTS)</var> at your local zoo:
</p>
<p><code>\qquad<var>DATA.join(",\\enspace ")</var></code></p>
</div>
<p class="question">
What is the average age of the <var>plural_form(animal( 1 ))</var> at your zoo? What is the standard deviation?
<em>Round your answers to the nearest tenth.</em>
</p>
<div class="solution" data-type="multiple">
<p>
Average age:<br><code>\quad</code>
<span class="sol short40" data-inexact="" data-max-error="0.15"><var>mean( DATA )</var></span> years old
</p>
<p>
Standard deviation:<br><code>\quad</code>
<span class="sol short40" data-inexact="" data-max-error="0.15"><var>stdDevPop( DATA )</var></span> years
</p>
</div> <!-- solution -->
<div class="hints">
<p data-if="isSingular(DATA_POINTS)">
Because we have data for all <var>DATA_POINTS</var> <var>animal( 1 )</var> at the zoo, we are able
to calculate the <span class="hint_blue">population mean</span>
<code>(\blue{\mu})</code> and
<span class="hint_pink">population standard deviation</span> <code>(\pink{\sigma})</code>.
</p><p data-else="">
Because we have data for all <var>DATA_POINTS</var> <var>plural_form(animal( 1 ), DATA_POINTS)</var> at the zoo, we are able
to calculate the <span class="hint_blue">population mean</span>
<code>(\blue{\mu})</code> and
<span class="hint_pink">population standard deviation</span> <code>(\pink{\sigma})</code>.
</p>
<div>
<p>
To find the <span class="hint_blue">population mean</span>, add up the values of all <code class="hint_green"><var>DATA_POINTS</var></code>
ages and divide by <code class="hint_green"><var>DATA_POINTS</var></code>.
</p>
<p>
<code>
\blue{\mu} \quad = \quad
\dfrac{\sum\limits_{i=1}^{\green{N}} x_i}{\green{N}} \quad = \quad
\dfrac{\sum\limits_{i=1}^{\green{<var>DATA_POINTS</var>}} x_i}{\green{<var>DATA_POINTS</var>}}
</code>
</p>
</div>
<p>
<code>
\blue{\mu} \quad = \quad
\dfrac{<var>plus.apply( KhanUtil, DATA )</var>}{\green{<var>DATA_POINTS</var>}} \quad = \quad
\blue{<var>MEAN</var>\text{ <var>YEARS_OLD</var>}}
</code>
</p>
<div>
<p>
Find the <span class="hint_purple">squared deviations from the mean</span> for each <var>animal(1)</var>.
</p>
<div class="fake_header">
<span style="width: 100px;">
Age<br>
<code>x_i</code>
</span><span style="width: 150px;">
<span class="hint_gray">Distance from the mean</span>
<code>(x_i - \blue{\mu})</code>
</span><span style="width: 150px;">
<code>(x_i - \blue{\mu})^2</code>
</span>
</div>
<div class="fake_row" data-each="DATA as i, POINT">
<span style="width: 100px;">
<code><var>POINT</var></code> <var>plural( "year", POINT )</var>
</span><span class="hint_gray" style="width: 150px;">
<code><var>roundTo( 2, POINT - MEAN )</var></code> <var>plural( "year", roundTo( 2, POINT - MEAN ) )</var>
</span><span class="hint_purple" style="width: 150px;">
<code><var>SQR_DEV[ i ]</var></code> <var>plural( "year", SQR_DEV[ i ] )</var><code>^2</code>
</span>
</div>
</div>
<div>
<p>
Because we used the <span class="hint_blue">population mean</span><code>(\blue{\mu})</code> to compute the
<span class="hint_purple">squared deviations from the mean</span>, we can find the <span class="hint_red">variance</span>
<code>(\red{\sigma^2})</code>, without introducing any bias, by simply averaging the
<span class="hint_purple">squared deviations from the mean</span>:
</p>
<p>
<code>
\red{\sigma^2} \quad = \quad
\dfrac{\sum\limits_{i=1}^{\green{N}} (x_i - \blue{\mu})^2}{\green{N}}
</code>
</p>
</div>
<p>
<code>
\red{\sigma^2} \quad = \quad
\dfrac{<var>plus.apply( KhanUtil, $.map( SQR_DEV, function( x ) { return "\\color{purple}{" + x + "}"; }) )</var>}
{\green{<var>DATA_POINTS</var>}}
</code>
</p>
<p>
<code>
\red{\sigma^2} \quad = \quad
\dfrac{\purple{<var>roundTo( 2, sum( SQR_DEV ) )</var>}}{\green{<var>DATA_POINTS</var>}} \quad = \quad
\red{<var>VARIANCE_POP</var>\text{ <var>plural( "year", VARIANCE_POP )</var>}^2}
</code>
</p>
<div>
<p>
As you might guess from the notation, the <span class="hint_pink">population standard deviation</span>
<code>(\pink{\sigma})</code> is found by taking the square root of the <span class="hint_red">population variance</span>
<code>(\red{\sigma^2})</code>.
</p>
<p>
<code>\pink{\sigma} = \sqrt{\red{\sigma^2}}</code>
</p>
</div>
<p>
<code>
\pink{\sigma} = \sqrt{\red{<var>VARIANCE_POP</var>\text{ <var>plural( "year", VARIANCE_POP )</var>}^2}} =
\pink{<var>STDDEV_POP</var>\text{ <var>plural( "year", STDDEV_POP )</var>}}
</code>
</p>
<p>
<span data-if="isSingular(MEAN)">The average <var>animal( 1 )</var> at the zoo is <var>MEAN</var> year old.</span><span data-else="">The average <var>animal( 1 )</var> at the zoo is <var>MEAN</var> years old.</span>
<span data-if="isSingular(STDDEV_POP)">There is a standard deviation of <var>STDDEV_POP</var> year.</span><span data-else="">There is a standard deviation of <var>STDDEV_POP</var> years.</span>
</p>
</div> <!-- hints -->
</div> <!-- population -->
<div id="sample" data-calculator="">
<div class="problem">
<p>
<span data-if="isSingular(DATA_POINTS)">
You have found the following ages (in years) of <var>DATA_POINTS</var> <var>animal(1)</var>.
</span>
<span data-else="">
You have found the following ages (in years) of <var>DATA_POINTS</var> <var>plural_form(animal(1), DATA_POINTS)</var>.
</span>
<span data-if="isSingular(POPULATION)">
Those <var>plural_form(animal(1))</var> were randomly selected from the <var>POPULATION</var> <var>animal(1)</var> at your local zoo:
</span>
<span data-else="">
Those <var>plural_form(animal(1))</var> were randomly selected from the <var>POPULATION</var> <var>plural_form(animal(1), POPULATION)</var> at your local zoo:
</span>
</p>
<p><code>\qquad<var>DATA.join(",\\enspace ")</var></code></p>
</div>
<p class="question">
Based on your sample, what is the average age of the <var>plural_form(animal( 1 ))</var>? What is the standard deviation?
<em>Round your answers to the nearest tenth.</em>
</p>
<div class="solution" data-type="multiple">
<p>
Average age:<br><code>\quad</code>
<span class="sol short40" data-inexact="" data-max-error="0.15"><var>mean( DATA )</var></span> years old
</p>
<p>
Standard deviation:<br><code>\quad</code>
<span class="sol short40" data-inexact="" data-max-error="0.15"><var>stdDev( DATA )</var></span> years
</p>
</div> <!-- solution -->
<div class="hints">
<p data-if="isSingular(POPULATION)">
Because we only have data for a small sample of the <var>POPULATION</var> <var>animal( 1 )</var>, we are only able
to estimate the population mean and standard deviation by finding the <span class="hint_blue">sample mean</span>
<code>(\blue{\overline{x}})</code> and
<span class="hint_pink">sample standard deviation</span> <code>(\pink{s})</code>.
</p><p data-else="">
Because we only have data for a small sample of the <var>POPULATION</var> <var>plural_form(animal( 1 ), POPULATION)</var>, we are only able
to estimate the population mean and standard deviation by finding the <span class="hint_blue">sample mean</span>
<code>(\blue{\overline{x}})</code> and
<span class="hint_pink">sample standard deviation</span> <code>(\pink{s})</code>.
</p>
<div>
<p>
To find the <span class="hint_blue">sample mean</span>, add up the values of all <code class="hint_green"><var>DATA_POINTS</var></code>
samples and divide by <code class="hint_green"><var>DATA_POINTS</var></code>.
</p>
<p>
<code>
\blue{\overline{x}} \quad = \quad
\dfrac{\sum\limits_{i=1}^{\green{n}} x_i}{\green{n}} \quad = \quad
\dfrac{\sum\limits_{i=1}^{\green{<var>DATA_POINTS</var>}} x_i}{\green{<var>DATA_POINTS</var>}}
</code>
</p>
</div>
<p>
<code>
\blue{\overline{x}} \quad = \quad
\dfrac{<var>plus.apply( KhanUtil, DATA )</var>}{\green{<var>DATA_POINTS</var>}} \quad = \quad
\blue{<var>MEAN</var>\text{ <var>YEARS_OLD</var>}}
</code>
</p>
<p data-if="isSingular(MEAN)">
Find the <span class="hint_purple">squared deviations from the mean</span> for each sample. Since we don't know the
population mean, estimate the mean by using the <span class="hint_blue">sample mean</span> we just calculated
<code>(\blue{\overline{x}} = \blue{<var>MEAN</var>\text{ <var>YEAR_TEXT</var>}})</code>.
</p><p data-else="">
Find the <span class="hint_purple">squared deviations from the mean</span> for each sample. Since we don't know the
population mean, estimate the mean by using the <span class="hint_blue">sample mean</span> we just calculated
<code>(\blue{\overline{x}} = \blue{<var>MEAN</var>\text{ <var>YEARS_TEXT</var>}})</code>.
</p>
<div>
<div class="fake_header">
<span style="width: 100px;">
Age<br>
<code>x_i</code>
</span><span style="width: 150px;">
<span class="hint_gray">Distance from the mean</span>
<code>(x_i - \blue{\overline{x}})</code>
</span><span style="width: 150px;">
<code>(x_i - \blue{\overline{x}})^2</code>
</span>
</div>
<div class="fake_row" data-each="DATA as i, POINT">
<span style="width: 100px;">
<code><var>POINT</var></code> <var>plural( "year", POINT )</var>
</span><span class="hint_gray" style="width: 150px;">
<code><var>roundTo( 2, POINT - MEAN )</var></code> <var>plural( "year", roundTo( 2, POINT - MEAN ) )</var>
</span><span class="hint_purple" style="width: 150px;">
<code><var>SQR_DEV[ i ]</var></code> <var>plural( "year", SQR_DEV[ i ] )</var><code>^2</code>
</span>
</div>
</div>
<div>
<p>
Normally we can find the variance <code>(\red{s^2})</code> by averaging the
<span class="hint_purple">squared deviations from the mean</span>. But remember we don't know the real
population mean—we had to estimate it by using the <span class="hint_blue">sample mean</span>.
</p>
<p>
<span data-if="isSingular(DATA_POINTS)">
The age of any particular <var>animal( 1 )</var> in our sample is likely to be closer to the average age
of the <var>DATA_POINTS</var> <var>animal( 1 )</var> we sampled.
</span>
<span data-else="">
The age of any particular <var>animal( 1 )</var> in our sample is likely to be closer to the average age
of the <var>DATA_POINTS</var> <var>plural_form(animal( 1 ), DATA_POINTS)</var> we sampled.
</span>
<span data-if="isSingular(POPULATION)">
This is compared to the average age of all <var>POPULATION</var> <var>animal( 1 )</var> in the zoo.
</span>
<span data-else="">
This is compared to the average age of all <var>POPULATION</var>
<var>plural_form(animal( 1 ), POPULATION)</var> in the zoo.
</span>
<span>
Because of that, the <span class="hint_purple">squared deviations from the mean</span> we calculated will
probably underestimate the actual deviations from the population mean.
</span>
</p>
<p>
To compensate for this underestimation, rather than simply averaging the <span class="hint_purple">squared deviations from the mean</span>,
we total them and divide by <code class="hint_green">n - 1</code>.
</p>
<p>
<code>
\red{s^2} \quad = \quad
\dfrac{\sum\limits_{i=1}^{\green{n}} (x_i - \blue{\overline{x}})^2}{\green{n - 1}}
</code>
</p>
</div>
<p>
<code>
\red{s^2} \quad = \quad
\dfrac{<var>plus.apply( KhanUtil, $.map( SQR_DEV, function( x ) { return "\\color{purple}{" + x + "}"; }) )</var>}
{\green{<var>DATA_POINTS</var> - 1}}
</code>
</p>
<p>
<code>
\red{s^2} \quad = \quad
\dfrac{\purple{<var>roundTo(2, sum( SQR_DEV))</var>}}{\green{<var>DATA_POINTS - 1</var>}} \quad = \quad
\red{<var>VARIANCE</var>\text{ <var>plural("year", VARIANCE)</var>}^2}
</code>
</p>
<div>
<p>
The sample standard deviation <code>(\pink{s})</code> is
found by taking the square root of the sample variance <code>(\red{s^2})</code>.
</p>
<p>
<code>\pink{s} = \sqrt{\red{s^2}}</code>
</p>
</div>
<p>
<code>
\pink{s} = \sqrt{\red{<var>VARIANCE</var>\text{ <var>plural("year", VARIANCE)</var>}^2}} =
\pink{<var>STDDEV</var>\text{ <var>plural("year", STDDEV)</var>}}
</code>
</p>
<p>
<span data-if="isSingular(MEAN)">
We can estimate that the average <var>animal( 1 )</var> at the zoo is <var>MEAN</var> year old.
</span>
<span data-else="">We can estimate that the average <var>animal( 1 )</var> at the zoo is <var>MEAN</var> years old.</span>
<span data-if="isSingular(STDDEV)">There is also a standard deviation of <var>STDDEV</var> year.</span>
<span data-else="">There is also a standard deviation of <var>STDDEV</var> years.</span>
</p>
</div> <!-- hints -->
</div> <!-- sample -->
</div> <!-- problems -->
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.