This unit of the Data Science collection is the applied introduction to probability and statistics: what each tool computes, the library defaults that change its answer, and simulations that check a method against a population whose answers are known. It is the working layer. The definitions and proofs live in the Applied Statistics course pages and the Statistics collection, and every article names the exact page and result it relies on rather than proving it again.
The unit follows the order in which an analysis meets the subject. It starts with how data are collected, because the collection decides which questions a dataset can answer. It then summarizes the data, states the rules of probability and the named distributions that model data, and ends with inference: turning one sample into an interval or a test with a stated error rate.
One dataset runs through the unit: the adults examined by the National Health and Nutrition Examination Survey (NHANES) in 2017 and 2018, about 5,500 people with blood pressures, body measurements, laboratory values and the survey's own weights and design variables. Most articles treat the 5,182 adults with a usable blood pressure as a finite population, so that a sample's answer can be compared with the truth. Every number on these pages is computed by a script in tools/experiments/data-science/, which downloads the public files and checks their hashes, and the library behavior described is dated by the versions it was run on (NumPy, pandas, SciPy and statsmodels, rerun on 23 November 2026). Each article ends with worked problems that extend it on the same data and with open questions an experiment could settle.
What it assumes. Basic Python and pandas, as in the collection's Python for Data Science articles, and school algebra. No prior statistics is assumed; the theory pages linked from each article assume more.
Articles
Read in order; each article builds on the ones before it.
- Data Collection and Sampling: how the way data are gathered decides what they can say. Populations, frames and samples; observational studies against randomized experiments, with a useless treatment made to look effective by self-selection; simple random, stratified, systematic and cluster sampling compared by simulation; NHANES's four-stage design, why its unweighted hypertension prevalence of 54.7% becomes the published 48.2% when weighted, and design-based standard errors by Taylor linearization and the jackknife; nonresponse and the 1936 Literary Digest poll.
- Summarizing Data with pandas: what
describe()reports and leaves out, and the defaults that change a summary. The divisor of the standard deviation across libraries, nine quantile definitions with a proof of how their interquartile ranges are ordered, skewness and kurtosis with and without bias adjustment, the rules for missing values, pairwise deletion in correlations, and grouped and weighted summaries. - Probability Fundamentals: probability as a share of a table. Events as Boolean masks and the missing-value trap, the addition rule, independence and conditional probability checked by counting, Bayes' theorem reproducing a direct count, and simulation with NumPy's Generator, from seeding to the birthday problem and the Monte Carlo error that makes rare events expensive.
- Probability Distributions in SciPy: the named distributions as
scipy.statsobjects. What each method computes, thelocandscaleconvention,sfagainst1 - cdfin the far tail, a normal model for men's heights that fits, and prescription counts that a Poisson model misses and a negative binomial, derived as a gamma mixture, nearly fits. - Inferential Statistics in Python: from a sample to a statement about a population. Standard errors checked against the known population, confidence intervals from scipy and statsmodels and the defaults behind them, coverage that falls to 79% for a skewed mean, p-values and permutation tests, and multiple testing with the false discovery rate.
- Inference for Proportions and Means: the four standard comparisons, one and two proportions and one and two means, and where the libraries' defaults part ways. Wald, score and exact tests for a proportion with their true error rates, Wilson's interval as the inverted score test, the pooled test against Welch's, paired data analyzed as independent, and a difference that is highly significant and practically small.
Where the rest of the site goes deeper
The Applied Statistics course pages give the definitions and derivations at the level of these articles, starting with Descriptive Statistics, Probability, Theoretical Probability Distributions, Sampling Distributions, Confidence Intervals, Hypothesis Testing, Comparison of Two Means and Inference on Proportions.
The Statistics collection proves the general results. Probability Theory covers distribution functions, expectation, the laws of large numbers and the central limit theorem with a full proof. Likelihood and Estimation treats maximum likelihood and the likelihood ratio, Wald and score tests. Study Design, Sampling and Causal Inference proves the survey designs and weights of the first article and what randomization guarantees. Resampling Methods covers the bootstrap, permutation tests and the jackknife, and Multiple Testing the false discovery rate and closed testing. For counts that vary more than the Poisson model allows, Generalized Linear Models has overdispersion and quasi-likelihood.
Within Data Science, the next unit, Regression in Practice, applies these tools to models of how an outcome depends on inputs. The open questions on these pages point to subjects the site does not yet treat in depth, among them small-sample quantile estimation, L-moments and zero-inflated count models.
References
Each article lists its own references. The data: record
- National Center for Health Statistics (2020). National Health and Nutrition Examination Survey 2017–2018 data files and documentation. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/nchs/nhanes/continuousnhanes/default.aspx?BeginYear=2017 record · 109 pages
- National Center for Health Statistics (2018). National Health and Nutrition Examination Survey: Analytic Guidelines, 2011–2014 and 2015–2016. Centers for Disease Control and Prevention. https://wwwn.cdc.gov/nchs/data/nhanes/analyticguidelines/11-16-analytic-guidelines.pdf record · 4 pages