Lawfare Group → Knowledge Institute → Lawfare Academy
← CS 230 — Mathematics, Statistics and Data for AI
Weeks 9–11
Sampling, uncertainty and causal limits
Learning objectives
- Explain and trace the mechanisms in sampling, uncertainty and causal limits.
- Apply the method to the worked example and changed-condition exercise.
- Identify assumptions, failure cases and the evidence needed to justify a result.
A dataset is a sample produced by a collection process. Ask who or what could enter, what was excluded and which outcomes are missing. A survey of satisfied repeat customers cannot estimate satisfaction for all customers without strong additional assumptions. More rows reduce some sampling variation but do not automatically remove selection bias.
A sample mean summarizes observed values. Standard deviation describes dispersion of observations, while standard error describes uncertainty in an estimator under assumptions. They answer different questions. Confidence intervals depend on a sampling or model procedure; they do not guarantee that bias, measurement error or distribution shift has been addressed. Reporting many decimal places does not increase the information in the data.
Association is not causation. If trained staff have fewer errors, experience, job assignment and selection into training may explain part of the difference. A randomized intervention can strengthen causal identification, but still needs appropriate measurement, adherence and analysis. For observational data, state plausible confounders and avoid claiming that a prediction coefficient establishes the effect of changing that feature. A variable can be highly predictive yet unsuitable for intervention.
Worked reasoning The standard deviation summarizes the spread of five observations. Dividing by square root of five gives the usual independent-sample standard-error estimate for the mean. If these values are five closely related measurements from one customer, treating them as independent customers understates uncertainty. The arithmetic can be correct while the sampling interpretation is wrong.
Extended teaching and laboratory
A sample size is a count of observational units, not merely rows. Repeated observations from the same customer can share causes and outcomes. Treating them as independent customers can understate uncertainty. Define the target population, sampling unit, assignment mechanism and estimand before applying a standard error formula.
A narrow confidence interval does not repair a biased selection process. Nor does a precise association automatically estimate a causal effect. A before/after comparison may mix the intervention with seasonality or changes in customer composition.
Worked problem A service receives 100 ratings from five customers, each rating 20 visits. A report claims a sample of 100 independent customers. Diagnose the inference.
Step-by-step reasoning 1. The row count is 100 but there are five customer clusters. Ratings within a customer may be correlated.
- If the target is customer experience, first define how visits and customers are weighted. Equal visits and equal customers need not yield the same estimand.
- Use an analysis that reflects the sampling/dependence structure, or gather more independently sampled customers. A simple independent-row standard error is not justified by row count.
- Generalization also depends on who supplied ratings. Five self-selected customers may not represent the customer population even with many visits.
Apply the idea
A service receives 100 ratings from five customers, each rating 20 visits. A report claims a sample of 100 independent customers. Diagnose the inference.
Ratings improve after a new scheduling system launches in a quiet season. What evidence would strengthen a causal interpretation?
Read the worked reasoning
Use a credible comparison that separates the system from season and composition changes, such as randomized rollout when appropriate, or a justified comparison design with baseline trends and explicit assumptions. Measure the same outcome consistently. More rows can improve precision conditional on a design, but cannot by themselves identify the system’s causal effect.
Check understanding
What does adding more biased observations guarantee?
- No guarantee that selection bias disappears
Feedback
Sample size and representativeness are separate issues.
- A representative sample automatically
Feedback
A larger selected sample can preserve systematic distortion.
- A causal estimate from any correlation
Feedback
Correlation does not identify an intervention effect.
Further reading
Study the complete on-site source sections below, then work the original example, changed-condition problem and transfer laboratory. Study the statistical estimation material in Dive into Deep Learning and scikit-learn model evaluation. Review sampling assumptions and selection mechanisms before interpreting uncertainty.