Standard deviation (SD, σ) is a measure of spread (or dispersion) of data. High standard deviation tells that data points are spread more above and below the mean.

I’ve edited an image from SlidePlay (Standard Error for AP Biology) where you can see a left image with a bigger standard deviation.

Bigger SD on the left, smaller SD on the right

In statistics, it depends if you have data about the whole population or if you just have a sample. You can also do tweaks depending on your sample size (if you have less than 10 data points).

I’ll use an estimator commonly known as the sample standard deviation.

Sample SD formula

Ruby code is pretty much simple: