You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.4 KiB

None <html lang="en"> <head> </head>

Sampling variability

We create population (known distribution), then repeatedly take random samples and computes the sample mean. Then, we compare how variability changes for different sample sizes (n).

In [3]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
rng = np.random.default_rng(7)
population = rng.lognormal(mean=1.0, sigma=0.6, size=200_000)
popMu = population.mean()
popSD = population.std(ddof=0)
popMu, popSD
Out[3]:
(np.float64(3.2549582990800525), np.float64(2.13814149865377))
</html>