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( 2, mean( DATA ) ) $.map( DATA, function( x ) { return roundTo( 2, ( x - MEAN ) * ( x - MEAN ) ); }) sum(SQR_DEV) / (DATA_POINTS - 1) sum(SQR_DEV) / DATA_POINTS new Plural(function(num) { return i18n.ngettext("year", "years", num); }) i18n._("%(years)s old", {years: plural_form(YEAR, MEAN)}) i18n._("year") i18n._("years")

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

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

What is the average age of the plural_form(animal( 1 )) at your zoo? What is the variance?
Round your answers to the nearest tenth.

Average age:
\quad mean(DATA) years old

Variance:
\quad VARIANCE_POP years^2

Because we have data for all DATA_POINTS plural_form(animal( 1 ), DATA_POINTS) at the zoo, we are able to calculate the population mean (\blue{\mu}) and population variance (\red{\sigma^2}).

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

\blue{\mu} \quad = \quad \dfrac{\sum\limits_{i=1}^{\green{N}} x_i}{\green{N}} \quad = \quad \dfrac{\sum\limits_{i=1}^{\green{DATA_POINTS}} x_i}{\green{DATA_POINTS}}

\blue{\mu} \quad = \quad \dfrac{plus.apply( KhanUtil, DATA )}{\green{DATA_POINTS}} \quad = \quad \blue{MEAN\text{ YEARS_OLD}}

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

Age
x_i
Distance from the mean (x_i - \blue{\mu}) (x_i - \blue{\mu})^2
POINT plural_form(YEAR, POINT ) roundTo( 2, POINT - MEAN ) plural_form(YEAR, roundTo( 2, POINT - MEAN ) ) SQR_DEV[ i ] plural_form(YEAR, SQR_DEV[ i ] )^2

Because we used the population mean (\blue{\mu}) to compute the squared deviations from the mean, we can find the population 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}^{\green{N}} (x_i - \blue{\mu})^2}{\green{N}}

\color{red}{\sigma^2} \quad = \quad \dfrac{plus.apply( KhanUtil, $.map( SQR_DEV, function( x ) { return "\\color{purple}{" + x + "}"; }) )} {\green{DATA_POINTS}}

\color{red}{\sigma^2} \quad = \quad \dfrac{\color{purple}{roundTo( 2, sum( SQR_DEV ) )}}{\green{DATA_POINTS}} \quad = \quad \color{red}{roundTo(2, VARIANCE_POP)\text{ plural_form(YEAR, VARIANCE_POP )}^2}

The average animal( 1 ) at the zoo is roundTo(1, MEAN) year old. The average animal( 1 ) at the zoo is roundTo(1, MEAN) years old. The population variance is roundTo(1, VARIANCE_POP) year^2. The population variance is roundTo(1, VARIANCE_POP) years^2.

You have found the following ages (in years) of DATA_POINTS plural_form(animal( 1 ), DATA_POINTS). The plural_form(animal( 1 )) are randomly selected from the POPULATION plural_form(animal( 1 ), POPULATION) at your local zoo:

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

Based on your sample, what is the average age of the plural_form(animal( 1 ))? What is the estimated variance of the ages?
You may round your answers to the nearest tenth.

Average age:
\quad mean(DATA) years old

Variance:
\quad sum(SQR_DEV) / (DATA_POINTS - 1) years^2

Because we only have data for a small sample of the POPULATION plural_form(animal(1), POPULATION), we are only able to estimate the population mean and variance by finding the sample mean (\blue{\overline{x}}) and sample variance (\red{s^2}).

To find the sample mean, add up the values of all DATA_POINTS samples and divide by DATA_POINTS.

\blue{\overline{x}} \quad = \quad \dfrac{\sum\limits_{i=1}^{\green{n}} x_i}{\green{n}} \quad = \quad \dfrac{\sum\limits_{i=1}^{\green{DATA_POINTS}} x_i}{\green{DATA_POINTS}}

\blue{\overline{x}} \quad = \quad \dfrac{plus.apply( KhanUtil, DATA )}{\green{DATA_POINTS}} \quad = \quad \blue{MEAN\text{ YEARS_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 (\blue{\overline{x}} = \blue{MEAN\text{ YEAR_TEXT}}).

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 (\blue{\overline{x}} = \blue{MEAN\text{ YEARS_TEXT}}).

Age
x_i
Distance from the mean (x_i - \blue{\overline{x}}) (x_i - \blue{\overline{x}})^2
POINT plural_form(YEAR, POINT ) roundTo( 2, POINT - MEAN ) plural_form(YEAR, roundTo( 2, POINT - MEAN ) ) SQR_DEV[ i ] plural_form(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 animal( 1 ) in our sample is likely to be closer to the average of the DATA_POINTS plural_form(animal( 1 ), DATA_POINTS) we looked at instead of the average of all the plural_form(animal( 1 ), POPULATION) 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}^{\green{n}} (x_i - \blue{\overline{x}})^2}{\green{n - 1}}

\color{red}{s^2} \quad = \quad \dfrac{plus.apply( KhanUtil, $.map( SQR_DEV, function( x ) { return "\\color{purple}{" + x + "}"; }) )} {\green{DATA_POINTS - 1}}

\color{red}{s^2} \quad = \quad \dfrac{\color{purple}{roundTo( 2, sum( SQR_DEV ) )}}{\green{DATA_POINTS - 1}} \quad = \quad \color{red}{roundTo(2, VARIANCE)\text{ plural_form(YEAR, VARIANCE )}^2}

We can estimate that the average animal(1) at the zoo is roundTo(1, MEAN) year old. We can estimate that the average animal(1) at the zoo is roundTo(1, MEAN) years old. The estimated variance of the plural_form(animal( 1 ), DATA_POINTS) is roundTo(1, VARIANCE) year^2. The estimated variance of the plural_form(animal( 1 ), DATA_POINTS) is roundTo(1, VARIANCE) years^2.