1. Home
  2. Explore
  3. Statistics
  4. Introduction to Statistics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to Statistics

Statistics: Learning Probability Models from Data

1. Probability and statistics: two complementary directions

Probability begins with a model and predicts what data might be observed. The model may specify a random variable, its probability distribution, and parameters that determine the distribution. The central question is: If the model is correct, what outcomes are likely?

Statistics begins with observed data and uses it to learn about the model. The central question is: Given the outcomes that were observed, what can be inferred about the underlying process?

For example:

  • In a probability problem, a coin’s probability of landing heads is known, and the task is to predict the distribution of heads in a sequence of flips.

  • In a statistics problem, the results of the flips are known, and the task is to estimate the coin’s probability of landing heads or determine whether the coin appears fair.

The two fields are closely connected. Probability supplies the mathematical tools for describing uncertainty, while statistics uses those tools to make estimates, predictions, decisions, and tests from data. Statistical methods are also fundamental to modern machine learning, where models are learned from measured or collected data.

A probability model might describe a random variable XXX using parameters θ\thetaθ. Probability studies the distribution of XXX when θ\thetaθ is known. Statistics uses observed values of XXX to infer the unknown parameters or assess the model.

Probability: known model, uncertain data.
Statistics: known data, uncertain model.


2. Statistics and complex real-world data

Classical probability models—such as the normal, exponential, and Poisson distributions—are useful in many applications. However, real-world data may not follow a convenient distribution with a simple, closed-form expression. In such situations, the distribution may need to be learned or approximated from data.

This is one reason statistical methods are central to data science and machine learning:

  • Data provides evidence about a system.

  • Statistical methods extract patterns and quantify uncertainty in that evidence.

  • Machine-learning methods can fit models even when the underlying probability distributions are complicated or unknown in advance.

The aim is not limited to finding a single best prediction. Statistical analysis can also describe how uncertain an estimate is, assess whether an observed effect is plausible, and help design future measurements.


3. Survey sampling and inference about a population

Survey sampling uses a relatively small sample to learn about a larger population. For example, researchers might survey a subset of voters to estimate the preferences of all voters, or measure a sample of people to estimate a population characteristic such as average height.

The central questions are:

  • What does the sample suggest about the population?

  • How much uncertainty is there in the estimate?

  • How large must the sample be to achieve a desired level of precision?

3.1 The sample mean

Suppose a sample contains nnn observations, X1,X2,…,XnX_1, X_2, \ldots, X_nX1​,X2​,…,Xn​. The sample mean is the average of those observations:

Xˉ=1n∑i=1nXi\bar{X} = \frac{1}{n}\sum_{i=1}^{n} X_iXˉ=n1​∑i=1n​Xi​

The sample mean is used to estimate the population mean, usually denoted by μ\muμ. A sample mean is itself a random variable: different samples from the same population will generally produce different averages.

If the observations are independent and drawn from a population with mean μ\muμ and variance σ2\sigma^2σ2, then the sample mean has mean μ\muμ and variance:

Var⁡(Xˉ)=σ2n\operatorname{Var}(\bar{X}) = \frac{\sigma^2}{n}Var(Xˉ)=nσ2​

Its standard deviation, called the standard error of the sample mean, is therefore:

σn\frac{\sigma}{\sqrt{n}}n​σ​

As the sample size increases, the sample mean typically varies less from sample to sample. This makes larger samples useful for obtaining more precise estimates, though they also require more time, resources, or data collection.

3.2 The central limit theorem

The central limit theorem (CLT) explains why sample means are so useful. Under appropriate conditions—commonly, independent observations from the same distribution with finite variance—the distribution of the sample mean becomes approximately normal as the sample size grows:

Xˉ≈N(μ,σ2n)\bar{X} \approx \mathcal{N}\left(\mu, \frac{\sigma^2}{n}\right)Xˉ≈N(μ,nσ2​)

This approximation can hold even when the original population is not normally distributed. The theorem therefore connects data from a broad range of population distributions to a common, tractable model for sample averages.

