How to Calculate Standard Deviation

Answer: The standard deviation is the square root of the variance — it measures how spread out numbers are. Compute it by finding the mean, squaring each deviation from the mean, averaging those squares (use $N$ for a full population or $n-1$ for a sample), then taking the square root.

Explanation

  • Use the population formulas when you have data for the entire population.
  • Use the sample formulas (divide by $n-1$) when your data is a sample and you want an unbiased estimator of the population variance.

Formulas

Population variance and standard deviation:
$$\sigma^2 = \frac{1}{N}\sum_{i=1}^N (x_i-\mu)^2$$
$$\sigma = \sqrt{\sigma^2}$$

Sample variance and standard deviation:
$$s^2 = \frac{1}{n-1}\sum_{i=1}^n (x_i-\bar{x})^2$$
$$s = \sqrt{s^2}$$

Steps (practical)

  1. Compute the mean: $ \mu = \frac{1}{N}\sum x_i$ (or $\bar{x}$ for a sample).
  2. For each data point compute the deviation: $x_i – \mu$.
  3. Square each deviation: $(x_i-\mu)^2$.
  4. Sum the squared deviations: $\sum (x_i-\mu)^2$.
  5. Divide by $N$ (population) or $n-1$ (sample) to get variance.
  6. Take the square root to get standard deviation.

Worked example

Data: 2, 4, 4, 4, 5 (here treat as population)

  1. Mean: $\mu = \frac{2+4+4+4+5}{5} = 3.8$
  2. Squared deviations: $(2-3.8)^2=3.24$, $(4-3.8)^2=0.04$ (three times), $(5-3.8)^2=1.44$
  3. Sum: $3.24+0.04+0.04+0.04+1.44=4.8$
  4. Population variance: $\sigma^2 = \frac{4.8}{5}=0.96$
  5. Population standard deviation: $\sigma=\sqrt{0.96}\approx0.98$

If treated as a sample:

  • Sample variance: $s^2=\frac{4.8}{5-1}=1.20$
  • Sample standard deviation: $s=\sqrt{1.20}\approx1.10$

Quick notes

  • Units: SD has same units as the original data.
  • Use $n-1$ (Bessel’s correction) for samples to correct bias.
  • Outliers strongly affect SD because of squaring deviations.

Calculator / software

  • Excel: STDEV.P(range) for population, STDEV.S(range) for sample.
  • Python (numpy): np.std(data, ddof=0) for population, np.std(data, ddof=1) for sample.

Example Python:

import numpy as np
data = np.array([2,4,4,4,5])
pop_sd = np.std(data, ddof=0)   # population
sample_sd = np.std(data, ddof=1) # sample

If you want, I can show this with your specific dataset or demonstrate step-by-step on a new example.

Related

Which of the following statements is true? If more than one statement is true, identify all the statements which are true. [ 1 point for identifying all true statements, ‐ 0 . 5 points for choosing a wrong combination even if some of the statements chosen are true, 0 points for not answering ] ( i ) An all ‐ pass filter passes through all frequencies unchanged, but can change the phase of the signal ( ii ) If the FIR filter coefficients are symmetric, then it has linear phase ( iii ) FIR filter is computationally more efficient than an IIR filter of comparable performance ( iv ) A filter that does not operate in real ‐ time can be non ‐ causal

A game is said to be fair if the expected value (after considering the cost) is 0. This means that in the long run, both the player and the “house” would expect to win nothing. If the value is positive, the game is in your favor. If the value is negative, the game is not in your favor. At a carnival, you pay $1 to choose a card from a standard deck. If you choose a red card, you double your money, but if you pick a black card, you do not get any. (A standard deck of cards has 52 cards. 26 of the cards are red.)

Calculating tax incidence Suppose that the U.S. government decides to charge cola consumers a tax. Before the tax, 10,000 cases of cola were sold every week at a price of $5 per case. After the tax, 3,000 cases of cola are sold every week; consumers pay $8 per case (including the tax), and producers receive $3 per case. 1) The amount of the tax on a case of cola is $??? per case. 2) Of this amount, the burden that falls on consumers is $??? per case, and the burden that falls on producers is ???$ per case. 3) True or False: The effect of the tax on the quantity sold would have been the same as if the tax had been levied on producers. True/ False