bhylu.com

Advertisements

AI Descriptive Statistics

Summarise centre and variability without hiding the sample size.

How it works

Mean and median describe different aspects of a numeric sample. Variance measures squared deviations and standard deviation returns to the original units. Population and sample variance use different denominators. Describe which one you mean and keep the count visible. A tiny fictional sample cannot establish the behaviour of a whole service.

Run the code

Try in playground loads this complete standard-library Python example without executing it. Choose Run when ready. Local review uses Python 3.12.14; the existing browser editor uses Pyodide 0.27.7. These small fictional examples need no account, external data, model-provider key or database service.

Download the complete statistics.py

Example

statistics.py

from statistics import mean, median, pvariance, variance

minutes = [4, 6, 8, 10]
print("count:", len(minutes))
print(f"mean={mean(minutes):.2f}, median={median(minutes):.2f}")
print(f"population variance={pvariance(minutes):.2f}")
print(f"sample variance={variance(minutes):.2f}")

Expected result

count: 4
mean=7.00, median=7.00
population variance=5.00
sample variance=6.67

The population calculation divides by four; the sample calculation divides by three. Neither number explains why the sessions differed. Before choosing a model, inspect missing values, outliers, units and whether records refer to independent sessions.

Technical references