The CLT supports:

  • Estimating population means from samples.

  • Quantifying the uncertainty of a sample mean.

  • Constructing confidence intervals and conducting tests.

  • Planning sample sizes to achieve a desired degree of precision.

For example, if a study needs a more precise estimate of a population average, increasing nnn reduces the variance of the sample mean. The CLT does not say that the original data become normally distributed; it describes the distribution of the sample mean across repeated samples.


4. Hypothesis testing

Hypothesis testing uses data to assess a claim about a population, a probability model, or a difference between groups. The claim is expressed as a hypothesis, and the data are evaluated under assumptions about what would happen if that hypothesis were true.

Common applications include:

  • Determining whether a drug has an effect.

  • Assessing whether a marketing change increases website traffic.

  • Comparing two populations or two distributions.

  • Evaluating whether a material or process meets a performance standard.

4.1 Control and treatment groups

A common experimental comparison uses:

  • A control group, which does not receive the intervention or receives a reference treatment.

  • A treatment group, which receives the intervention being studied.

If the groups differ in an outcome such as a measured mean, the difference may provide evidence of an effect. However, the comparison must be designed carefully: a difference can arise from the intervention, random variation, or other differences between the groups.

In website experiments, for example, A/B testing compares two versions of a page or feature. Users are assigned to versions, and a measurable outcome—such as the rate of clicking on an item—is compared.

4.2 Comparing distributions

Some questions concern the full distributions of two data sets rather than only their means. For example, researchers may ask whether two observed samples could plausibly come from the same underlying distribution.

A chi-square test is one family of methods used to test hypotheses about categorical data or distributions of counts. It compares observed counts with the counts expected under a specified hypothesis. The test’s usefulness depends on whether its assumptions are appropriate for the data.

More generally, hypothesis tests translate a claim into a probabilistic comparison: they assess how compatible the observed data are with a model in which the claim is true.

4.3 Statistical significance and the ppp-value

A hypothesis test often produces a ppp-value. Under a specified null hypothesis and the test’s assumptions, the ppp-value is the probability of obtaining a test statistic at least as extreme as the one observed.

A small ppp-value indicates that the observed data would be unusual if the null hypothesis and assumptions were correct. Researchers may compare it with a chosen significance level, often denoted by α\alphaα.

A ppp-value does not directly give:

  • The probability that the null hypothesis is true.

  • The probability that the research conclusion is correct.

  • The probability that a result will replicate.

  • The size or practical importance of an effect.

For example, a ppp-value below 0.050.050.05 is often called statistically significant when the test uses α=0.05\alpha = 0.05α=0.05. It does not mean there is a 95%95\%95% chance that the alternative claim is true. Statistical significance should be interpreted alongside the study design, the assumptions, the effect size, uncertainty intervals, and the practical importance of the result.


5. Experimental design and the risks of poor analysis

Experimental design is the planning of how data will be collected and analyzed so that a question can be answered reliably. A well-designed experiment specifies what will be measured, how participants or units will be assigned, which comparisons will be made, and which analyses will be used.

Careful design matters in fields such as medicine, engineering, and product development. For instance, a trial of a new drug or material must collect relevant data in a way that permits a fair assessment of safety and effectiveness. Poorly collected or selectively analyzed data can make an apparent effect misleading.

5.1 Why design and analysis choices matter

A statistically significant result can arise from an analysis that was not planned or interpreted appropriately. One danger is ppp-hacking: making repeated or selective analysis choices until a statistically significant result appears. This can happen through deliberate manipulation or through misunderstandings about statistical analysis.

Examples of risky practices include:

  • Trying many outcomes or subgroup comparisons, then reporting only those that are significant.

  • Repeatedly checking results and stopping data collection when a desired result appears.

  • Choosing an analysis after examining which approach gives the strongest evidence.

  • Failing to account for the number of comparisons being made.

When many analyses are attempted, some may produce small ppp-values by chance, even if no real effect exists. Good practice therefore requires transparent reporting, appropriate experimental controls, and analysis methods that account for how the data were collected and how many comparisons were made.


