Variance and standard deviation

Statistical Thinking in Python (Part 1)

Justin Bois

Teaching Professor at the California Institute of Technology

2008 US swing state election results

ch2-3_v2.003.png

1 Data retrieved from Data.gov (https://www.data.gov/)
Statistical Thinking in Python (Part 1)

Variance

  • The mean squared distance of the data from their mean
  • Informally, a measure of the spread of data
Statistical Thinking in Python (Part 1)

2008 Florida election results

ch2-3_v2.007.png

1 Data retrieved from Data.gov (https://www.data.gov/)
Statistical Thinking in Python (Part 1)

2008 Florida election results

ch2-3_v2.008.png

$$variance = \frac{1}{n}\sum_{i=1}^{n}(x_i - \bar{x})^2$$

1 Data retrieved from Data.gov (https://www.data.gov/)
Statistical Thinking in Python (Part 1)

Computing the variance

np.var(dem_share_FL)
147.44278618846064
Statistical Thinking in Python (Part 1)

Computing the standard deviation

np.std(dem_share_FL)
12.142602117687158
np.sqrt(np.var(dem_share_FL))
12.142602117687158
Statistical Thinking in Python (Part 1)

2008 Florida election results

ch2-3_v2.013.png

1 Data retrieved from Data.gov (https://www.data.gov/)
Statistical Thinking in Python (Part 1)

Let's practice!

Statistical Thinking in Python (Part 1)

Preparing Video For Download...