randRange( 4, 6 ) randRange( 20, 50 ) animalAvgLifespan( 1 ) animalStddevLifespan( 1 ) $.map( randGaussian( TGT_MEAN, TGT_STDDEV, DATA_POINTS ), function( lifespan ) { lifespan = lifespan < 1 ? 1 : round( lifespan ); return randRange( 1, lifespan ); } ) roundTo( 1, mean( DATA ) )$.map( DATA, function( x ) { return roundTo( 2, ( x - MEAN ) * ( x - MEAN ) ); }) roundTo( 2, sum( SQR_DEV ) / ( DATA_POINTS - 1 ) ) roundTo( 2, sum( SQR_DEV ) / DATA_POINTS ) roundTo( 1, stdDev( DATA ) ) roundTo( 1, stdDevPop( DATA ) )

You have found the following ages (in years) of all plural( DATA_POINTS, animal( 1 ) ) at your local zoo:

\qquadDATA.join( ",\\enspace " )

What is the average age of the plural( animal( 1 ) ) at your zoo? What is the standard deviation? You may round your answers to the nearest tenth.

Average age:
\quad mean( DATA ) years old

Standard deviation:
\quad stdDevPop( DATA ) years

decimals, like 7.5
answers within \pm 0.15 are accepted to allow for rounding part-way through

Because we have data for all plural( DATA_POINTS, animal( 1 ) ) at the zoo, we are able to calculate the population mean (\color{BLUE}{\mu}) and population standard deviation (\color{PINK}{\sigma}).

To find the population mean, add up the values of all DATA_POINTS ages and divide by DATA_POINTS.

 \color{BLUE}{\mu} \quad = \quad \dfrac{\sum\limits_{i=1}^{\color{GREEN}{N}} x_i}{\color{GREEN}{N}} \quad = \quad \dfrac{\sum\limits_{i=1}^{\color{GREEN}{DATA_POINTS}} x_i}{\color{GREEN}{DATA_POINTS}} 

 \color{BLUE}{\mu} \quad = \quad \dfrac{plus.apply( KhanUtil, DATA )}{\color{GREEN}{DATA_POINTS}} \quad = \quad \color{BLUE}{MEAN\text{ plural( "year", MEAN ) old}} 

Find the squared deviations from the mean for each animal(1).

Age
x_i
Distance from the mean (x_i - \color{BLUE}{\mu}) (x_i - \color{BLUE}{\mu})^2
POINT plural( "year", POINT ) roundTo( 2, POINT - MEAN ) plural( "year", roundTo( 2, POINT - MEAN ) ) SQR_DEV[ i ] plural( "year", SQR_DEV[ i ] )^2