6. Fitting distributions and estimating parameters

A central statistical task is to find a probability model that describes observed data and estimate the model’s unknown parameters. If a model describes a random variable XXX using parameters θ\thetaθ, then probability considers the distribution of XXX given θ\thetaθ. Statistics uses the observed data to estimate θ\thetaθ or compare possible models.

For example, a normal distribution has a mean and variance as parameters. Given measurements, a statistician may estimate those parameters and assess how well the normal model describes the observations.

6.1 Method of moments

The method of moments estimates model parameters by matching moments of the observed data to the corresponding moments implied by the model. Moments include quantities such as the mean and variance.

In practice, this often means calculating sample statistics—such as the sample mean—and setting them equal to their theoretical counterparts to solve for unknown parameters. The method is often relatively direct, though the resulting estimates are not necessarily the most statistically efficient or appropriate for every model.

6.2 Maximum likelihood estimation

Maximum likelihood estimation (MLE) selects parameter values that make the observed data most plausible under the assumed model. The likelihood is the probability of the observed data viewed as a function of the unknown parameters.

For observations x1,…,xnx_1,\ldots,x_nx1​,…,xn​ and a model with density or probability mass function f(x∣θ)f(x \mid \theta)f(x∣θ), the likelihood is:

L(θ)=∏i=1nf(xi∣θ)L(\theta) = \prod_{i=1}^{n} f(x_i \mid \theta)L(θ)=∏i=1n​f(xi​∣θ)

The maximum-likelihood estimate is the value of θ\thetaθ that maximizes this likelihood:

θ^MLE=arg⁡max⁡θL(θ)\hat{\theta}_{\mathrm{MLE}} = \arg\max_{\theta} L(\theta)θ^MLE​=argmaxθ​L(θ)

In many settings, maximizing the likelihood is equivalent to minimizing a loss or objective function. This connection makes MLE compatible with optimization methods used in machine learning. MLE is widely used, but its performance depends on the model assumptions and the available data.

6.3 Goodness of fit

After fitting a model, a goodness-of-fit analysis asks how well the fitted model describes the data. A model may produce estimated parameters yet still represent the data poorly.

Useful questions include:

  • Are the observed data consistent with the fitted distribution?

  • Do residual patterns suggest systematic model errors?

  • Are there observations or features the model fails to explain?

  • Does the model fit the data well enough for the intended purpose?

Goodness of fit and hypothesis testing are related because both compare observed data with what a model predicts. However, a good fit to the observed data does not automatically guarantee accurate predictions on new data.


7. Confidence intervals and uncertainty in estimates

A parameter estimate such as θ^\hat{\theta}θ^ is not usually known with certainty. A confidence interval gives a range of values produced by a statistical procedure designed to capture the unknown parameter at a specified long-run rate.

For example, a 95%95\%95% confidence procedure produces intervals that include the true parameter in about 95%95\%95% of repeated studies conducted under the procedure’s assumptions. In frequentist statistics, after a particular interval has been calculated, the parameter is treated as fixed; the interval either contains it or does not. A confidence interval is not, by itself, a statement that there is a 95%95\%95% probability that the fixed parameter lies in that specific interval.

Confidence intervals are useful because they communicate uncertainty more fully than a single estimate. They can help distinguish:

  • An estimate that is precise from one that is highly uncertain.

  • A small effect from a potentially substantial effect.

  • Statistical evidence from practical importance.

The width and interpretation of an interval depend on the data, the statistical method, and its assumptions.


8. Bootstrapping and Monte Carlo simulation

Some statistical quantities are difficult to calculate analytically. For instance, the sampling variability of a complicated estimator may not have a convenient mathematical expression. In such cases, computational methods can approximate the uncertainty.

8.1 Bootstrapping

Bootstrapping is a resampling method that uses the observed data to approximate how an estimate would vary across repeated samples. In a common bootstrap procedure:

  1. Begin with the observed sample.

  2. Draw a new sample of the same size by sampling from the observed data with replacement.

  3. Recalculate the statistic or parameter estimate.

  4. Repeat the resampling many times.

  5. Use the resulting estimates to approximate the sampling distribution and uncertainty.

