๐ฒData Science Statistics
Key Concepts in Inferential Statistics
Study smarter with Fiveable
Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.
Why This Matters
Inferential statistics is the bridge between your sample data and the broader population you actually care about. Every time you see a poll's "margin of error," read about a drug trial's results, or encounter a claim that one algorithm outperforms another, you're seeing inferential statistics at work. In data science and statistics courses, you're constantly being tested on your ability to quantify uncertainty, compare groups rigorously, and draw defensible conclusions from limited data.
These concepts form an interconnected toolkit, not a list of isolated techniques. Hypothesis testing and confidence intervals are two sides of the same coin. Point estimation feeds into maximum likelihood, which connects to Bayesian inference. Understanding these relationships is what separates memorization from mastery. For each method, know when to use it, what assumptions it requires, and how it relates to the others.
Estimation: From Sample to Population
Before you can test anything, you need to estimate population parameters from your sample. These methods answer a fundamental question: given what I observed, what can I infer about the true underlying value?
Point Estimation
A point estimate is your single "best guess" for a population parameter. For example, the sample mean estimates the population mean , and the sample proportion estimates the population proportion .
- Common estimators include the sample mean, sample proportion, and sample variance, each targeting its population counterpart
- Desirable properties of estimators: unbiasedness (the expected value of the estimator equals the parameter), consistency (accuracy improves as grows), and efficiency (smallest variance among unbiased estimators)
- Limitation: a point estimate alone tells you nothing about how confident you should be in that number
Confidence Intervals
A confidence interval (CI) provides a range of plausible values for a parameter, built around a point estimate. The general form is:
- Correct interpretation: a 95% CI means that if you repeated the sampling process many times, about 95% of the resulting intervals would contain the true parameter. The parameter is fixed; it's the interval that varies across samples.
- Width reflects precision. Narrower intervals come from larger sample sizes, lower variability, or a lower confidence level (e.g., 90% vs. 99%).
- Common mistake: saying "there's a 95% probability the parameter is in this interval." That's a Bayesian credible interval interpretation, not a frequentist CI.
Maximum Likelihood Estimation
Maximum likelihood estimation (MLE) finds the parameter values that make your observed data most probable. You write a likelihood function and find the that maximizes it (often by maximizing the log-likelihood instead, since it's easier to work with).
- Asymptotically optimal: for large samples, MLEs are consistent, efficient, and approximately normally distributed
- Foundation for advanced models: logistic regression, generalized linear models (GLMs), and survival analysis all rely on MLE under the hood
Compare: Point Estimation vs. Confidence Intervals: both estimate population parameters, but point estimates give a single value while CIs quantify the uncertainty around that estimate. If you're asked to interpret a CI, remember it's about the procedure's reliability across repeated samples, not the probability that the parameter falls in one specific interval.
Hypothesis Testing Framework
Hypothesis testing formalizes the process of using data to make decisions. The core logic: assume nothing interesting is happening (null hypothesis), then ask whether your data are surprising enough to reject that assumption.
Hypothesis Testing
The process follows a consistent structure:
- State hypotheses. represents "no effect" or "no difference"; is what you're trying to find evidence for.
- Choose a significance level (typically 0.05). This is the maximum Type I error rate (false positive) you'll tolerate.
- Compute a test statistic from your data and find the corresponding p-value.
- Make a decision. If , reject . If , fail to reject .
The p-value is the probability of observing data this extreme or more extreme, assuming is true. A small p-value means your data would be unlikely under the null, which is evidence against it. A large p-value does not prove is true; it just means you lack sufficient evidence to reject it.
Two types of errors to track:
- Type I error (): rejecting when it's actually true (false positive)
- Type II error (): failing to reject when it's actually false (false negative)
Power Analysis
Statistical power () is the probability of correctly rejecting when a real effect exists. Power analysis is typically done before collecting data to determine how large your sample needs to be.
- Four linked quantities: effect size, , sample size , and power. Fix any three and the fourth is determined.
- Typical target: power of 0.80 (80% chance of detecting a true effect)
- Why it matters: an underpowered study wastes resources because it's unlikely to detect the effect you're looking for, even if it's real
Effect Size Estimation
Statistical significance alone doesn't tell you whether an effect is meaningful. Effect size quantifies the magnitude of a difference or relationship.
- Cohen's measures the standardized mean difference: . Benchmarks: 0.2 = small, 0.5 = medium, 0.8 = large.
- (coefficient of determination) measures the proportion of variance explained by a model.
- serves a similar role in ANOVA contexts.
A tiny effect can be statistically significant with a large enough . Always report and consider effect sizes alongside p-values.
Compare: p-values vs. Effect Sizes: p-values tell you whether an effect is likely real, while effect sizes tell you whether it's practically meaningful. A study with might find for a negligible difference. When interpreting results, address both.
Comparing Groups: Tests for Means and Variances
When you need to determine whether groups differ, these tests provide the statistical machinery. The choice of test depends on how many groups you're comparing, whether data are paired, and what assumptions you can justify.
t-Tests
The t-test compares means when the population standard deviation is unknown (which is almost always the case in practice).
- Independent-samples t-test: compares means of two separate groups (e.g., treatment vs. control)
- Paired t-test: compares means from matched or repeated measurements on the same subjects (e.g., before vs. after)
- Test statistic: , which measures how many standard errors apart the two means are
- Assumptions: independence of observations, approximate normality (relaxed for large by the Central Limit Theorem), and equal variances for the standard version. Welch's t-test is the safer default because it doesn't assume equal variances.
z-Tests
The z-test is used when the population standard deviation is known or when is large enough that the normal approximation applies (common for proportions).
- Test statistic:
- Most common use: testing hypotheses about proportions, where
- As , the t-distribution approaches the standard normal, so t-tests and z-tests converge for large samples
Analysis of Variance (ANOVA)
ANOVA compares means across three or more groups simultaneously, avoiding the inflated Type I error that comes from running multiple t-tests.
- F-statistic: , the ratio of between-group variance to within-group variance. A large means groups differ more than you'd expect from random variation alone.
- Assumptions: normality within groups, independence, and homogeneity of variances (check with Levene's test)
- ANOVA only tells you that at least one group differs. To find which groups differ, use post-hoc tests like Tukey's HSD or Bonferroni correction.
F-Tests
The F-test compares two variances by taking their ratio. It's the engine behind ANOVA and also tests overall significance in regression.
- In ANOVA: the F-statistic tests whether any group means differ
- In regression: the F-test checks whether the model as a whole explains significant variance in the outcome
- Sensitive to non-normality: violations of the normality assumption affect F-tests more than they affect t-tests
Compare: t-Test vs. ANOVA: both compare means, but t-tests handle exactly two groups while ANOVA handles three or more. Running multiple t-tests (e.g., six pairwise comparisons for four groups) inflates your false positive rate well beyond . ANOVA controls this with a single omnibus test, then you follow up with post-hoc tests to pinpoint which groups differ.
Categorical Data and Associations
Not all data are continuous. When you're working with counts, categories, or proportions, chi-square methods test for relationships and goodness of fit. The core idea: compare what you observed to what you'd expect if variables were independent.
Chi-Square Tests
The chi-square test compares observed frequencies to expected frequencies using the statistic:
Large values mean the observed data deviate substantially from what's expected.
Two main applications:
- Goodness-of-fit test: does your data match a hypothesized distribution? (e.g., are die rolls uniformly distributed?)
- Test of independence: are two categorical variables related? (e.g., is there an association between gender and product preference?)
Assumptions: observations are independent, and expected cell counts should generally be at least 5. For small expected counts, consider Fisher's exact test instead.
Compare: Chi-Square vs. t-Test: chi-square tests work with categorical data and frequencies, while t-tests require a continuous outcome variable. If your dependent variable is "pass/fail" or "category A/B/C," use chi-square. If it's a measurement like height or test score, use a t-test.
Modeling Relationships
Regression methods go beyond "is there a difference?" to ask "how are variables related, and can we predict outcomes?" These techniques model the functional form of relationships and quantify how predictors influence responses.
Regression Analysis
The general linear regression model is , where represents random error.
- Coefficient interpretation: is the expected change in for a one-unit increase in , holding other predictors constant (in multiple regression)
- Inference on coefficients: t-tests assess whether individual ; the overall F-test assesses whether the model as a whole is significant
- Logistic regression extends this framework to binary outcomes by modeling the log-odds:
- Key assumptions for linear regression: linearity, independence of errors, constant variance of errors (homoscedasticity), and normality of errors
Compare: ANOVA vs. Regression: these are mathematically equivalent for comparing group means (ANOVA is just regression with dummy-coded categorical predictors). Regression extends naturally to continuous predictors and more complex models. Use ANOVA language for experimental designs with categorical factors, and regression language for predictive modeling with continuous or mixed predictors.
Alternative Inference Frameworks
Classical frequentist methods aren't the only approach. These alternatives either relax distributional assumptions or incorporate prior knowledge, expanding your inferential toolkit.
Bayesian Inference
Bayesian inference updates prior beliefs with observed data using Bayes' theorem:
- Prior encodes what you believed about the parameter before seeing data
- Likelihood is the same likelihood function used in MLE
- Posterior is your updated belief after incorporating the data
- The posterior distribution gives full probability statements about parameters, not just point estimates. A 95% credible interval means there's a 95% probability the parameter lies within that range (contrast this with the frequentist CI interpretation).
Non-parametric Tests
Non-parametric tests don't assume a specific distribution (like normality) for the data. They typically work with ranks rather than raw values.
- Mann-Whitney U: alternative to the independent-samples t-test
- Wilcoxon signed-rank: alternative to the paired t-test
- Kruskal-Wallis: alternative to one-way ANOVA
- Trade-off: these tests are robust under violated assumptions but have less statistical power than their parametric counterparts when the assumptions are met
Bootstrapping
Bootstrapping estimates the sampling distribution of a statistic by resampling with replacement from your original data, typically thousands of times.
- Draw a sample of size (with replacement) from your original data.
- Compute the statistic of interest (mean, median, ratio, etc.) for that resample.
- Repeat steps 1-2 many times (e.g., 10,000 iterations).
- Use the distribution of resampled statistics to estimate standard errors and construct confidence intervals.
This approach is especially valuable when theoretical formulas for standard errors don't exist or when the sampling distribution is hard to derive analytically (e.g., for medians, correlation coefficients, or custom statistics).
Compare: Frequentist vs. Bayesian: frequentists treat parameters as fixed and data as random; Bayesians treat parameters as random variables with distributions. A frequentist 95% CI says "95% of intervals constructed this way would contain the true value." A Bayesian 95% credible interval says "there's a 95% probability the parameter lies in this range." Know which framework a problem assumes, because the interpretation changes.
Quick Reference Table
| Concept | Best Examples |
|---|---|
| Point vs. Interval Estimation | Point Estimation, Confidence Intervals, MLE |
| Testing Framework | Hypothesis Testing, Power Analysis, Effect Size |
| Comparing Two Means | t-Tests, z-Tests |
| Comparing 3+ Means | ANOVA, F-Tests |
| Categorical Data | Chi-Square Tests |
| Modeling Relationships | Regression Analysis |
| Distribution-Free Methods | Non-parametric Tests, Bootstrapping |
| Incorporating Prior Knowledge | Bayesian Inference |
Self-Check Questions
-
What's the key difference between a confidence interval and a Bayesian credible interval, and when would you prefer one over the other?
-
You're comparing customer satisfaction scores across four different product versions. Which test should you use, and why would running six separate t-tests be problematic?
-
How do maximum likelihood estimation and Bayesian inference differ in their treatment of parameters? What additional input does Bayesian inference require?
-
Your data are heavily skewed and your sample size is only 15. Which methods from this guide would still be valid, and which would you avoid?
-
A study reports but Cohen's . Explain what this combination tells you about the results and what you'd want to know about the study design.