Tutorials › Introduction to Statistics › Standard Deviation from a Frequency Table

Center, Spread and Position · Tutorial 161 of 996

Standard Deviation from a Frequency Table

Use each value’s frequency to calculate the mean and squared deviations, then obtain the appropriate population or sample standard deviation.

Beginner 10 min read

What You'll Learn

  • Read a frequency table as repeated observations and find its total count.
  • Calculate a weighted mean from distinct values and their frequencies.
  • Find the total squared deviation without expanding every repeated observation.
  • Choose the population or sample variance formula to match the data’s purpose.
  • Interpret variance and standard deviation using the measurement’s units.
  • Check calculations with an equivalent computational formula.

Why Frequencies Matter

A frequency table can summarize many observations in a compact form. Instead of listing every measurement, it gives each distinct value and the number of times that value occurs. To calculate a standard deviation from such a table, the key is to let each value contribute as many times as its frequency indicates. A value that occurs six times must influence the calculations six times, not once.

The calculation follows the same ideas as standard deviation from raw data: find the mean, measure each observation’s deviation from that mean, square the deviations, and average them using the appropriate denominator. The frequency table changes how these steps are organized, but not what standard deviation means.

Definition: In a frequency table, \(x_i\) denotes a distinct observed value and \(f_i\) denotes its frequency, or number of times it occurs. The total number of observations is the sum of the frequencies. A frequency table of exact values records the data without losing information: it is equivalent to a list in which each \(x_i\) is repeated \(f_i\) times.

For example, if the value 4 has frequency 3, it represents three observations equal to 4. The total number of observations is found by adding all frequencies, not by counting the number of rows. A table with four distinct values might describe dozens of observations.

Formulas for a Frequency Table

Suppose the table represents all members of the population of interest. Let \(N=\sum f_i\) be the population size. Each value contributes \(f_i\) copies to the total, so the population mean is the sum of all observations divided by \(N\). The population variance averages the squared deviations over all \(N\) observations.

$$ N=\sum_i f_i,\qquad \mu=\frac{\sum_i f_i x_i}{N},\qquad \sigma^2=\frac{\sum_i f_i(x_i-\mu)^2}{N},\qquad \sigma=\sqrt{\sigma^2}. $$

If the table instead represents a sample of \(n\) observations from a larger population, use \(\bar{x}\) for the sample mean and divide the sum of squared deviations by \(n-1\) to calculate the sample variance \(s^2\). The sample standard deviation is its square root. As in calculations from raw data, the \(n-1\) convention applies to a sample variance; it is not used when describing the variance of the complete population.

$$ n=\sum_i f_i,\qquad \bar{x}=\frac{\sum_i f_i x_i}{n},\qquad s^2=\frac{\sum_i f_i(x_i-\bar{x})^2}{n-1},\qquad s=\sqrt{s^2}. $$

The formulas require that each frequency be a nonnegative count and that the frequencies cover the observations being summarized. For a sample standard deviation, there must be at least two observations, so that \(n-1\) is positive. The choice between the population and sample formulas depends on what the table represents, not on the number of rows in the table.

Worked Examples

Worked Example: Standard Deviation for a Complete Population

A hypothetical group consists of six seedlings. Their heights, in centimeters, are summarized below. Find the population mean, variance, and standard deviation.

Height \(x_i\) (cm)Frequency \(f_i\)
11
22
32
41

Step 1: Count the observations and calculate the mean. The population contains \(N=1+2+2+1=6\) seedlings. The total of the heights is \(1(1)+2(2)+2(3)+1(4)=15\) cm, so

$$ \mu=\frac{\sum_i f_i x_i}{N} =\frac{1(1)+2(2)+2(3)+1(4)}{6} =\frac{15}{6}=2.5\text{ cm}. $$

Step 2: Calculate the weighted squared deviations. A value’s squared deviation is counted according to its frequency. For example, there are two seedlings of height 2 cm, so that squared deviation contributes twice.

$$ \sum_i f_i(x_i-\mu)^2 =1(1-2.5)^2+2(2-2.5)^2+2(3-2.5)^2+1(4-2.5)^2 =2.25+0.50+0.50+2.25=5.50\text{ cm}^2. $$

Step 3: Divide by the population size and take the square root.

$$ \sigma^2=\frac{5.50}{6}=0.9167\text{ cm}^2,\qquad \sigma=\sqrt{0.9167}=0.9574\text{ cm}. $$

The six seedlings have a mean height of 2.5 cm and a population standard deviation of about 0.9574 cm. The variance is in square centimeters, while the standard deviation is in centimeters.

Worked Example: Sample Standard Deviation from Frequencies

A hypothetical sample of six components has recorded lifetimes of 2, 4, 5, or 7 years, with frequencies shown below. Calculate the sample mean and sample standard deviation.

Lifetime \(x_i\) (years)Frequency \(f_i\)
21
42
51
72

Step 1: Find the sample size and mean. The frequencies add to \(n=1+2+1+2=6\). The sum of the six lifetimes is \(1(2)+2(4)+1(5)+2(7)=29\) years. Therefore,

$$ \bar{x}=\frac{29}{6}=4.8333\text{ years}. $$

Step 2: Calculate the sum of squared deviations. The table below displays one squared deviation for each distinct value and weights it by the corresponding frequency. Values are rounded for display; the total is calculated using the unrounded mean \(29/6\).