The bootstrap is valuable when a theoretical formula for uncertainty is unavailable or difficult to derive. Its reliability still depends on whether the observed data provide a suitable representation of the population and whether the resampling procedure matches the sampling design.

8.2 Monte Carlo simulation

Monte Carlo simulation uses repeated random draws to approximate quantities of interest. It can be used to estimate probabilities, explore the behavior of an estimator, or approximate the distribution of an uncertain parameter.

Bootstrapping is one form of simulation-based statistical reasoning, though the two terms are not identical: bootstrapping specifically resamples observed data, while Monte Carlo methods more broadly use repeated random sampling from a chosen model or procedure.

These methods extend statistical analysis to complex problems where direct calculations are impractical. They are especially useful when models are complicated, data are abundant, or analytic formulas are unavailable.


9. Bayesian statistics and prior information

Bayesian statistics combines observed data with prior information to produce updated beliefs about unknown quantities. A prior distribution represents information or assumptions about a parameter before the current data are considered. The data then update that prior to form a posterior distribution.

Bayes’ rule expresses this relationship:

p(θ∣data)=p(data∣θ) p(θ)p(data)p(\theta \mid \text{data}) = \frac{p(\text{data} \mid \theta)\,p(\theta)} {p(\text{data})}p(θ∣data)=p(data)p(data∣θ)p(θ)​

Here, p(θ)p(\theta)p(θ) is the prior distribution, p(data∣θ)p(\text{data} \mid \theta)p(data∣θ) is the likelihood, and p(θ∣data)p(\theta \mid \text{data})p(θ∣data) is the posterior distribution. The posterior represents the updated uncertainty about θ\thetaθ after observing the data.

Bayesian analysis can incorporate relevant knowledge about a system—for example, established scientific knowledge, constraints on possible parameter values, or prior measurements. It is particularly useful when prior information is important or when the analysis needs a full probability distribution over unknown quantities.

The quality of a Bayesian analysis depends partly on the prior. A well-justified prior can stabilize estimates when data are limited; a poorly chosen prior can distort conclusions. Priors and their effects should therefore be considered and communicated carefully.

9.1 A coin-flipping example

Let θ\thetaθ denote the probability that a coin lands heads. If θ\thetaθ is known, probability theory can describe the results of a sequence of flips. For example, the number of heads in nnn independent flips follows a binomial distribution.

Statistics reverses the direction: after observing the flips, it estimates θ\thetaθ or assesses whether the coin is consistent with being fair. A few heads in a row are not enough to establish that a coin always lands heads. The interpretation depends on the amount of data and on assumptions about plausible values of θ\thetaθ.

A Bayesian analysis can express prior information about the coin—such as the belief that an ordinary coin is probably close to fair—and update that belief as evidence accumulates. Strong evidence, such as a long and highly unusual sequence of flips, can substantially change the posterior belief. The prior should inform the analysis without preventing the data from changing the conclusion.


10. Connections to machine learning and advanced statistical topics

Modern machine learning can be viewed as fitting models to empirical data. Data provide an empirical basis for estimating distributions, relationships, or predictive rules. When the model is highly flexible or the distribution has no convenient closed-form expression, computational methods become especially important.

Several connected areas extend the foundations of statistics:

  • Markov chains model processes in which the next state depends on the current state, rather than on the entire history.

  • Random walks describe sequences of random steps and provide a basic model for stochastic movement and cumulative random change.

  • Gaussian processes provide probability models over functions and can represent uncertainty about an unknown function.

  • Stochastic differential equations model systems that evolve continuously while being affected by random variation.

  • Monte Carlo optimization and Bayesian computation use simulation and numerical methods to analyze models that are difficult to handle analytically.

  • Benford’s law describes a pattern in the leading digits of certain naturally occurring data sets and can be used in statistical analysis of numerical data.

These topics connect probability, statistics, computation, and modeling. Together, they provide tools for reasoning about real systems whose behavior is complex, uncertain, or only partially understood.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent