import numpy as np
We randomly split a sample into two parts and check whether their respective arithmetic means deviate by more than one standard deviation from each other. The chance for this two happen appears to be independent of the distribution from which the original samples are drawn.
= np.random.default_rng(0)
rng
for distribution in (rng.normal, rng.uniform, rng.exponential):
= rng.uniform(size=20)
x
= []
deltas = 10000
ntry for itry in range(ntry):
rng.shuffle(x)= x[:int(len(x) / 2) ]
a = x[int(len(x) / 2):]
b = np.mean(a)
ma = np.mean(b)
mb = np.var(a) / len(a)
va = np.var(b) / len(b)
vb = va + vb
v - mb) / v ** 0.5)
deltas.append((ma = np.array(deltas)
deltas
print(distribution.__name__, "fraction with < 1 sigma deviation", np.sum(deltas < 1) / len(deltas))
normal fraction with < 1 sigma deviation 0.8255
uniform fraction with < 1 sigma deviation 0.8238
exponential fraction with < 1 sigma deviation 0.8281