\(x_i\) (years)\(f_i\)\((x_i-\bar{x})^2\) (years squared)\(f_i(x_i-\bar{x})^2\) (years squared)
218.02788.0278
420.69441.3889
510.02780.0278
724.69449.3889

The weighted squared deviations sum to \(18.8333\) years squared. Since these six observations are a sample, divide by \(n-1=5\):

$$ s^2=\frac{18.8333}{6-1}=3.7667\text{ years}^2,\qquad s=\sqrt{3.7667}=1.941\text{ years}. $$

The sample mean lifetime is 4.833 years, and the sample standard deviation is about 1.941 years. Dividing by 6 instead would calculate the population variance for these six values, not the conventional sample variance.

Worked Example: Checking the Calculation with a Shortcut

A hypothetical set of six measurements, in millimeters, has three distinct values. Find the population standard deviation and use an equivalent formula to check the weighted squared deviations.

Measurement \(x_i\) (mm)Frequency \(f_i\)
102
121
153

Step 1: Calculate the mean. There are \(N=2+1+3=6\) measurements, and their total is \(2(10)+1(12)+3(15)=77\) mm. Thus \(\mu=77/6=12.8333\) mm.

Step 2: Find the squared deviations. Weighting each squared deviation by its frequency gives

$$ \sum_i f_i(x_i-\mu)^2 =2(10-12.8333)^2+1(12-12.8333)^2+3(15-12.8333)^2 =30.8333\text{ mm}^2. $$

Step 3: Calculate the population variance and standard deviation.

$$ \sigma^2=\frac{30.8333}{6}=5.1389\text{ mm}^2,\qquad \sigma=\sqrt{5.1389}=2.267\text{ mm}. $$

The calculation can be checked using the identity \(\sum_i f_i(x_i-\mu)^2=\sum_i f_i x_i^2-(\sum_i f_i x_i)^2/N\). Here, \(\sum_i f_i x_i^2=2(10^2)+1(12^2)+3(15^2)=1019\text{ mm}^2\), so

$$ 1019-\frac{77^2}{6}=1019-\frac{5929}{6}=30.8333\text{ mm}^2, $$

which agrees with the direct calculation. The standard deviation is about 2.267 mm.

Why the Shortcut Works

The computational identity is useful when the mean has many decimal places. It follows by expanding the square and using the fact that the weighted deviations from the mean sum to zero. For a table with \(n=\sum_i f_i\), expand each squared deviation:

$$ \begin{aligned} \sum_i f_i(x_i-\bar{x})^2 &=\sum_i f_i(x_i^2-2x_i\bar{x}+\bar{x}^2)\\ &=\sum_i f_i x_i^2-2\bar{x}\sum_i f_i x_i+\bar{x}^2\sum_i f_i. \end{aligned} $$

By the definition of the weighted sample mean, \(\sum_i f_i x_i=n\bar{x}\), and by the definition of the total frequency, \(\sum_i f_i=n\). Substituting both equalities gives

$$ \sum_i f_i(x_i-\bar{x})^2 =\sum_i f_i x_i^2-2n\bar{x}^2+n\bar{x}^2 =\sum_i f_i x_i^2-n\bar{x}^2 =\sum_i f_i x_i^2-\frac{(\sum_i f_i x_i)^2}{n}. $$

The same argument applies to a population by replacing \(n\) and \(\bar{x}\) with \(N\) and \(\mu\). This identity calculates the same sum of squared deviations as the direct method; it does not change whether the final variance divides by \(n-1\) or by \(N\).

Common Mistakes and Practical Checks

Frequency tables are compact, but overlooking what the frequencies represent can change a result substantially. Check that the number of observations used in the mean, squared deviations, and denominator is consistent with the table and with whether the data are a sample or a population.

  • Counting rows instead of observations. A table with four rows and frequencies \(1,2,2,1\) has six observations, not four. Add the frequencies to get the total count.
  • Ignoring the frequencies. Averaging the distinct values once each treats every row as equally common. In the weighted mean and squared-deviation sum, multiply each contribution by its frequency.
  • Using the wrong denominator. Divide the population squared-deviation sum by \(N\), and divide a sample squared-deviation sum by \(n-1\). Identify what the data represent before choosing.
  • Reporting variance in the original units. Variance is measured in squared units, such as \(\text{cm}^2\). The standard deviation is the square root of variance and is measured in the original units.
  • Rounding too early. Keep the mean unrounded while calculating squared deviations, then round the final results. Early rounding can make the two calculation methods disagree slightly.

A frequency table with distinct exact values contains the same information as the expanded list, so its mean and standard deviation should match calculations from that list. This equivalence is a useful check: imagine repeating each value according to its frequency and confirm that the weighted calculation accounts for every repetition.

Key takeaway: Add the frequencies to find the number of observations, use each frequency to weight both the value and its squared deviation, and then apply the population or sample denominator that matches the data. Take the square root of the variance to return to the original measurement units.

Check Your Understanding

Use the frequency table carefully: frequencies count observations, not rows.

  1. A table gives values 3 and 6 with frequencies 2 and 4. How many observations does it represent, and what weighted sum is used to find its mean?
  2. Explain why the term for value \(x_i\) in the squared-deviation sum is \(f_i(x_i-\bar{x})^2\), rather than just \((x_i-\bar{x})^2\).
  3. A frequency table summarizes every item in a small collection. Should its variance be divided by the number of items or by one less than that number? Explain.
  4. For a sample frequency table with six observations, what denominator is used to calculate \(s^2\)?
  5. If a variable is measured in minutes, what are the units of its variance and standard deviation?