Because we used the population mean(\color{BLUE}{\mu}) to compute the squared deviations from the mean, we can find the variance (\color{red}{\sigma^2}), without introducing any bias, by simply averaging the squared deviations from the mean:

 \color{red}{\sigma^2} \quad = \quad \dfrac{\sum\limits_{i=1}^{\color{GREEN}{N}} (x_i - \color{BLUE}{\mu})^2}{\color{GREEN}{N}} 

 \color{red}{\sigma^2} \quad = \quad \dfrac{plus.apply( KhanUtil, $.map( SQR_DEV, function( x ) { return "\\color{purple}{" + x + "}"; }) )} {\color{GREEN}{DATA_POINTS}}   \color{red}{\sigma^2} \quad = \quad \dfrac{\color{purple}{roundTo( 2, sum( SQR_DEV ) )}}{\color{GREEN}{DATA_POINTS}} \quad = \quad \color{red}{VARIANCE_POP\text{ plural( "year", VARIANCE_POP )}^2}  As you might guess from the notation, the population standard deviation (\color{PINK}{\sigma}) is found by taking the square root of the population variance (\color{red}{\sigma^2}). \color{PINK}{\sigma} = \sqrt{\color{red}{\sigma^2}}  \color{PINK}{\sigma} = \sqrt{\color{red}{VARIANCE_POP\text{ plural( "year", VARIANCE_POP )}^2}} = \color{PINK}{STDDEV_POP\text{ plural( "year", STDDEV_POP )}}  The average animal( 1 ) at the zoo is plural( MEAN, "year" ) old with a standard deviation of plural( STDDEV_POP, "year" ). You have found the following ages (in years) of plural( DATA_POINTS, animal( 1 ) ) randomly selected from the plural( POPULATION, animal( 1 ) ) at your local zoo: \qquadDATA.join( ",\\enspace " ) Based on your sample, what is the average age of the plural( animal( 1 ) )? What is the standard deviation? You may round your answers to the nearest tenth. Average age: \quad mean( DATA ) years old Standard deviation: \quad stdDev( DATA ) years decimals, like 0.75 answers within \pm 0.15 are accepted to allow for rounding part-way through Because we only have data for a small sample of the plural( POPULATION, animal( 1 ) ), we are only able to estimate the population mean and standard deviation by finding the sample mean (\color{BLUE}{\overline{x}}) and sample standard deviation (\color{PINK}{s}). To find the sample mean, add up the values of all DATA_POINTS samples and divide by DATA_POINTS.  \color{BLUE}{\overline{x}} \quad = \quad \dfrac{\sum\limits_{i=1}^{\color{GREEN}{n}} x_i}{\color{GREEN}{n}} \quad = \quad \dfrac{\sum\limits_{i=1}^{\color{GREEN}{DATA_POINTS}} x_i}{\color{GREEN}{DATA_POINTS}}   \color{BLUE}{\overline{x}} \quad = \quad \dfrac{plus.apply( KhanUtil, DATA )}{\color{GREEN}{DATA_POINTS}} \quad = \quad \color{BLUE}{MEAN\text{ plural( "year", MEAN ) old}}  Find the squared deviations from the mean for each sample. Since we don't know the population mean, estimate the mean by using the sample mean we just calculated (\color{BLUE}{\overline{x}} = \color{BLUE}{MEAN\text{ plural( "year", MEAN )}}). Age x_i Distance from the mean (x_i - \color{BLUE}{\overline{x}}) (x_i - \color{BLUE}{\overline{x}})^2 POINT plural( "year", POINT ) roundTo( 2, POINT - MEAN ) plural( "year", roundTo( 2, POINT - MEAN ) ) SQR_DEV[ i ] plural( "year", SQR_DEV[ i ] )^2 Normally we can find the variance (\color{red}{s^2}) by averaging the squared deviations from the mean. But remember we don't know the real population mean—we had to estimate it by using the sample mean. The age of any particular animal( 1 ) in our sample is likely to be closer to the average age of the plural( DATA_POINTS, animal( 1 ) ) we sampled than it is to the average age of all plural( POPULATION, animal( 1 ) ) in the zoo. Because of that, the squared deviations from the mean we calculated will probably underestimate the actual deviations from the population mean. To compensate for this underestimation, rather than simply averaging the squared deviations from the mean, we total them and divide by n - 1.  \color{red}{s^2} \quad = \quad \dfrac{\sum\limits_{i=1}^{\color{GREEN}{n}} (x_i - \color{BLUE}{\overline{x}})^2}{\color{GREEN}{n - 1}}   \color{red}{s^2} \quad = \quad \dfrac{plus.apply( KhanUtil,$.map( SQR_DEV, function( x ) { return "\\color{purple}{" + x + "}"; }) )} {\color{GREEN}{DATA_POINTS - 1}} 

 \color{red}{s^2} \quad = \quad \dfrac{\color{purple}{roundTo( 2, sum( SQR_DEV ) )}}{\color{GREEN}{DATA_POINTS - 1}} \quad = \quad \color{red}{VARIANCE\text{ plural( "year", VARIANCE )}^2} 

As you might guess from the notation, the sample standard deviation (\color{PINK}{s}) is found by taking the square root of the sample variance (\color{red}{s^2}).

\color{PINK}{s} = \sqrt{\color{red}{s^2}}

 \color{PINK}{s} = \sqrt{\color{red}{VARIANCE\text{ plural( "year", VARIANCE )}^2}} = \color{PINK}{STDDEV\text{ plural( "year", STDDEV )}} 

We can estimate that the average animal( 1 ) at the zoo is plural( MEAN, "year" ) old with a standard deviation of plural( STDDEV, "year" ).