Skip to main content

Section 8.5 Standard Error

To quantify the width of the sampling distribution, one option is to compute its standard deviation -- the result is called the standard error.
Listing 8.5.1. Python Code
$ standard_error = np.std(sample_means)
standard_error
np.float64(0.04626531069684985)
In this case, the standard error is about 0.045 kg -- so if we collect many samples, we expect the sample means to vary by about 0.045 kg, on average.
People often confuse standard error and standard deviation. Remember:
In this dataset, the standard deviation of penguin weights is about 0.38 kg for chinstrap penguins.
Listing 8.5.2. Python Code
$ np.std(weights)
np.float64(0.3814986213564681)
The standard error of the average weight is about 0.046 kg.
Listing 8.5.3. Python Code
$ np.std(sample_means)
np.float64(0.04626531069684985)
Standard deviation tells you how much penguins differ in weight. Standard error tells you how precise an estimate is. They are answers to different questions.
However, there is a relationship between them. If we know the standard deviation and sample size, we can approximate the standard error of the means like this:
Listing 8.5.4. Python Code
def approximate_standard_error(sample):
    n = len(sample)
    return np.std(sample) / np.sqrt(n)
Listing 8.5.5. Python Code
$ approximate_standard_error(weights)
np.float64(0.046263503290595163)
This result is close to what we got by resampling.