Quantitative Methods
Quantitative methods are essential for those working in mathematical biology, doing epidemiology, and designing experiments (from basic bench experiments to large field experiments) – especially as part of the modern practice of these fields. The best way to learn these skills is through constant exposure and solving practical problems.
Here we collate a collection of bite-sized references covering the calculus, linear algebra, probability, and statistics that underpin quantitative work in infectious disease ecology, evolution, and epidemiology. Each page pairs the core idea and notation with a worked example and runnable code in R, Python, and Julia for simulation and mostly importantly, intuition. Note that many of these came from years of notes, but some are created with the assistance of LLMs. Let us know if you spot any errors. Furthermore, many of the posts taken on strong opinions regarding the use of particular methods. These are tools and as such there are often many different ways of applying tools to problems (e.g., two carpenters with the same tools may approach building a cabinet in very different ways using different sets of tools).
Math is hard. It requires practice and repetition.
Foundations & notation#
- The Language of Mathematics — number systems, symbols, and how to read an equation
- Mathematical Notation — symbols, sums, products, and LaTeX
- Functions and Graphs — common functions and how to plot them
- Exponentials and Logarithms — rules, the number , and log identities
Working with data#
- Manipulating Data Frames — dplyr, data.table, pandas, Polars, and DataFrames.jl
- Graphing Data — matching charts and designing figures to questions and the grammar of graphics
Sequences, series & limits#
- Sequences — notation, monotonicity, and boundedness
- Limits — convergence, properties, and L’Hôpital’s rule
- Series — arithmetic, geometric, and power series
- Taylor and Maclaurin Series — polynomial approximation to functions
Differentiation#
- Derivatives — the instantaneous rate of change
- Common Derivatives — a reference table
- Product Rule
- Quotient Rule
- Chain Rule
- Partial Derivatives
- The Gradient
Integration#
- Integrals — area under a curve and the Fundamental Theorem
- Common Integrals — a reference table
- u-Substitution
- Integration by Parts
- Lebesgue Integration — slicing the range, integrating against any measure, and a mixed continuous-plus-atomic force of infection
Optimization#
- Optimization and Critical Points — maxima, minima, and convexity
Convexity & inequalities#
- Jensen’s Inequality and Nonlinear Averaging – how you have to make sure you know what you are averaging
- The Legendre Transform — convex conjugates
Linear algebra#
- Matrix and Vector Notation
- Matrix Operations
- Inverse, Determinant, and Rank
- Eigenvalues and Eigenvectors
- Jacobians
Probability & statistics#
- Statistical Inference — population, parameter, sample, estimate
- Probability Basics
- Random Variables — pmf, pdf, and the CDF
- Common Distributions: An Overview
- Normal · Binomial · Poisson · Exponential · t
- Expected Value
- Moment Generating Functions
- Measures of Center — mean, median, quantiles
- Measures of Variability — variance, SD, standard error
- Sampling Distributions
- The Law of Large Numbers
- The Central Limit Theorem
- Markov Chains — transition matrices and stationary distributions
- Branching Processes — Galton–Watson, extinction, and outbreaks
- Superspreading and Transmission Heterogeneity — the offspring distribution, the dispersion , and the 20/80 rule
- Chain-Binomial Models and the Household Secondary Attack Rate — Reed-Frost transmission and household final size
- Random Walks and Brownian Motion — diffusive scaling and the Wiener process
- Quasi-Stationary Distributions — the endemic level before fade-out, and persistence as an eigenvalue
- Fourier and Spectral Analysis — decomposing a signal into frequencies and finding periodicity with the periodogram
- Wavelet Analysis — time-resolved periodicity for non-stationary signals, the scalogram, and wavelet coherence
- Copulas — separating dependence from the marginals via Sklar’s theorem
- Maximum Likelihood Estimation
- Kullback–Leibler Divergence — relative entropy, cross-entropy, and forward vs reverse KL
- Moment Matching — method of moments and distributional approximation
- Monotonic Transformations
- Hypothesis Testing
- p-values
- Type M and Type S Errors — design analysis beyond power: the exaggeration ratio and sign-error rate of significant estimates
- Confidence Intervals
- Permutation Tests
- Diagnostic Testing and Screening — sensitivity, specificity, PPV, and ROC
- Bland–Altman Agreement — comparing two measurement methods by bias and limits of agreement, not correlation
- Dilutions, Titers, and Standard Curves — turning an assay readout into a concentration: serial-dilution titers and standard-curve interpolation
- Proper Scoring Rules — Brier, log score, CRPS, and forecast calibration
Regression & generalized linear models#
- Linear Regression
- Logistic Regression
- Proportional Odds Models — ordinal outcomes, and how they relate to logistic and survival regression
- Generalized Linear Models — GLMs and Poisson regression
- Splines and Penalized Regression — B-splines, restricted cubic splines, penalized/thin-plate smooths (Wood, Harrell)
- Contrasts and Average Marginal Effects — turning link-scale coefficients into risk differences and effects on the outcome scale
- Age, Period, and Cohort Effects — separating birth-cohort effects from age and calendar-time trends in risk models
- Hierarchical (Multilevel) Models — partial pooling and shrinkage
- Multilevel Regression and Poststratification — small-area estimation from non-representative surveys
Bayesian inference#
- Bayesian Inference — priors, likelihood, and the posterior
- Markov Chain Monte Carlo
- The Kalman Filter — the linear-Gaussian predict/update recursion, time-varying transmission, and fusing wastewater with case reports
- State-Space Models and Particle Filtering — partially observed Markov processes and the bootstrap particle filter
- POMP Models and Plug-and-Play Inference — iterated filtering, particle MCMC, and synthetic likelihood behind the
pomppackage - Hidden Markov Models — discrete latent regimes via the forward, Viterbi, and Baum-Welch algorithms
- Approximate Bayesian Computation — likelihood-free inference by simulation, for models you can run but not write down
- Prior Predictive Checks — simulate from the prior to sanity-check it before fitting
- Posterior Predictive Checks — compare replicated data to the observed to test the model
- Identifiability — when data cannot separate parameters
Gaussian processes & spatial statistics#
Gaussian processes:
- Gaussian Processes — distributions over functions and GP regression
- Covariance Functions and the Matérn Family — kernels, smoothness, and lengthscale
- Hilbert-Space Approximations for Gaussian Processes — fast basis-function GPs
Geostatistics & areal models:
- Kriging and Geostatistics — variograms and best linear unbiased prediction
- Spatial Point Processes — Poisson, Cox, and log-Gaussian Cox processes
- Areal Models: CAR, ICAR, and BYM — disease mapping on a neighborhood graph
- Bayesian Spatial Models with INLA — fast latent-Gaussian inference and the SPDE approach
- Distances on a Sphere: Haversine and Beyond — great-circle vs Euclidean distance
- Spatial Cluster Detection — Moran’s I, LISA, and the spatial scan statistic
- Spatiotemporal Models — separable and nonseparable space–time covariance
Survival analysis#
- Survival Analysis — Kaplan–Meier, hazards, censoring
- Cox Proportional Hazards Regression
- Competing Risks — cause-specific vs subdistribution hazards, cumulative incidence, and the 1−KM trap
Experimental & study design#
- Experimental Design — experimental vs observational, sources of bias
- Factorial Designs — main effects and interactions
- Fractional Factorial Designs — partial designs, aliasing, resolution
- Optimal Experimental Design — D-, A-, and I-optimality
- Response Surface Methodology — optimizing over continuous factors
- Latin Hypercube Sampling — space-filling designs for computer experiments
- Analysis of Variance — partitioning variation into between- and within-group parts, the F-test
- Split-Plot Designs — whole-plot and sub-plot factors, two error strata
- Repeated Measures Designs — same subjects over conditions, within-subject correlation
- Crossover Designs — every subject gets every treatment; washout and carryover
- Stepped-Wedge Designs — staggered cluster rollout, separating effect from time trend
- Balanced Incomplete Block Designs — when a block cannot hold every treatment, keeping pairs balanced
- Latin Square Designs — controlling two blocking factors at once in a t×t layout
- Meta-Analysis — pooling effects and prevalence across studies, heterogeneity and a Bayesian I²
- Meta-Regression — explaining between-study heterogeneity with study-level covariates
- Publication Bias and Small-Study Effects — funnel plots, Egger’s test, and trim-and-fill
- Diagnostic Test Accuracy Meta-Analysis — pooling sensitivity and specificity with the bivariate/HSROC model
- Global Sensitivity Analysis — Sobol indices and Morris screening
- Survey Sampling — SRS, stratified, cluster, and weighting
- Bayesian Bandits for Adaptive Sampling and Trial Design — Thompson sampling to shift a testing budget toward the positive sites, and response-adaptive clinical trials
- Capture-Recapture and Multiplier Methods — estimating a population’s true size from overlapping incomplete lists
Causal inference#
- Causal Inference — confounding, counterfactuals, and Simpson’s paradox
- Propensity Scores — the balancing score, and matching, stratification, and weighting on it
- Inverse Probability Weighting — reweighting to a pseudo-population, stabilized weights, and marginal structural models
- G-Estimation — structural nested models and the g-methods for time-varying confounding
- Matching Methods — exact, propensity-score, and coarsened exact matching, with balance diagnostics
- E-Values and Unmeasured Confounding — how strong a hidden confounder would need to be to explain away a result
- Instrumental Variables — estimating causal effects under confounding
- Mendelian Randomization — genetic variants as instruments
Statistical & population genetics#
Population-genetics foundations:
- Hardy–Weinberg Equilibrium — genotype frequencies and the χ² test
- Linkage Disequilibrium — , , and
- Genetic Drift and the Wright–Fisher Model
- Selection and Mutation–Selection Balance
- Population Structure and F_ST
- Phylogenetic Inference: Substitution Models and Tree Building — from sequences to a tree, with IQ-TREE and BEAST
- The Coalescent — genealogies backward in time
- Phylodynamics — reading epidemic dynamics from pathogen phylogenies
Association & complex traits:
- Genome-Wide Association Studies
- Multiple Testing and False Discovery Rate
- Population Stratification and PCA Control
- Heritability and Variance Components
- Quantitative Genetics and the Breeder’s Equation
- Polygenic Scores
Molecular evolution:
- Detecting Selection with dN/dS
- The Molecular Clock and Phylodynamics
- Quasispecies and the Error Threshold — the mutant cloud, error catastrophe, and lethal mutagenesis
Evolutionary dynamics#
- Evolutionary Game Theory — ESS and replicator dynamics
- The Evolution of Cooperation — the Prisoner’s Dilemma and Nowak’s five rules
- Kin Selection and Inclusive Fitness — Hamilton’s rule derived from the Price equation
- Adaptive Dynamics and the Evolution of Virulence
- The Price Equation and Evolutionary Epidemiology — selection, transmission, and within-host change as an exact identity
- Adaptive Dynamics — invasion fitness, singular strategies, and evolutionary branching
- The Evolution of Resistance — selection under drug pressure and the cost of resistance
- Life-History Theory — trade-offs, age at maturity, and evolutionary demography
Population & community ecology#
Single-species dynamics:
- Exponential and Logistic Growth
- Discrete-Time Models and the Logistic Map
- Structured Population Models — Leslie matrices
- Reproductive Value and Demographic Sensitivity — the left eigenvector and where interventions move growth most
- Metapopulations and the Levins Model – models considering more than patch or population and their interactions
- Asynchrony and the Inflationary Effect — how spatiotemporal variation and dispersal inflate abundance, persistence, and can increase infection
- Source–Sink Dynamics — BIDE bookkeeping and why abundance misleads
- Spatial Synchrony and the Moran Effect — dispersal, correlated noise, and traveling waves
Species interactions & stability:
- Lotka–Volterra Predator–Prey Dynamics - the basis of many models in ecology and infectious diseases
- Functional Responses and the Paradox of Enrichment — Holling types and enrichment-driven cycles
- Competition and Coexistence
- Modern Coexistence Theory and the Storage Effect — stabilizing niche vs fitness differences
- The Community Matrix and Stability
Species distributions & niche modeling:
- Species Distribution Models: Presence-Only Data — background points and the Maxent / Poisson point-process view
- Species Distribution Models: Presence–Absence Data — logistic occurrence models, AUC, and the detection/occupancy caveat
Biodiversity & community structure:
- Diversity Indices — Shannon, Simpson, Hill numbers
- Species-Abundance Distributions and Neutral Theory
Dynamical-systems & epidemic-dynamics toolkit:
- Equilibria and Linear Stability — nullclines and phase planes
- Floquet Theory and the Stability of Periodic Systems — the monodromy matrix, Floquet multipliers, and stability of periodic orbits and forced equilibria
- Bifurcations — thresholds and tipping points
- Critical Transitions and Early-Warning Signals — rising variance and autocorrelation before a tipping point
- The Next-Generation Matrix and R₀
Spatial dynamics & pattern formation:
- Spatial Diffusion and the Heat Equation — random movement and spreading
- Reaction–Diffusion and Spatial Spread — the Fisher–KPP wave
- Metapopulation Networks and the Invasion Threshold — mobility, degree heterogeneity, and global invasion
- Turing Patterns — diffusion-driven pattern formation
- Spatial Moment Equations — mean density and spatial covariance from a stochastic individual-based model
Networks#
- Networks and Graphs — adjacency matrices, degree, and structure
- Centrality and Node Importance — degree, betweenness, eigenvector centrality
- Random-Graph Models — Erdős–Rényi, scale-free, small-world
- Networks in Ecology and Epidemiology — food webs and transmission networks
- Graph Neural Networks — learning on contact and mobility graphs by message passing
Machine learning & AI#
Foundations & core architectures:
- Overfitting, Regularization, and Cross-Validation — the bias–variance tradeoff, validation, k-fold CV, and L1/L2 penalties
- Tree Ensembles: Random Forests and Gradient Boosting — the workhorse models for tabular prediction, and feature importance
- Neural Networks and the Multilayer Perceptron — neurons, activations, backpropagation, and the curved boundaries depth buys
- Recurrent Networks and LSTMs — hidden state, why plain RNNs forget, gated memory, and case-count forecasting
- Convolutional Networks and Image Identification — learned filters, feature maps, transfer learning, and skin-lesion classification
- Graph Neural Networks — message passing on contact and mobility graphs, and the GCN layer
- Transformers and Attention — self-attention, multi-head attention, and the architecture behind foundation models
- Dimensionality Reduction and Embeddings — PCA, t-SNE, and UMAP for visualizing and compressing high-dimensional data
- Clustering and Unsupervised Learning — k-means, Gaussian mixtures, hierarchical, and density-based clustering
Generative models & Bayesian deep learning:
- Variational Autoencoders — encoder/decoder, the ELBO, the reparameterization trick, and surveillance anomaly detection
- Encoding Spatial Priors with VAEs (PriorVAE) — amortizing a slow spatial prior into a decoder for fast Bayesian disease mapping
- Deep Learning, Foundation Models, and Agentic AI — the architecture family, attention and transformers, and language-model agents in outbreak analytics
Trust, uncertainty & interpretability:
- Model Interpretability and SHAP — explaining predictions with Shapley values, permutation importance, and partial dependence
- Uncertainty, Calibration, and Conformal Prediction — aleatoric vs epistemic uncertainty, reliability diagrams, and distribution-free prediction sets
Applications:
- Scientific Machine Learning: Neural ODEs and Physics-Informed Networks — differentiable simulation, learning unknown dynamics, and embedding known ODEs as constraints
- Remote Sensing, Object Counting, and Outbreak Detection — counting cars in a hospital parking deck as a proxy signal, and the assumptions that make or break it
Pharmacokinetics & pharmacodynamics#
- Pharmacokinetics: Compartment Models — ADME, clearance, half-life, AUC
- Pharmacodynamics: Dose–Response — the Emax/Hill model
- Antimicrobial PK/PD — minimum inhibatory concentration (MIC) and the PK/PD indices
- PK/PD Target Attainment — probability of target attainment and dose selection
Epidemic modeling#
- Compartmental Models — the SIR model and
- Final Size, Herd Immunity, and Overshoot — the final size relation, the herd immunity threshold, and epidemic overshoot
- Density-Dependent and Frequency-Dependent Transmission — how the contact rate scales with host density, and the critical density threshold
- SEIR and Compartmental Extensions — latent classes, waning, demography
- Social Contact Matrices and Age-Structured Mixing — who-meets-whom by age, from contact surveys to
- Serocatalytic Models — estimating the force of infection from age–seroprevalence surveys
- Within-Host Dynamics and the Immune Response — virus, infected cells, and B-cell/T-cell immunity
- Burst Size, Latent Period, and Mutation at the Cellular Scale — the cell-level viral life history: , continuous-vs-burst extinction, the optimal lysis time, and the mutational output
- Vector-Borne Disease Models — the Ross–Macdonald framework
- Vectorial Capacity from Field Data — estimating biting rate, survival, EIR, and vectorial capacity from entomological collections
- Insecticide-Resistance Monitoring — diagnostic-dose classification, LC50/LC90, and the resistance ratio
- Reservoir Ecology — maintenance hosts, spillover, and multi-host persistence
- Stochastic Epidemics and the Gillespie Algorithm
- Quasi-Stationary Distributions — endemic persistence, fade-out, and the mean time to extinction
- Queueing Theory and ICU Colonization — patients through beds as a queue, a birth-death model of hospital colonization, and pricing out infection-prevention practices
- The Effective Reproduction Number and Forecasting
- The Renewal Equation — linking incidence, the generation interval, and
- Population Dynamics of Resistance — two-strain competition and the treatment threshold
- Antimicrobial Resistance Across Scales — the individual-versus-population tension, competitive release, and a nested malaria model joining within- and between-host dynamics
- Behavior–Disease Coupled Models — prevalence-dependent behavior and the feedback between action and transmission
- Climate Forcing in Transmission Models — seasonal forcing, temperature-dependent parameters, and resonance
- Fitting Dynamic Models to Data — calibration and identifiability
Health economics & decision analysis#
- Cost-Effectiveness Analysis — costs, QALYs and DALYs, the ICER, and the willingness-to-pay threshold