## Standard error

While the standard deviation measures the amount of variation there is within a sample, the standard error measures the amount of variation there is between the means of samples taken from the same population.

### Note

The standard error is the standard deviation of the distribution of the sample means.

We have calculated the standard error of dwell time empirically by looking at the previous 6 months of data. But there is an equation that allows us to calculate it from only a single sample:

Here, *Ïƒ _{x}* is the standard deviation and

*n*is the sample size. This is unlike the descriptive statistics that we studied in the previous chapter. While they described a single sample, the standard error attempts to describe a property of samples in generalâ€”the amount of variation in the sample means that variations can be expected for samples of a given size:

(defn standard-deviation [xs] (Math/sqrt (variance xs))) (defn standard-error [xs] (/ (standard-deviation xs) (Math/sqrt (count xs...