slides EN

Table of contents

  1. Applications of Statistics (D0O70A)
  2. Linear regression
  3. Estimation
  4. Finite sample properties
  5. Large sample or asymptotic properties
  6. Goodness–of–fit
  7. Hypothesis testing
  8. Prediction
  9. Violations of assumptions
  10. Error terms are non-normal
  11. Limited dependent variables
  12. Limited dependent
  13. Logistic regression
  14. X i = 0.
  15. Probit regression
  16. General properties
  17. Goodness–of–fit
  18. Hypothesis testing
  19. Prediction
  20. The generalized linear model
  21. Causal inference
  22. Randomized controlled trials
  23. Measured confounding
  24. Assumptions
  25. Regression estimators
  26. Matching estimators
  27. Propensity score estimators
  28. The JTPA data set
  29. Unmeasured confounding
  30. Instrumental variables
  31. Effect homogeneity
  32. Monotonicity
  33. Alternative approaches

1. Applications of Statistics (D0O70A)

1.1 Instructor and communication

The course "Applications of Statistics" (D0O70A) for the 2026-2027 academic year is taught by Prof. Dr. Ingrid Van Keilegom. Communication regarding practical or administrative issues should be directed via email, while questions about course material are handled through the discussion board on Toledo 4.

  • Instructor: Prof. Dr. Ingrid Van Keilegom (ingrid.vankeilegom@kuleuven.be).
  • Teaching format: All lectures are conducted on campus, with recordings provided for student access.
  • Course materials: Slides are made available on Toledo and are updated weekly.

1.2 Prerequisites

To succeed in this course, students must possess foundational knowledge in several key areas, which are essential for understanding the advanced statistical models and methods covered 5.

  • Mathematics: Familiarity with functions, mathematical notation, vectors, matrices, linear systems, inverses, eigenvalues, and eigenvectors.
  • Probability & statistics: Understanding of conditional probability, Bayes’ rule, random variables and distributions, sampling, expectation, confidence intervals, hypothesis testing, p-values, and the central limit theorem.
  • Regression: Basic knowledge of linear regression.
  • R: Proficiency in basic data manipulation and statistical analysis using R.
  • Revision resources: Available on Toledo for students to review prerequisite topics.

1.3 Learning objectives

Upon completion of this course, students are expected to demonstrate a comprehensive understanding and practical application of statistical methodologies 6.

  • Model comprehension: Understand the statistical models and methods presented in the course.
  • Method recognition: Identify when and why specific statistical methods are appropriate and useful.
  • Method selection: Choose the most suitable method for a given research question and dataset.
  • Application: Correctly apply the learned methods using R software.
  • Interpretation and communication: Clearly and accurately interpret and communicate the results of statistical analyses.

1.4 Course content

The course covers a range of advanced statistical topics, building upon foundational knowledge to address complex data analysis challenges 7.

ChapterTopics Covered
0. Review Linear RegressionReview of fundamental linear regression concepts
1. Limited Dependent VariablesLogistic regression, Survival analysis
2. Causal InferenceMeasured and unmeasured confounding, Panel data
3. Multivariate StatisticsPrincipal component analysis, Exploratory factor analysis, Cluster analysis
4. Statistical LearningIntroduction to statistical learning, Model assessment and selection, Decision trees, Neural networks

📝 Chapter 1, "Limited Dependent Variables," covers Logistic regression and Survival analysis 7.

1.5 Exercises

Exercises are provided on Toledo to reinforce learning and prepare for the exam. These exercises are an integral part of the course material 8.

  • Availability: Exercises for each chapter are released after the chapter's completion.
  • Solutions: Solutions are provided, but exercises are not discussed during class sessions.
  • Purpose:
  • Check understanding of theoretical concepts.
  • Practice applying statistical methods.
  • Prepare for the final examination.

1.6 Exam information

The final exam is a 3-hour assessment conducted in a computer room, designed to evaluate both theoretical understanding and practical application skills 9.

  • Duration: 3 hours.
  • Environment: Computer room, with R software available.
  • Question types:
  • Multiple-choice questions, with a correction for guessing.
  • Open questions requiring detailed responses.
  • Assessment areas:
  • Understanding of statistical theory.
  • Ability to select appropriate statistical methods.
  • Application of methods to data using R.
  • Interpretation of statistical results and R output.
  • Resources: Closed book, except for a provided cheat sheet containing selected R functions and formulas.

📝 The exam is 3 hours long and takes place in a computer room, where R software is available for application questions 9.

2. Linear regression

2.1 Simple linear regression model

Linear regression aims to model the relationship between a dependent variable (YiY_i) and an independent variable (XiX_i) for a sample of nn observations, approximating this relationship with a straight line. The model includes a random error term (ϵi\epsilon_i) to account for unexplained variation 11.

  • Model specification: The simple linear regression model is expressed as Yi=β1+β2Xi+ϵiY_i = \beta_1 + \beta_2X_i + \epsilon_i.
  • Variables:
  • YiY_i: Dependent variable.
  • XiX_i: Independent variable.
  • β1\beta_1: Intercept, representing the expected value of YiY_i when XiX_i is zero.
  • β2\beta_2: Slope, indicating the change in YiY_i for a one-unit change in XiX_i.
  • ϵi\epsilon_i: Random error term, capturing unobserved factors and random noise 11.

📝 In a housing market analysis, the house price (YiY_i) can be modeled as a function of the distance to the nearest train station (XiX_i). The model would predict how house prices change as the distance to the train station varies 11.

2.2 Dataset for housing price analysis

The housepricedata.csv dataset, collected from Taiwan's Ministry of the Interior between June 2012 and May 2013, contains 378 observations used to illustrate linear regression concepts 12.

  • Dependent variable:
  • unit_price: Residential housing price per unit area, measured in 10,000 New Taiwan Dollar per Ping (where 1 Ping = 3.3 m2^2).
  • Independent variables:
  • distance_to_train: Distance to the nearest train station (standardized, mean = 1066.73 m, standard deviation = 1262.38 m).
  • house_age: House age at transaction (standardized, mean = 17.28 years, standard deviation = 11.13 years).
  • stores: Number of convenience stores within 500 m (categorized as 0, 1–5, or 6–10 stores) 12.

Scatter plot showing the relationship between distance to train and unit price, with a fitted regression line.

2.3 Modeling design

The data for linear regression consists of nn independent observations, where YiY_i is the dependent variable and Xi=(Xi1,…,Xip)⊤X_i = (X_{i1}, \dots, X_{ip})^\top is a pp-dimensional vector of independent variables. For consistency, Xi1X_{i1} is typically set to 1 for all observations 15.

Design TypeDescription
Fixed designRegressors (XiX_i) are fixed in repeated samples, and the outcome (YiY_i) is sampled conditionally on XiX_i (e.g., an experiment).
Random design(XiX_i, YiY_i) are independent and identically distributed (i.i.d.) draws from a population (e.g., an observational study).
  • Common practice: The random design is more prevalent in economics and will be the focus of subsequent discussions 15.

2.4 Multiple linear regression model

The multiple linear regression model extends the simple linear regression by incorporating multiple independent variables to explain the variation in the dependent variable 16.

  • Individual observation equation: Yi=β1+β2Xi2+⋯+βpXip+ϵiY_i = \beta_1 + \beta_2X_{i2} + \dots + \beta_pX_{ip} + \epsilon_i.
  • β=(β1,…,βp)⊤\beta = (\beta_1, \dots, \beta_p)^\top: Vector of unknown population parameters.
  • ϵi\epsilon_i: Unobserved error term.
  • Linearity: The model is linear in its unknown parameters (βj\beta_j).
  • Matrix notation: The model can be compactly expressed as Y=Xβ+ϵY = X\beta + \epsilon.
  • Y=(Y1,…,Yn)⊤Y = (Y_1, \dots, Y_n)^\top: Vector of dependent variable observations.
  • X=(X1,…,Xn)⊤X = (X_1, \dots, X_n)^\top: Design matrix containing all independent variable observations, where each XiX_i is a row vector (1,Xi2,…,Xip)(1, X_{i2}, \dots, X_{ip}).
  • ϵ=(ϵ1,…,ϵn)⊤\epsilon = (\epsilon_1, \dots, \epsilon_n)^\top: Vector of error terms 16.

The multiple linear regression model is specified in two forms: an individual observation equation and a matrix notation equation.

📝 To predict unit_price, a multiple linear regression model could include distance_to_train, house_age, and stores as independent variables. The stores variable, being categorical, would be treated as a factor in the model 17.

Summary of a linear regression model showing coefficients, standard errors, t-values, and p-values for different predictors.

3. Estimation

3.1 Ordinary least squares (OLS) estimator

The ordinary least squares (OLS) estimator is a method used to estimate the unknown parameters in a linear regression model by minimizing the sum of the squares of the residuals, which is the difference between the observed and predicted values 19.

  • Definition: The OLS estimator β^OLS\hat{\beta}_{OLS} is defined as the argument that minimizes the squared Euclidean norm of the difference between the observed vector YY and the predicted vector XβX\beta.
  • Formula: β^OLS=arg⁡min⁡β∥Y−Xβ∥2\hat{\beta}_{OLS} = \arg \min_{\beta} \|Y - X\beta\|^2.
  • Normal equations: Differentiating the minimization problem with respect to each β\beta and setting the derivatives to zero yields the normal equations: XT(Y−Xβ)=0X^T(Y - X\beta) = 0.
  • Solution: Given that the design matrix XX has full column rank (i.e., rank(X)=p\text{rank}(X) = p), the unique solution for the OLS estimator is β^OLS=(XTX)−1XTY\hat{\beta}_{OLS} = (X^T X)^{-1} X^T Y 19.

The ordinary least squares (OLS) estimator is defined by minimizing the squared difference between the observed and predicted values.

3.2 Simple linear regression OLS estimators 20

For a simple linear regression model, which involves one independent variable, the OLS estimators for the intercept and slope can be expressed in terms of sample means and sums of squares 20.

  • Model: The simple linear regression model is given by Yi=β1+β2Xi+ϵiY_i = \beta_1 + \beta_2 X_i + \epsilon_i, where β1\beta_1 is the intercept and β2\beta_2 is the slope.
  • Sample means:
  • Yˉ=n−1∑i=1nYi\bar{Y} = n^{-1} \sum_{i=1}^n Y_i
  • Xˉ=n−1∑i=1nXi\bar{X} = n^{-1} \sum_{i=1}^n X_i 20.
CoefficientOLS Estimator Formula
Slope β^2,OLS\hat{\beta}_{2,OLS}∑i=1n(Xi−Xˉ)(Yi−Yˉ)∑i=1n(Xi−Xˉ)2\frac{\sum_{i=1}^n(X_i - \bar{X})(Y_i - \bar{Y})}{\sum_{i=1}^n(X_i - \bar{X})^2}
Intercept β^1,OLS\hat{\beta}_{1,OLS}Yˉ−β^2,OLSXˉ\bar{Y} - \hat{\beta}_{2,OLS} \bar{X}

Formulas for simple linear regression coefficients and means.

4. Finite sample properties

4.1 Gauss-Markov conditions

The Gauss-Markov (GM) conditions are a set of assumptions under which the Ordinary Least Squares (OLS) estimator possesses desirable finite sample properties, specifically being the Best Linear Unbiased Estimator (BLUE) 22.

  • Condition A1 (Exogeneity): The expected value of the error term, ϵi\epsilon_i, conditional on the regressors, XX, is zero for all observations. This implies that E[Yi∣X]=Xi⊤βE[Y_i | X] = X_i^\top \beta, meaning the regressors are uncorrelated with the error term.
  • Condition A2 (Homoscedasticity): The variance of the error term, ϵi\epsilon_i, conditional on XX, is constant across all observations and equal to σ2\sigma^2. This ensures that the errors have a uniform variance.
  • Condition A3 (No Autocorrelation): The covariance between any two distinct error terms, ϵi\epsilon_i and ϵj\epsilon_j, conditional on XX, is zero. This means errors are uncorrelated with each other, leading to "spherical errors" where Var(ϵ∣X)=σ2InVar(\epsilon | X) = \sigma^2 I_n.
  • Condition A4 (Full Column Rank): The matrix XX has full column rank, implying that there is no perfect multicollinearity among the regressors. This ensures that (X⊤X)−1(X^\top X)^{-1} exists 22.

4.2 Gauss-Markov theorem

The Gauss-Markov theorem states that under the Gauss-Markov assumptions (A1-A4), the OLS estimator is the Best Linear Unbiased Estimator (BLUE) of β\beta 22.

PropertyExplanation
LinearThe OLS estimator β^OLS=(X⊤X)−1X⊤Y\hat{\beta}_{OLS} = (X^\top X)^{-1}X^\top Y is a linear function of the dependent variable Y.
UnbiasedThe expected value of the OLS estimator, E[β^OLS∣X]E[\hat{\beta}_{OLS} \vert X], is equal to the true parameter β\beta.
Best (Efficient)Among all linear unbiased estimators, OLS has the minimum variance for any linear combination of the coefficients. This means Var(v⊤β^∣X)≥Var(v⊤β^OLS∣X)Var(v^\top \hat{\beta} \vert X) \ge Var(v^\top \hat{\beta}_{OLS} \vert X) for any vector v and any other linear unbiased estimator β^\hat{\beta}.

📝 If one were to compare the OLS estimator with another linear unbiased estimator, such as a weighted least squares estimator under specific conditions, the Gauss-Markov theorem guarantees that the OLS estimator will have a smaller or equal variance for any linear combination of the estimated coefficients, making it more precise 23.

4.3 Estimation of residual variance

Under the GM conditions, the variance of the OLS estimator is given by Var(β^OLS∣X)=σ2(X⊤X)−1Var(\hat{\beta}_{OLS} | X) = \sigma^2(X^\top X)^{-1}. However, the true error variance, σ2\sigma^2, is typically unknown and must be estimated 24.

  • Estimated residual variance: The unbiased estimator for the residual variance, σ^OLS2\hat{\sigma}^2_{OLS}, is calculated as 1n−p∑i=1nϵ^i2\frac{1}{n-p} \sum_{i=1}^n \hat{\epsilon}_i^2, where ϵ^i=Yi−Xi⊤β^OLS\hat{\epsilon}_i = Y_i - X_i^\top \hat{\beta}_{OLS} are the OLS residuals and pp is the number of regressors (including the intercept).
  • Estimated variance of OLS estimator: By substituting σ^OLS2\hat{\sigma}^2_{OLS} for σ2\sigma^2, an unbiased estimator for Var(β^OLS∣X)Var(\hat{\beta}_{OLS} | X) is obtained: Var^(β^OLS∣X)=σ^OLS2(X⊤X)−1\hat{Var}(\hat{\beta}_{OLS} | X) = \hat{\sigma}^2_{OLS}(X^\top X)^{-1} 24.

5. Large sample or asymptotic properties

5.1 Consistency and asymptotic normality of OLS estimators

Under Gaussian Markov (GM) conditions and appropriate regularity conditions, Ordinary Least Squares (OLS) estimators exhibit desirable large sample properties, specifically consistency and asymptotic normality 26.

PropertyDescriptionUnderlying Theorem
ConsistencyAs the sample size (nn) approaches infinity, the estimator converges in probability to the true parameter value.Law of Large Numbers
Asymptotic NormalityEven if the data are not normally distributed, the OLS estimator's distribution approaches a normal distribution as n→∞n \to \infty.Central Limit Theorem
  • Consistency: This property implies that as the sample size n→∞n \to \infty, the OLS estimators for coefficients (β^OLS\hat{\beta}_{OLS}) and error variance (σ^OLS2\hat{\sigma}^2_{OLS}) converge in probability to their true values, β\beta and σ2\sigma^2, respectively: β^OLS→pβ\hat{\beta}_{OLS} \xrightarrow{p} \beta and σ^OLS2→pσ2\hat{\sigma}^2_{OLS} \xrightarrow{p} \sigma^2.
  • Asymptotic normality: This property states that the sampling distribution of the OLS estimator, when appropriately scaled, converges in distribution to a normal distribution: n(β^OLS−β)→dN(0,σ2Q−1)\sqrt{n}(\hat{\beta}_{OLS} - \beta) \xrightarrow{d} N(0, \sigma^2 Q^{-1}), where Q=E[XiXi⊤]Q = E[X_i X_i^\top] 26.

5.2 Simulation example

A simulation can illustrate the large sample properties of OLS estimators by generating multiple datasets for varying sample sizes and observing the distribution of the estimated coefficients 27.

📝 A simulation involves setting a sample size nn (e.g., 20, 100, 500) and generating a large number of datasets (e.g., 1000) for each nn. For each dataset, OLS coefficients are estimated. The distribution of these estimated coefficients across the simulations demonstrates how consistency and asymptotic normality manifest with increasing sample size 27.

This chart displays the density distribution of a variable for different sample sizes, showing how the distribution changes with increasing sample size.

The simulation results show that as the sample size increases, the distribution of the estimated coefficients becomes more concentrated around the true value, illustrating consistency. Furthermore, the shape of the distribution increasingly resembles a normal distribution, confirming asymptotic normality 28 29.

This chart displays the density distribution of a statistic for different sample sizes, comparing them to a standard normal distribution.

6. Goodness–of–fit

6.1 Decomposition of total sum of squares

The total sum of squares (TSS) represents the total variation in the response variable, which can be decomposed into the explained sum of squares (ESS) and the residual sum of squares (RSS). This decomposition is valid only when an intercept is included in the linear regression model, ensuring that the residuals sum to zero 31.

  • Total sum of squares (TSS): Measures the total variation of the observed response values (YiY_i) around their mean (Yˉ\bar{Y}). TSS=∑i=1n(Yi−Yˉ)2\text{TSS} = \sum_{i=1}^{n} (Y_i - \bar{Y})^2
  • Explained sum of squares (ESS): Represents the variation in the response variable that is explained by the regression model. ESS=∑i=1n(Y^i−Yˉ)2\text{ESS} = \sum_{i=1}^{n} (\hat{Y}_i - \bar{Y})^2
  • Residual sum of squares (RSS): Quantifies the unexplained variation, or the sum of squared differences between the observed and predicted response values. RSS=∑i=1n(Yi−Y^i)2\text{RSS} = \sum_{i=1}^{n} (Y_i - \hat{Y}_i)^2
  • Decomposition relationship: The total variation is the sum of the explained and unexplained variations. TSS=ESS+RSS\text{TSS} = \text{ESS} + \text{RSS}

6.2 Coefficient of multiple determination (R2R^2)

The coefficient of multiple determination (R2R^2) quantifies the proportion of the total variation in the response variable that is explained by the linear regression model 32.

  • Definition: R2R^2 is calculated as the ratio of ESS to TSS, or equivalently, 11 minus the ratio of RSS to TSS. R2=ESSTSS=1−RSSTSSR^2 = \frac{\text{ESS}}{\text{TSS}} = 1 - \frac{\text{RSS}}{\text{TSS}}
  • Range: The value of R2R^2 always falls between 00 and 11.
  • Interpretation: A higher R2R^2 indicates that a larger proportion of the variance in the dependent variable is predictable from the independent variables.
  • Simple linear regression: For a simple linear regression model, R2R^2 is equal to the squared sample correlation between the observed response values and the independent variable.
  • Model complexity: R2R^2 never decreases when additional parameters are added to the model, even if those parameters do not significantly improve the model's explanatory power. The formula for the coefficient of multiple determination is presented, showing its relationship to ESS and TSS.

6.3 Adjusted coefficient of multiple determination (Rˉ2\bar{R}^2)

The adjusted coefficient of multiple determination (Rˉ2\bar{R}^2) corrects for the number of parameters in the model, providing a more accurate measure of fit when comparing models with different numbers of predictors 32.

  • Formula: Rˉ2\bar{R}^2 adjusts R2R^2 by incorporating the degrees of freedom for both the residuals and the total variation. Rˉ2=1−RSS/(n−p)TSS/(n−1)\bar{R}^2 = 1 - \frac{\text{RSS}/(n-p)}{\text{TSS}/(n-1)}
  • nn: number of observations.
  • pp: number of parameters in the model.
  • Model comparison: Rˉ2\bar{R}^2 is particularly useful for comparing different models, as it penalizes models for including unnecessary predictors.
  • Behavior: Unlike R2R^2, Rˉ2\bar{R}^2 can decrease if newly added parameters do not improve the model sufficiently to offset the penalty for increased complexity 32.

📝 If adding a new predictor to a model increases R2R^2 but the improvement is not significant enough, Rˉ2\bar{R}^2 can decrease, as it penalizes for the increased number of parameters pp 32.

7. Hypothesis testing

7.1 Confidence intervals for regression coefficients

Under the assumption of normally distributed error terms, ϵ∣X∼N(0,σ2In)\epsilon | X \sim N(0, \sigma^2 I_n), the ordinary least squares (OLS) estimator for each regression coefficient, β^j,OLS\hat{\beta}_{j,OLS}, is also normally distributed: β^j,OLS∣X∼N(βj,σ2(XTX)jj−1)\hat{\beta}_{j,OLS} | X \sim N(\beta_j, \sigma^2(X^T X)^{-1}_{jj}) for j=1,…,pj = 1, \dots, p. This allows for the construction of confidence intervals for individual coefficients 34.

A (1−α)100%(1-\alpha)100\% confidence interval for each βj\beta_j is given by: This diagram shows the formula for constructing a confidence interval for a regression coefficient.

📝 If a 95% confidence interval for βj\beta_j is calculated, it means that if the estimation process were repeated many times, 95% of these intervals would contain the true value of βj\beta_j.

7.2 Individual coefficient hypothesis testing (t-test)

To test hypotheses about individual regression coefficients, specifically whether a coefficient is significantly different from zero, a t-test is employed. This test relies on the t-distribution under the null hypothesis 35.

The hypothesis test for an individual coefficient βj\beta_j is formulated as:

  • Null Hypothesis (H0H_0): βj=0\beta_j = 0 (the coefficient has no effect on the dependent variable).
  • Alternative Hypothesis (HaH_a): βj≠0\beta_j \neq 0 (the coefficient has a significant effect).

Under the assumptions (A1)-(A5) and H0H_0, the t-statistic is calculated as: t=β^j,OLSSE(β^j,OLS∣X)∼tn−pt = \frac{\hat{\beta}_{j,OLS}}{SE(\hat{\beta}_{j,OLS} | X)} \sim t_{n-p} Where SE(β^j,OLS∣X)=σ^OLS2(XTX)jj−1SE(\hat{\beta}_{j,OLS} | X) = \sqrt{\hat{\sigma}^2_{OLS}(X^T X)^{-1}_{jj}} 35. This diagram illustrates the process of hypothesis testing in statistics, including the null and alternative hypotheses, the t-statistic formula, and the conditions for rejecting the null hypothesis based on the t-statistic or p-value. The decision to reject H0H_0 can be made using either the critical value approach or the p-value approach:

MethodRejection Criterion
Critical ValueReject H0H_0 if ∣t∣>t1−α2,n−p\vert t\vert > t_{1-\frac{\alpha}{2}, n-p}
p-valueReject H0H_0 if p-value <α< \alpha

The p-value is calculated as 2P(T>∣t∣)2P(T > |t|), where T∼tn−pT \sim t_{n-p} 35.

7.3 Partial F-test for groups of parameters

When testing the significance of a group of qq parameters simultaneously, a partial F-test is used. This test compares the residual sum of squares (RSS) of a full model to that of a reduced model where the qq parameters are constrained to zero 36.

The hypotheses for testing a group of parameters (e.g., the last qq parameters) are:

  • Null Hypothesis (H0H_0): βp−q+1=⋯=βp=0\beta_{p-q+1} = \dots = \beta_p = 0 (the group of coefficients has no collective effect).
  • Alternative Hypothesis (HaH_a): At least one of βp−q+1,…,βp≠0\beta_{p-q+1}, \dots, \beta_p \neq 0 (at least one coefficient in the group has a significant effect).

Under H0H_0, the reduced model is Yi=β1+⋯+βp−qXi,p−q+ϵiY_i = \beta_1 + \dots + \beta_{p-q}X_{i,p-q} + \epsilon_i. Let RSSp−qRSS_{p-q} be the RSS of the reduced model and RSSRSS be the RSS of the full model.

Under assumptions (A1)-(A5) and H0H_0, the F-statistic is: F=(RSSp−q−RSS)/qRSS/(n−p)∼Fq,n−pF = \frac{(RSS_{p-q} - RSS)/q}{RSS/(n-p)} \sim F_{q,n-p}

📝 To test if the variable 'stores' is significant in a regression model, one would fit a reduced model without 'stores' and a full model with 'stores', then use anova(fitreduced, fit) to perform the partial F-test 37.

7.4 Overall F-test

The overall F-test assesses whether the entire regression model, excluding the intercept, explains a significant amount of variation in the dependent variable. It is a special case of the partial F-test where q=p−1q = p-1 38.

The hypotheses for the overall F-test are:

  • Null Hypothesis (H0H_0): β2=⋯=βp=0\beta_2 = \dots = \beta_p = 0 (all regression coefficients, except the intercept, are zero).
  • Alternative Hypothesis (HaH_a): At least one of β2,…,βp≠0\beta_2, \dots, \beta_p \neq 0 (at least one regression coefficient is non-zero). The overall F test in regression analysis is presented with null and alternative hypotheses and the F-statistic formula. This test determines if the model explains more variation than an intercept-only model. The F-statistic can be expressed in terms of the explained sum of squares (ESS) and RSS, or in terms of the coefficient of determination (R2R^2): F=ESS/(p−1)RSS/(n−p)∼Fp−1,n−pF = \frac{ESS/(p-1)}{RSS/(n-p)} \sim F_{p-1,n-p} This is equivalent to: F=R2/(p−1)(1−R2)/(n−p)F = \frac{R^2/(p-1)}{(1-R^2)/(n-p)} 38.

8. Prediction

8.1 Confidence interval for the mean response

A confidence interval (CI) for the mean response estimates the expected value of the response variable at a specific set of predictor values, x0=(x1,…,xp)⊤x_0 = (x_1, \dots, x_p)^\top. The mean response is given by x0⊤βx_0^\top \beta, and its unbiased estimator is y^0=x0⊤β^OLS\hat{y}_0 = x_0^\top \hat{\beta}_{OLS} 41.

Under the assumption of normal errors, the confidence interval for the mean response is constructed as follows: Formula for constructing a confidence interval for the mean response. The formula indicates that the interval accounts for the uncertainty in estimating the mean response, but not the inherent variability of individual observations 41.

8.2 Prediction interval for the unknown response

A prediction interval (PI) for an unknown response y0=x0⊤β+ϵ0y_0 = x_0^\top \beta + \epsilon_0 estimates the range within which a single future observation will fall at a specific set of predictor values. This interval is inherently wider than a confidence interval for the mean response because it incorporates both the uncertainty in estimating the mean and the irreducible error variance (ϵ0\epsilon_0) of individual observations 41.

The prediction interval for the unknown response is calculated using the formula: y^0±t1−α2,n−p×σ^OLS1+x0⊤(X⊤X)−1x0\hat{y}_0 \pm t_{1-\frac{\alpha}{2}, n-p} \times \hat{\sigma}_{OLS} \sqrt{1 + x_0^\top (X^\top X)^{-1}x_0}

📝 For a house with specific features (1 km from a train station, 0 years old, 6-10 stores nearby), the average cost might be 334,236 ±\pm 17,288 New Taiwan Dollar/Ping (CI), while a specific house with these features could cost 334,236 ±\pm 127,921 New Taiwan Dollar/Ping (PI). This demonstrates the significantly wider range of the prediction interval due to the additional uncertainty of an individual observation 42.

Interval TypePurposeFormula Component
Confidence Interval (CI)Estimates the mean response x0⊤βx_0^\top \betaσ^OLSx0⊤(X⊤X)−1x0\hat{\sigma}_{OLS} \sqrt{x_0^\top (X^\top X)^{-1}x_0}
Prediction Interval (PI)Estimates a single unknown response y0y_0σ^OLS1+x0⊤(X⊤X)−1x0\hat{\sigma}_{OLS} \sqrt{1 + x_0^\top (X^\top X)^{-1}x_0}

The key distinction between the two intervals lies in the additional '1' under the square root in the PI formula, which accounts for the variance of the new observation ϵ0\epsilon_0 41.

9. Violations of assumptions

9.1 Endogeneity

Endogeneity occurs when the assumption that the error term's conditional expectation given the regressors is zero, E[ϵ∣X]≠0E[\epsilon | X] \neq 0, is violated. This often arises due to unobserved confounders affecting both the dependent variable (YY) and an independent variable (XX), leading to omitted variable bias 44.

  • Impact on OLS: The Ordinary Least Squares (OLS) estimator becomes biased and inconsistent, meaning its estimates do not converge to the true population parameters even with an infinite sample size.
  • Detection: Endogeneity cannot be directly tested without additional assumptions.
  • Solution: Instrumental variable (IV) methods are a possible approach to address endogeneity 44.

📝 If a model predicting house prices omits "living space (m2^2)" and larger houses are generally further from a train station, the effect of "distance to train station" might be underestimated. This is because living space, an unobserved confounder, correlates with both house price and distance to the train station 44.

9.2 Heteroscedasticity

Heteroscedasticity is the violation of the assumption that the error variance is constant across all observations, i.e., Var(ϵi∣X)=σi2Var(\epsilon_i | X) = \sigma_i^2 for i=1,…,ni = 1, \dots, n. This means the variance of the error term differs for different values of the independent variables 45.

  • Impact on OLS: OLS remains unbiased and consistent under heteroscedasticity, but it is no longer efficient. The standard OLS estimator of the variance-covariance matrix, σ^OLS2(XTX)−1\hat{\sigma}^2_{OLS}(X^T X)^{-1}, might be a biased estimator of Var(β^OLS∣X)Var(\hat{\beta}_{OLS} | X).
  • Detection: Heteroscedasticity can often be detected by plotting residuals against fitted values or individual independent variables. Standardized residuals are preferred for better comparability. This scatter plot visualizes the relationship between fitted values and standardized residuals, with fitted values on the x-axis and standardized residuals on the y-axis. A scatter plot showing the relationship between distance to train and standardized residuals squared. Boxplot comparing the distribution of standardized residuals squared across different ranges of house prices per store.
  • Visual interpretation:
  • Fitted values vs. standardized residuals: A changing vertical spread of residuals indicates heteroscedasticity 45 52.
  • Independent variables vs. standardized residuals: Plots against individual predictors can reveal if the spread of residuals changes with specific variables. Systematic curvature might also suggest functional-form misspecification 47 48 50.
  • Boxplots: Boxplots of standardized residuals across categories of an independent variable can show differing spreads, indicating heteroscedasticity 49 55.

📝 In a house price model, if the plot of standardized residuals against "distance to train" shows a noticeably changing vertical spread, it suggests heteroscedasticity. Additionally, systematic curvature in this plot could indicate that the functional form for "distance to train" is misspecified, potentially requiring the inclusion of a quadratic term like distance_to_train2distance\_to\_train^2 50 51.

9.3 Heteroscedasticity-consistent estimators

To address heteroscedasticity, a heteroscedasticity-consistent estimator of Var(β^OLS∣X)Var(\hat{\beta}_{OLS} | X) can be used. This approach corrects the standard errors without changing the estimated coefficients 56 58.

  • Variance under heteroscedasticity: The true variance of the OLS estimator is given by Var(β^OLS∣X)=(XTX)−1XTΩX(XTX)−1Var(\hat{\beta}_{OLS} | X) = (X^T X)^{-1}X^T \Omega X(X^T X)^{-1}, where Ω=diag(σ12,…,σn2)\Omega = diag(\sigma_1^2, \dots, \sigma_n^2) is a diagonal matrix of unknown conditional error variances 56.
  • Estimation of Ω\Omega: Since the σi2\sigma_i^2 values are unknown, they must be estimated. Different heteroscedasticity-consistent estimators use various methods to estimate Ω\Omega.
  • HC3 correction: A common choice for estimating σi2\sigma_i^2 is the HC3 correction, defined as σ^i2=ϵ^i2(1−hii)2\hat{\sigma}_i^2 = \frac{\hat{\epsilon}_i^2}{(1-h_{ii})^2}, where ϵ^i\hat{\epsilon}_i is the OLS residual and hii=XiT(XTX)−1Xih_{ii} = X_i^T (X^T X)^{-1}X_i is the leverage of observation ii.
  • Leverage (hiih_{ii}): A high value of hiih_{ii} indicates that observation ii has an unusual combination of covariate values, meaning it has a strong influence on the fitted values 57.
  • Implementation: Software packages like sandwich and lmtest in R can compute heteroscedasticity-consistent standard errors using functions like vcovHC 58.

📝 After fitting a linear model fitsq, applying coeftest(fitsq, vcov. = vcovHC(fitsq, type = "HC3")) will re-estimate the standard errors using the HC3 correction. This will result in changed standard errors, but the estimated coefficients themselves will remain the same 58.

9.4 Autocorrelation

Autocorrelation, or serial correlation, occurs when the error terms are correlated across observations, violating the assumption Cov(ϵi,ϵj∣X)≠0Cov(\epsilon_i, \epsilon_j | X) \neq 0 for i≠ji \neq j. This is particularly common in time series data 59.

  • Impact on OLS: The OLS estimator remains unbiased and consistent, but it is no longer the Best Linear Unbiased Estimator (BLUE). The standard variance estimator Var(β^OLS∣X)≠σ2(XTX)−1Var(\hat{\beta}_{OLS} | X) \neq \sigma^2(X^T X)^{-1} is incorrect.
  • Solutions: Solutions are similar to those for heteroscedasticity, often involving robust standard errors or specialized time series models 59.

📝 When analyzing time series data such as stock prices, inflation rates, or GDP, the error term at one time point might be correlated with the error term at a previous time point. This violates the independence assumption of OLS residuals and indicates autocorrelation 59.

9.5 Multicollinearity

Multicollinearity arises when independent variables in a regression model are highly correlated with each other. Perfect multicollinearity occurs if one predictor is a perfect linear combination of others, leading to rank(X)<prank(X) < p, where pp is the number of predictors 60.

  • Impact on OLS:
  • Perfect multicollinearity: The OLS solution is not unique, and the coefficients cannot be estimated.
  • High correlation: Even without perfect multicollinearity, high correlation among predictors leads to a high variance of the estimated coefficients because (XTX)(X^T X) becomes close to singular. This makes the interpretation of individual regression coefficients more difficult.
  • Detection:
  • Pairwise correlations: Large pairwise correlations between independent variables can indicate multicollinearity 60.
  • Variance Inflation Factors (VIF): VIFs are a formal method to detect more general linear dependencies among predictors 61.

📝 If a model includes both "square footage" and "number of rooms" as predictors for house price, and these two variables are highly correlated (e.g., larger houses almost always have more rooms), multicollinearity may be present. This makes it difficult to isolate the individual effect of each variable on house price 60.

9.6 Variance inflation factors (VIF)

The Variance Inflation Factor (VIF) quantifies how much the variance of an estimated regression coefficient is inflated due to multicollinearity 61.

  • Calculation: For each independent variable jj, VIFj=11−Rj2VIF_j = \frac{1}{1 - R_j^2}, where Rj2R_j^2 is the coefficient of multiple determination from a regression of the jj-th independent variable on all other independent variables (including an intercept) 61.
  • Interpretation:
  • VIFj=1VIF_j = 1: Indicates no linear relationship with other regressors.
  • VIFj>1VIF_j > 1: Generally observed in practice.
  • Rule of thumb: A VIFj>10VIF_j > 10 typically indicates strong multicollinearity 62.
  • Generalized VIFs (GVIFs): For models with categorical variables, generalized VIFs are used. A common rule of thumb for GVIFs is that GVIF1/(2df)>3GVIF^{1/(2df)} > 3 indicates strong multicollinearity 63.
VIF ValueInterpretation
VIFj=1VIF_j = 1No linear relationship with other regressors
VIFj>1VIF_j > 1Some degree of multicollinearity present
VIFj>10VIF_j > 10Strong multicollinearity (rule of thumb)
GVIF1/(2df)>3GVIF^{1/(2df)} > 3Strong multicollinearity for categorical variables (rule of thumb)
  • Solutions:
  • Dropping variables: One or more variables with high VIFs can be dropped, but this risks omitted variable bias if the dropped variable is important.
  • Principal Component Analysis (PCA): PCA offers an alternative approach to deal with multicollinearity by transforming correlated variables into a set of uncorrelated principal components 63.

📝 If a vif(fitsq) command in R returns a VIF value of 15 for a particular predictor, it suggests strong multicollinearity for that variable, as it exceeds the common threshold of 10. For a categorical variable like stores, if its GVIF1/(2df)GVIF^{1/(2df)} value is 4, it also indicates strong multicollinearity 62 63.

10. Error terms are non-normal

10.1 Violation of assumption (A5): Error terms are non-normal

When the assumption (A5) that error terms are normally distributed, ϵ∣X≁N(0,σ2In)\epsilon | X \not\sim N(0, \sigma^2 I_n), is violated, the Ordinary Least Squares (OLS) estimator still exhibits asymptotic normality due to the Central Limit Theorem (CLT). This property allows for the construction of asymptotically valid confidence intervals for each regression coefficient βj\beta_j 64.

  • Confidence interval formula: The confidence interval for βj\beta_j is given by bβj,OLS±z1−α/2×SE(bβj,OLS∣X)b\beta_j,OLS \pm z_{1-\alpha/2} \times SE(b\beta_j,OLS | X), where z1−α/2z_{1-\alpha/2} is the (1−α/2)(1-\alpha/2) quantile of the standard normal distribution.
  • Standard error of OLS estimator: The standard error for the jj-th OLS estimator is calculated as SE(bβj,OLS∣X)=bσOLS(X⊤X)jj−1SE(b\beta_j,OLS | X) = b\sigma_{OLS} \sqrt{(X^\top X)^{-1}_{jj}}.
  • Sample size requirement: For the asymptotic normality to hold, the sample size nn must be sufficiently large, as t1−α/2,n−pt_{1-\alpha/2, n-p} converges to z1−α/2z_{1-\alpha/2} as n→∞n \to \infty 64.

This diagram illustrates the formula for calculating the standard error of the OLS estimator.

10.2 Visual assessment of normality using Q-Q plots

The normality assumption (A5) can be visually assessed by plotting sample quantiles against theoretical normal quantiles, which is known as a Q-Q plot 65.

  • Interpretation of Q-Q plot:
  • If the points on the Q-Q plot approximately follow a straight line, particularly through the middle of the distribution, the normality assumption is likely satisfied.
  • Strong systematic curvature, heavy tails, or extreme residuals far from the line indicate a violation of the normality assumption 65.

📝 A Q-Q plot generated from residuals (e.g., res = resid(fitsq)) can be visualized using qqnorm(res) and qqline(res) commands, where qqline adds a reference line for comparison 66.

A Normal Q-Q plot comparing sample quantiles to theoretical quantiles.

11. Limited dependent variables

11.1 Introduction to limited dependent variables

Limited dependent variables refer to outcome variables (YiY_i) that are restricted in their possible values, deviating from the continuous, unbounded nature assumed by standard linear regression models. These restrictions necessitate specialized modeling approaches to ensure valid predictions and inferences 67.

  • Binary outcomes: The dependent variable can only take on two values, such as 0 or 1 (e.g., success/failure, yes/no).
  • Count outcomes: The dependent variable represents counts of events, typically non-negative integers (e.g., number of arrests, number of children).
  • Censored outcomes: The dependent variable's true value is observed only within a certain range, with values outside this range being recorded at a boundary (e.g., income reported up to a certain maximum, time to event observed only until study end).
  • Truncated outcomes: Observations are entirely missing if the dependent variable falls outside a specific range, unlike censoring where the boundary value is known.

📝 In a study examining factors influencing college admission, the dependent variable "admission status" is binary (admitted/not admitted). Using a linear regression model would be inappropriate because it could predict probabilities outside the range, which are nonsensical for a binary outcome. Specialized models like logistic regression are required 1.

12. Limited dependent

12.1 Introduction to limited dependent variables

Limited dependent variables are outcomes that are restricted in the values they can take, deviating from the continuous assumption of Yi∈RY_i \in \mathbb{R} typically found in standard linear regression models. These variables necessitate specialized modeling approaches because linear regression can produce impossible or nonsensical predictions for such outcomes 69.

Type of Limited Dependent VariableDescriptionExample
Binary DataOutcome can only take one of two discrete values.Default or no default (Yi∈{0,1}Y_i \in \{0, 1\})
Count DataOutcome represents a non-negative integer count.Number of loans (Yi∈{0,1,2,… }Y_i \in \{0, 1, 2, \dots\})
Censored DataOutcome is observed only under certain conditions, with values outside these conditions being unobserved or truncated.Unemployment duration (observed only if employed before study end)

📝 If a linear regression model were used to predict the probability of loan default, it might yield predictions outside the [0,1][0, 1] range, such as −0.2-0.2 or 1.31.3, which are impossible for a probability 69.

13. Logistic regression

13.1 Limitations of linear regression for binary outcomes

Linear regression models are unsuitable for binary dependent variables due to violations of key assumptions and the potential for predicted probabilities outside the [0,1][0, 1] range. When the dependent variable Yi∈{0,1}Y_i \in \{0, 1\}, the expected value E[Yi∣Xi]E[Y_i | X_i] directly represents the probability P(Yi=1∣Xi)=Xi⊤βP(Y_i = 1 | X_i) = X_i^\top \beta 73.

  • Predicted probabilities: Linear regression can yield predicted probabilities less than 0 or greater than 1, which are nonsensical for probabilities 73.
  • Error term distribution: The conditional distribution of the error term ϵi\epsilon_i is discrete, taking only two possible values: −Xi⊤β-X_i^\top \beta (when Yi=0Y_i=0) or 1−Xi⊤β1 - X_i^\top \beta (when Yi=1Y_i=1).
  • Heteroscedasticity: The variance of the error term is not constant and depends on the predictor variables, specifically Var(ϵi∣Xi)=Xi⊤β(1−Xi⊤β)Var(\epsilon_i | X_i) = X_i^\top \beta (1 - X_i^\top \beta), violating the homoscedasticity assumption 74.

This diagram illustrates the conditional distribution of the error term in a statistical model, showing its discrete nature and dependence on predictor variables.

13.2 Binary choice models

Binary choice models are designed to model the probability of choosing between two discrete alternatives, where the dependent variable Yi∈{0,1}Y_i \in \{0, 1\}. These models express the probability P(Yi=1∣Xi)P(Y_i = 1 | X_i) as a function G(Xi,β)G(X_i, \beta), typically using a cumulative distribution function F(⋅)F(\cdot) to ensure probabilities lie between 0 and 1 76.

  • General form: P(Yi=1∣Xi)=G(Xi,β)=F(Xi⊤β)P(Y_i = 1 | X_i) = G(X_i, \beta) = F(X_i^\top \beta) 76.
  • Latent variable model: Binary choice models can be derived from an unobserved (latent) variable Yi∗=Xi⊤β+ϵiY_i^\ast = X_i^\top \beta + \epsilon_i, where Yi=1Y_i = 1 if Yi∗>0Y_i^\ast > 0 and Yi=0Y_i = 0 otherwise. The choice of distribution for ϵi\epsilon_i determines the specific form of F(⋅)F(\cdot) 77.

This diagram illustrates the derivation of a binary choice model from an underlying latent model.

ModelDistribution Function F(w)F(w)
Probit model∫−∞w12πexp⁡(−12t2) dt\int_{-\infty}^{w} \frac{1}{\sqrt{2\pi}} \exp\left(-\frac{1}{2}t^2\right)\,dt
Logit modelexp⁡{w}1+exp⁡{w}\frac{\exp\{w\}}{1+\exp\{w\}}
  • Logistic vs. Probit: The logistic distribution has slightly heavier tails than the normal distribution used in the Probit model. While estimated coefficients differ due to scale, both models generally yield similar fitted probabilities 76.

13.3 The logit model and interpretation

The logit model is a specific binary choice model that uses the logistic distribution function to link the linear predictor Xi⊤βX_i^\top \beta to the probability of the outcome Yi=1Y_i=1 78.

  • Probability formula: The probability Pi=P(Yi=1∣Xi)P_i = P(Y_i = 1 | X_i) is given by Pi=exp⁡{Xi⊤β}1+exp⁡{Xi⊤β}=11+exp⁡{−Xi⊤β}P_i = \frac{\exp\{X_i^\top \beta\}}{1 + \exp\{X_i^\top \beta\}} = \frac{1}{1 + \exp\{-X_i^\top \beta\}}.
  • Log odds: The logit transformation of PiP_i is the log odds of Yi=1Y_i=1, defined as log⁡(Pi1−Pi)=Xi⊤β\log\left(\frac{P_i}{1 - P_i}\right) = X_i^\top \beta. Here, Pi1−Pi\frac{P_i}{1 - P_i} represents the odds of Yi=1Y_i=1 78.

The logit model is presented, showing the probability of Y_i = 1 given X_i, and its mathematical derivation.

  • Odds ratio: For a one-unit increase in an independent variable XijX_{ij} (holding other variables constant), the log odds increase by βj\beta_j, and the odds are multiplied by exp⁡(βj)\exp(\beta_j). This exp⁡(βj)\exp(\beta_j) is known as the odds ratio.
  • Interpretation: Odds ratios describe changes in odds, not direct changes in probabilities. For example, if βj=0.1\beta_j = 0.1, the odds are multiplied by exp⁡(0.1)≈1.105\exp(0.1) \approx 1.105, indicating an approximate 10.5% increase in odds 79.

📝 If the probability Pi=2/3P_i = 2/3, the odds are 2/31−2/3=2/31/3=2\frac{2/3}{1 - 2/3} = \frac{2/3}{1/3} = 2. If the odds are 4, then Pi1−Pi=4\frac{P_i}{1 - P_i} = 4, which implies Pi=4/5P_i = 4/5 79.

13.4 Application to credit risk data

Logistic regression can be applied to model credit risk, where the dependent variable riskbin is a binary indicator (0 = good risk, 1 = bad risk). Independent variables include age, marital status, income, mortgage, and number of loans 71.

  • Data preprocessing: age and income are standardized, and risk is recoded to riskbin (0 for good, 1 for bad). nr_loans is treated as numeric, assuming a linear effect on risk 71.
  • Model fitting in R: The glm() function with family = binomial is used to fit a logistic regression model in R 80.

fitlog = glm(riskbin~agestd+marital+incomestd+mortgage+nr_loans, data=risk, family = binomial) summary(fitlog)

This is a screenshot of R output showing the summary of a generalized linear model (GLM) fit.

  • Coefficient interpretation: The coefficients from the glm output represent the change in the log odds of being a "bad risk" for a one-unit increase in the corresponding predictor, holding other variables constant 81.
VariableEffect on Log OddsEffect on Odds
agestd (one-unit increase)Decreases by 1.403Odds decrease
marital (other to married)Decreases by (−2.918−1.717)(-2.918 - 1.717)Odds decrease by approx. 99% (exp⁡(−4.635)≈0.01\exp(-4.635) \approx 0.01)
nr_loans (2 to 1, i.e., -1 unit)Increases by 1.785Odds increase by a factor of exp⁡(1.785)≈5.96\exp(1.785) \approx 5.96
  • Example interpretation: If agestd increases by one unit, the log odds of being a bad risk decrease by 1.403. If marital status changes from 'other' to 'married', the odds of being a bad risk decrease by approximately 99% 81.

14. X i = 0.

14.1 Maximum likelihood estimation

Maximum Likelihood Estimation (MLE) is the primary method for estimating parameters in logit models, assuming the conditional distribution of the dependent variable YY given independent variables XX is known up to a finite number of unknown parameters 83.

  • Conditional distribution: The function F(Yi∣Xi;θ)F(Y_i | X_i; \theta) is assumed to be known, where θ\theta represents the unknown parameters to be estimated.
  • Examples of distributions:
  • Linear regression: Yi∣Xi∼N(Xi⊤β,σ2)Y_i | X_i \sim N(X_i^\top \beta, \sigma^2), with β\beta and σ2\sigma^2 unknown.
  • Logistic regression: Yi∣Xi∼Bernoulli(Pi)Y_i | X_i \sim \text{Bernoulli}(P_i), with Pi=exp⁡{Xi⊤β}1+exp⁡{Xi⊤β}P_i = \frac{\exp\{X_i^\top \beta\}}{1+\exp\{X_i^\top \beta\}} and β\beta unknown 83. This slide presents two examples of probability distributions for a dependent variable Y given independent variables X, used in the context of maximum likelihood estimation.

14.2 Likelihood function

The likelihood function, L(θ)L(\theta), represents the joint conditional density or probability of observing a sample of nn independent and identically distributed (i.i.d.) observations {Yi,Xi}i=1n\{Y_i, X_i\}_{i=1}^n 84 85.

  • Definition: L(θ)=∏i=1nLi(θ)=∏i=1nf(Yi∣Xi;θ)L(\theta) = \prod_{i=1}^n L_i(\theta) = \prod_{i=1}^n f(Y_i | X_i; \theta), where Li(θ)L_i(\theta) is the likelihood contribution of observation ii.
  • Interpretation: It treats the observed data as fixed and varies the parameter θ\theta.
  • Estimation: The MLE for θ\theta, denoted θ^MLE\hat{\theta}_{MLE}, is found by maximizing the likelihood function, or equivalently, the log-likelihood function, which is often computationally simpler.
  • θ^MLE∈arg⁡max⁡θ∈Θlog⁡L(θ)=arg⁡max⁡θ∈Θ∑i=1nlog⁡Li(θ)\hat{\theta}_{MLE} \in \arg \max_{\theta \in \Theta} \log L(\theta) = \arg \max_{\theta \in \Theta} \sum_{i=1}^n \log L_i(\theta) 85. This diagram illustrates the formula for the joint conditional density or probability of observing a sample of n independent and identically distributed observations.

14.3 Score vector and first-order conditions

The score vector, s(θ)s(\theta), is the first derivative of the log-likelihood function with respect to the parameter vector θ\theta 86.

  • Definition: s(θ)=∂log⁡L(θ)∂θ=∑i=1n∂log⁡Li(θ)∂θ=∑i=1nsi(θ)s(\theta) = \frac{\partial \log L(\theta)}{\partial \theta} = \sum_{i=1}^n \frac{\partial \log L_i(\theta)}{\partial \theta} = \sum_{i=1}^n s_i(\theta), where si(θ)s_i(\theta) is the score contribution of observation ii.
  • First-order conditions: At the MLE estimate θ^MLE\hat{\theta}_{MLE}, the score vector must be equal to zero: s(θ^MLE)=∑i=1nsi(θ^MLE)=0s(\hat{\theta}_{MLE}) = \sum_{i=1}^n s_i(\hat{\theta}_{MLE}) = 0.
  • Generalized residuals: The individual score contributions si(θ^MLE)s_i(\hat{\theta}_{MLE}) can be interpreted as generalized residuals 86. This diagram shows the first-order conditions for a model, which are derived from the log-likelihood function.

14.4 Example 1: Linear regression

For a linear regression model under Gaussian Markov (GM) conditions, where ϵ∣X∼N(0,σ2In)\epsilon | X \sim N(0, \sigma^2 I_n), the conditional distribution is Yi∣Xi∼N(Xi⊤β,σ2)Y_i | X_i \sim N(X_i^\top \beta, \sigma^2) 87.

  • Log-likelihood function: log⁡L(β,σ2)=−n2log⁡(2πσ2)−12σ2∑i=1n(Yi−Xi⊤β)2\log L(\beta, \sigma^2) = -\frac{n}{2} \log(2\pi\sigma^2) - \frac{1}{2\sigma^2} \sum_{i=1}^n (Y_i - X_i^\top \beta)^2 This is derived from the probability density function f(Yi∣Xi;β,σ2)=12πσ2exp⁡{−(Yi−Xi⊤β)22σ2}f(Y_i | X_i; \beta, \sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left\{-\frac{(Y_i - X_i^\top \beta)^2}{2\sigma^2}\right\}.

  • First-order condition for β\beta: ∂log⁡L(β,σ2)∂β=1σ2∑i=1nXi(Yi−Xi⊤β)=1σ2X⊤ϵ\frac{\partial \log L(\beta, \sigma^2)}{\partial \beta} = \frac{1}{\sigma^2} \sum_{i=1}^n X_i(Y_i - X_i^\top \beta) = \frac{1}{\sigma^2} X^\top \epsilon 87. The log-likelihood function for a linear regression model is presented, showing its expansion into terms involving the sum of squared errors.

  • MLE estimators:

ParameterMLE Estimator
β\betabβMLE=(X⊤X)−1X⊤Yb\beta_{MLE} = (X^\top X)^{-1}X^\top Y
σ2\sigma^2bσMLE2=n−1∑i=1n(Yi−Xi⊤bβMLE)2b\sigma^2_{MLE} = n^{-1} \sum_{i=1}^n (Y_i - X_i^\top b\beta_{MLE})^2

The MLE estimator for β\beta is equivalent to the Ordinary Least Squares (OLS) estimator, bβMLE=bβOLSb\beta_{MLE} = b\beta_{OLS}. The MLE estimator for σ2\sigma^2 is related to the OLS estimator by bσMLE2=n−pnbσOLS2b\sigma^2_{MLE} = \frac{n-p}{n} b\sigma^2_{OLS}, where pp is the dimension of XiX_i.

  • Bias of σ^MLE2\hat{\sigma}^2_{MLE}: The expected value of σ^MLE2\hat{\sigma}^2_{MLE} conditional on XX is E[σ^MLE2∣X]=n−pnσ2E[\hat{\sigma}^2_{MLE} | X] = \frac{n-p}{n} \sigma^2, indicating that σ^MLE2\hat{\sigma}^2_{MLE} is a consistent but downward-biased estimator 88. Mathematical formulas representing statistical estimations and relationships.

14.5 Example 2: Logistic regression

In a logistic regression model, the probability PiP_i is defined as Pi=exp⁡{Xi⊤β}1+exp⁡{Xi⊤β}P_i = \frac{\exp\{X_i^\top \beta\}}{1+\exp\{X_i^\top \beta\}} 89.

  • Likelihood contribution: For observation ii, the likelihood contribution is PiP_i if Yi=1Y_i = 1 and 1−Pi1-P_i if Yi=0Y_i = 0.

  • Likelihood function: L(β)=∏i=1nPiYi(1−Pi)1−YiL(\beta) = \prod_{i=1}^n P_i^{Y_i} (1 - P_i)^{1-Y_i}.

  • Log-likelihood function: log⁡L(β)=∑i=1n[YiXi⊤β−log⁡(1+exp⁡{Xi⊤β})]\log L(\beta) = \sum_{i=1}^n \left[ Y_i X_i^\top \beta - \log(1 + \exp\{X_i^\top \beta\}) \right] 89. The likelihood function for logistic regression is presented as a product of probabilities.

  • First-order conditions: The derivative of the log-likelihood with respect to β\beta is set to zero to find β^MLE\hat{\beta}_{MLE}: ∂log⁡L(β)∂β=∑i=1n[Yi−exp⁡{Xi⊤β}1+exp⁡{Xi⊤β}]Xi=0\frac{\partial \log L(\beta)}{\partial \beta} = \sum_{i=1}^n \left[ Y_i - \frac{\exp\{X_i^\top \beta\}}{1 + \exp\{X_i^\top \beta\}} \right] X_i = 0 This implies ∑i=1nYiXi=∑i=1nP^iXi\sum_{i=1}^n Y_i X_i = \sum_{i=1}^n \hat{P}_i X_i, where P^i=exp⁡{Xi⊤β^MLE}1+exp⁡{Xi⊤β^MLE}\hat{P}_i = \frac{\exp\{X_i^\top \hat{\beta}_{MLE}\}}{1 + \exp\{X_i^\top \hat{\beta}_{MLE}\}} 90.

  • Interpretation of first-order conditions:

  • If XiX_i includes an intercept, then ∑i=1nYi=∑i=1nP^i\sum_{i=1}^n Y_i = \sum_{i=1}^n \hat{P}_i, meaning the predicted frequency equals the observed frequency.

  • If XiX_i includes an intercept and a dummy variable, the predicted frequency equals the observed frequency for each level of the dummy.

  • If XiX_i only contains an intercept, then P^i=Yˉ\hat{P}_i = \bar{Y}, and β^1,MLE=log⁡(Yˉ1−Yˉ)\hat{\beta}_{1,MLE} = \log\left(\frac{\bar{Y}}{1-\bar{Y}}\right).

📝 Consider a logistic regression model with only an intercept. The first-order conditions imply that the estimated probability P^i\hat{P}_i for each observation is equal to the sample mean of the dependent variable, Yˉ\bar{Y}. This leads to the intercept estimate β^1,MLE\hat{\beta}_{1,MLE} being the log-odds of the observed frequency 91.

15. Probit regression

15.1 Probit model formulation

Probit regression is an alternative to logistic regression for modeling binary outcomes, where the probability of the outcome is linked to a linear combination of predictors through the standard normal distribution function 92.

  • Model definition: The probability PiP_i for an observation ii is given by Φ(Xi⊤β)\Phi(X_i^\top \beta), where Φ\Phi is the cumulative distribution function of the standard normal distribution.
  • Likelihood function: The likelihood L(β)L(\beta) for the probit model is the product of these probabilities for all observations, incorporating the binary outcome YiY_i: L(β)=∏i=1nΦ(Xi⊤β)Yi(1−Φ(Xi⊤β))1−YiL(\beta) = \prod_{i=1}^{n} \Phi(X_i^\top \beta)^{Y_i}(1 -\Phi(X_i^\top \beta))^{1-Y_i} The log-likelihood is the sum of the logarithms of these terms 92. The formula for the likelihood function in probit regression, which involves the product of probabilities for each observation.

15.2 Comparison with logistic regression

While probit and logit models generally yield similar fitted probabilities, their coefficient estimates differ due to a scaling factor 92.

  • Coefficient interpretation: Probit coefficients are not directly comparable to logit coefficients because they are on different scales, reflecting the use of the standard normal CDF versus the logistic CDF 93.
  • Predicted probabilities: Despite coefficient differences, the predicted probabilities from both models are often very similar, especially for probabilities not close to 0 or 1 94.
ModelPredicted Probability 1Predicted Probability 2
Logistic regression0.3850.952
Probit regression0.4130.954

📝 When predicting the probability of a binary outcome for two hypothetical cases using both logistic and probit models, the predicted probabilities are numerically close, such as 0.385 versus 0.413 for the first case and 0.952 versus 0.954 for the second case 94.

16. General properties

16.1 Maximum likelihood estimator properties

Maximum Likelihood Estimators (MLEs) possess several desirable asymptotic properties under weak regularity conditions, assuming a correctly specified likelihood function and independent and identically distributed (i.i.d.) data 96.

PropertyDescription
ConsistencyThe MLE converges in probability to the true parameter value: θ^MLE→pθ\hat{\theta}_{MLE} \xrightarrow{p} \theta
Asymptotic normalityThe MLE, when scaled, follows a normal distribution: n(θ^MLE−θ)→dN(0,V)\sqrt{n}(\hat{\theta}_{MLE} - \theta) \xrightarrow{d} N(0, V)
Asymptotic efficiencyAs n→∞n \to \infty, the MLE achieves the smallest variance among all consistent asymptotically normal estimators

16.2 Fisher information matrix

The Fisher information matrix, I(θ)I(\theta), is crucial for determining the asymptotic covariance matrix VV of the MLE, where V=I(θ)−1V = I(\theta)^{-1} 96.

  • Definition: It is defined as the negative expected value of the second derivative of the log-likelihood function: I(θ)=−E[∂2log⁡Li(θ)∂θ∂θ⊤]I(\theta) = -E\left[ \frac{\partial^2 \log L_i(\theta)}{\partial\theta\partial\theta^\top} \right] 96.
  • Curvature: The Fisher information matrix reflects the curvature of the log-likelihood function around the true parameter θ\theta.
  • Variance relationship: A greater absolute curvature implies larger Fisher information and, consequently, a smaller asymptotic variance for the MLE 97.

The Fisher information matrix is defined as the negative expected value of the second derivative of the log-likelihood function.

📝 If the log-likelihood function has a sharp peak, its curvature is high, indicating that the parameter is precisely estimated, leading to high Fisher information and low variance. Conversely, a flat log-likelihood suggests high uncertainty and low Fisher information.

Diagram illustrating the relationship between the curvature of the log-likelihood function and Fisher information.

16.3 Cramér–Rao lower bound

The inverse of the Fisher information matrix, I(θ)−1I(\theta)^{-1}, represents the Cramér–Rao lower bound, which is the theoretical lower limit on the asymptotic covariance matrix for any consistent, asymptotically normal estimator in a parametric model 98.

  • OLS efficiency: Under the normal linear regression model and Gauss-Markov conditions, the Ordinary Least Squares (OLS) estimator for β\beta attains this Cramér–Rao lower bound, indicating its asymptotic efficiency 98.

16.4 Estimating the asymptotic covariance matrix

The asymptotic covariance matrix can be consistently estimated using two primary methods, which generally do not yield identical results 99.

  • Hessian matrix method (V^H\hat{V}_H): This method uses the observed Hessian matrix (matrix of second-order derivatives of the log-likelihood function) evaluated at the MLE 98. V^H=(−1n∑i=1n∂2log⁡Li(θ)∂θ∂θ⊤∣θ=θ^MLE)−1\hat{V}_H = \left( -\frac{1}{n} \sum_{i=1}^{n} \frac{\partial^2 \log L_i(\theta)}{\partial\theta\partial\theta^\top} \Bigg|_{\theta=\hat{\theta}_{MLE}} \right)^{-1} Formula for estimating the asymptotic covariance matrix using the Hessian matrix.
  • Gradient method (V^G\hat{V}_G): If the likelihood function is correctly specified, the expected value of the outer product of the score vectors, J(θ)=E[si(θ)si(θ)⊤]J(\theta) = E[s_i(\theta)s_i(\theta)^\top], is equal to the Fisher information I(θ)I(\theta). This allows for an alternative estimation using the gradient (vector of first-order derivatives) 99. V^G=(1n∑i=1nsi(θ^MLE)si(θ^MLE)⊤)−1\hat{V}_G = \left( \frac{1}{n} \sum_{i=1}^{n} s_i(\hat{\theta}_{MLE})s_i(\hat{\theta}_{MLE})^\top \right)^{-1} This diagram shows the formula for estimating the asymptotic covariance matrix, denoted as V_G.

17. Goodness–of–fit

17.1 Residual deviance

The residual deviance (DresD_{res}) quantifies the discrepancy between a model of interest and a perfectly fitting saturated model, analogous to the Residual Sum of Squares (RSS) in linear models 101 102.

  • Saturated model: A model with sufficient free parameters to perfectly fit the observed data, yielding the largest achievable log-likelihood, denoted as log⁡L(θ^MLE,s)\log L(\hat{\theta}_{MLE,s}).
  • Logistic regression: For binary outcomes (Yi∈{0,1}Y_i \in \{0, 1\}), the saturated model implies P^i=Yi\hat{P}_i = Y_i, and its log-likelihood log⁡L(θ^MLE,s)=0\log L(\hat{\theta}_{MLE,s}) = 0.
  • Formula: Dres=2[log⁡L(θ^MLE,s)−log⁡L(θ^MLE)]D_{res} = 2[\log L(\hat{\theta}_{MLE,s}) - \log L(\hat{\theta}_{MLE})], where θ^MLE\hat{\theta}_{MLE} are the fitted parameters of the model of interest.
  • Property: Dres≥0D_{res} \ge 0, indicating that the model of interest cannot fit the data better than the saturated model 101.

17.2 Null deviance

The null deviance (DnullD_{null}) measures the distance between an intercept-only model and a perfect fit, serving a similar role to the Total Sum of Squares (TSS) in linear models 102.

  • Intercept-only model: A baseline model that includes only an intercept term, with its estimated parameter denoted as θ^MLE,0\hat{\theta}_{MLE,0}.
  • Formula: Dnull=2[log⁡L(θ^MLE,s)−log⁡L(θ^MLE,0)]D_{null} = 2[\log L(\hat{\theta}_{MLE,s}) - \log L(\hat{\theta}_{MLE,0})].
  • Purpose: It provides a benchmark for assessing how much better a more complex model performs compared to a very simple one 102.

17.3 Pseudo-R2R^2

The pseudo-R2R^2, also known as the likelihood ratio index, is a measure for logistic regression that is analogous to R2R^2 in linear models, quantifying the proportion of null deviance explained by the fitted model 103.

  • Formula: pseudo-R2=1−DresDnull=1−log⁡L(θ^MLE)log⁡L(θ^MLE,0)\text{pseudo-}R^2 = 1 - \frac{D_{res}}{D_{null}} = 1 - \frac{\log L(\hat{\theta}_{MLE})}{\log L(\hat{\theta}_{MLE,0})}.
  • Interpretation: A higher pseudo-R2R^2 indicates that the model explains a larger proportion of the variability in the outcome compared to the intercept-only model.
  • Limitation: Pseudo-R2R^2 never decreases when additional parameters are included, which can lead to overfitting; thus, information criteria are often preferred for model comparison 103.

📝 If a logistic regression model yields a pseudo-R2R^2 of 0.785, it implies that the model explains 78.5% of the null deviance, indicating a substantial improvement over an intercept-only model 105.

17.4 Information criteria

Information criteria, such as AIC and BIC, are used for model comparison by penalizing model complexity, addressing the limitation of pseudo-R2R^2 which does not account for the number of parameters 103 104.

  • K: Represents the total number of parameters in the model.
  • Preference: Lower values of AIC and BIC are preferred when comparing models, particularly during variable selection 104.
CriterionFormulaFocus
Akaike Information Criterion (AIC)2K−2log⁡L(θ^MLE)2K - 2 \log L(\hat{\theta}_{MLE})Prediction
Bayesian Information Criterion (BIC)log⁡(n)K−2log⁡L(θ^MLE)\log(n)K - 2 \log L(\hat{\theta}_{MLE})Identifying the true model

18. Hypothesis testing

18.1 The Wald test

The Wald test is a statistical test used to evaluate the significance of individual regression coefficients or linear combinations of coefficients in a generalized linear model, based on the asymptotic normality of the maximum likelihood estimator (MLE) 107.

  • Hypothesis: The test assesses hypotheses of the form H0:θk=rH_0: \theta_k = r for a single parameter, or more generally, H0:Cθ=QH_0: C\theta = Q for multiple parameters, where CC is a full-rank matrix and QQ is a vector.
  • Test statistic: The Wald test statistic, UWU_W, follows an asymptotic chi-squared distribution under the null hypothesis, with degrees of freedom equal to the number of restrictions (qq) 107.
  • Estimation requirement: This test only requires the estimation of the unrestricted model 108.

The Wald test statistic formula for a general hypothesis

📝 To test the significance of the marital variable in a logistic regression model, represented by H0:β3=β4=0H_0: \beta_3 = \beta_4 = 0, a Wald test yields UW=16.3U_W = 16.3 with a p-value less than 0.001, indicating strong evidence against the null hypothesis 110.

18.2 The likelihood ratio test

The likelihood ratio (LR) test compares the log-likelihoods of two nested models: a full model and a restricted model under the null hypothesis 108.

  • Test statistic: The LR test statistic, ULRU_{LR}, is twice the difference between the log-likelihood of the unrestricted model and the log-likelihood of the restricted model.
  • Distribution: Under the null hypothesis H0:Cθ=QH_0: C\theta = Q, ULRU_{LR} asymptotically follows a chi-squared distribution with qq degrees of freedom.
  • Computation: This test is straightforward to compute but necessitates estimating both the full (unrestricted) and the reduced (restricted) models 108.

📝 For the marital variable significance test (H0:β3=β4=0H_0: \beta_3 = \beta_4 = 0), the LR test statistic ULR=22.1U_{LR} = 22.1 with a p-value less than 0.001, suggesting that the marital variable significantly contributes to the model 111.

18.3 The score test

The score test, also known as Rao's test, evaluates the null hypothesis by examining the gradient of the log-likelihood function (the score vector) at the maximum likelihood estimates obtained under the restricted model 109.

  • Test statistic: The score test statistic, USCU_{SC}, involves the score vector of the unrestricted model evaluated at the restricted MLE, and the inverse of the information matrix evaluated at the same point.
  • Distribution: If H0:Cθ=QH_0: C\theta = Q, USCU_{SC} asymptotically follows a chi-squared distribution with qq degrees of freedom.
  • Estimation requirement: This test only requires the estimation of the restricted model under the null hypothesis 109.

📝 When testing H0:β3=β4=0H_0: \beta_3 = \beta_4 = 0 for the marital variable, the score test yields USC=21.9U_{SC} = 21.9 with a p-value less than 0.001, indicating that the restricted model is significantly worse than the full model 111.

18.4 Comparison of hypothesis tests

The Wald, Likelihood Ratio, and Score tests are distinct methods for hypothesis testing in generalized linear models, each with specific computational requirements and theoretical underpinnings 109.

Test TypeComputational RequirementBasis
Wald testEstimates of the unrestricted model onlyAsymptotic normality of MLE
Likelihood Ratio testEstimates of both unrestricted and restricted modelsComparison of log-likelihoods
Score testEstimates of the restricted model onlyScore vector at restricted MLE
  • Asymptotic equivalence: Despite their differences in approach, these three tests are generally asymptotically equivalent, meaning they tend to produce similar results for large sample sizes 109.

19. Prediction

19.1 Predicting probabilities with logistic regression

Logistic regression models are used to predict the probability of an individual belonging to a specific category, such as being a "bad risk" customer. The model outputs a probability score, bP0bP_0, for each individual based on their characteristics 113.

📝 For a customer with characteristics x0⊤=(1,−1,0,1,−1,0,0)x_0^\top = (1, -1, 0, 1, -1, 0, 0), the predicted probability of being a bad risk customer is approximately 0.9990.999. Conversely, for x0⊤=(1,2,1,0,1,1,0)x_0^\top = (1, 2, 1, 0, 1, 1, 0), the probability is approximately 0.0010.001 113.

19.2 Classification and the confusion matrix

Individuals can be classified into risk categories by comparing their predicted probability (bPibP_i) against a chosen threshold (cc). If bPi>cbP_i > c, the individual is classified as "bad risk".

The performance of this classification is evaluated using a confusion matrix, which summarizes the counts of correct and incorrect predictions against actual outcomes 114.

A confusion matrix displays the results of a classification model, showing actual versus predicted outcomes.

MetricFormula
Error rate(False Positives+False Negatives)/Total(\text{False Positives} + \text{False Negatives}) / \text{Total}
Accuracy(True Positives+True Negatives)/Total(\text{True Positives} + \text{True Negatives}) / \text{Total}

📝 With a threshold c=0.5c = 0.5, a confusion matrix might show 115 actual good customers predicted as good, 7 actual bad customers predicted as good, 8 actual good customers predicted as bad, and 116 actual bad customers predicted as bad. This results in an error rate of (7+8)/246=0.061(7+8)/246 = 0.061 and an accuracy of (115+116)/246=0.939(115+116)/246 = 0.939 114.

19.3 Sensitivity and specificity

The general confusion matrix provides a framework for understanding classification outcomes, defining key metrics like sensitivity and specificity 115.

A confusion matrix showing the breakdown of predicted versus actual classifications.

TermDefinition
True Negatives (TN)Correctly predicted negative outcomes
False Negatives (FN)Incorrectly predicted negative outcomes (actual positive)
False Positives (FP)Incorrectly predicted positive outcomes (actual negative)
True Positives (TP)Correctly predicted positive outcomes
  • Sensitivity (recall): This is the proportion of actual positive cases that are correctly identified, calculated as TP/PTP/P, where PP is the total number of actual positive cases.
  • Specificity: This is the proportion of actual negative cases that are correctly identified, calculated as TN/NTN/N, where NN is the total number of actual negative cases.
  • Trade-off: There is an inherent trade-off between sensitivity and specificity as the classification threshold (cc) changes 115.

19.4 Receiver Operating Characteristic (ROC) curve and AUC

The Receiver Operating Characteristic (ROC) curve is a graphical plot that illustrates the diagnostic ability of a binary classifier system as its discrimination threshold is varied. It plots sensitivity against 1-specificity (False Positive Rate) 115 116.

This is a Receiver Operating Characteristic (ROC) curve, plotting the sensitivity against 1-specificity.

  • Area Under the Curve (AUC): This metric quantifies the overall performance of a classifier, representing the probability that the model ranks a randomly chosen positive instance higher than a randomly chosen negative instance.
  • Ideal performance: An ideal ROC curve hugs the top-left corner, indicating high sensitivity and high specificity, resulting in a larger AUC 117.
AUC ValueInterpretation
0.5Equivalent to random guessing
> 0.5Discriminates better than random
< 0.5Ranks classes in the wrong direction (predictions should be reversed)

📝 An AUC of 0.98660.9866 indicates excellent classifier performance, significantly better than random guessing. At a threshold of c=0.5c = 0.5, the sensitivity is approximately 0.9430.943 and specificity is approximately 0.9350.935. In credit risk, where classifying bad risk customers as good risk (False Negatives) is a major concern, decreasing the threshold to c=0.25c = 0.25 can increase sensitivity to approximately 0.9590.959 while decreasing specificity to approximately 0.8700.870 117 118.

20. The generalized linear model

20.1 Definition and structure of generalized linear models

Generalized Linear Models (GLMs) provide a flexible framework for modeling various types of response variables by extending ordinary linear regression. This framework assumes that the conditional expectation of the response variable, given the covariates, is related to a linear predictor through a link function 120.

  • Core components:
  • Linear predictor (Xi⊤βX_i^\top \beta): A linear combination of the predictor variables and their coefficients.
  • Link function (η\eta): A function that transforms the expected value of the response variable to the linear predictor, such that η(E[Yi∣Xi])=Xi⊤β\eta(E[Y_i | X_i]) = X_i^\top \beta.
  • Inverse link function (η−1\eta^{-1}): Transforms the linear predictor back to the expected value of the response, E[Yi∣Xi]=η−1(Xi⊤β)E[Y_i | X_i] = \eta^{-1}(X_i^\top \beta).
  • Exponential family distribution: The distribution of the response variable YiY_i given XiX_i must belong to the exponential family of distributions 120.
Regression TypeExpected Value FormulaLink Function
Linear RegressionE[Yi∣Xi]=Xi⊤βE[Y_i \vert X_i] = X_i^\top \betaIdentity (η(x)=x\eta(x) = x)
Logistic RegressionE[Yi∣Xi]=exp⁡{Xi⊤β}1+exp⁡{Xi⊤β}E[Y_i \vert X_i] = \frac{\exp\{X_i^\top \beta\}}{1+\exp\{X_i^\top \beta\}}Logit (η(p)=log⁡(p1−p)\eta(p) = \log(\frac{p}{1-p}))

20.2 Poisson regression for count data

Poisson regression is a specific type of GLM used when the response variable represents count data, meaning it takes non-negative integer values 121.

  • Poisson distribution:
  • Probability mass function: P(Yi=k)=exp⁡−λλkk!P(Y_i = k) = \frac{\exp\\{-\lambda\\}\lambda^k}{k!}, for k=0,1,2,…k = 0, 1, 2, \dots.
  • Mean and variance: For a Poisson distribution, the mean and variance are equal, E[Yi]=Var(Yi)=λE[Y_i] = Var(Y_i) = \lambda, where λ>0\lambda > 0.
  • Modeling the mean: In Poisson regression, the mean λ\lambda is linked to the covariates through an exponential function: λ=E[Yi∣Xi]=exp⁡Xi⊤β\lambda = E[Y_i | X_i] = \exp\\{X_i^\top \beta\\}.
  • Estimation: Model parameters (β\beta) are typically estimated using maximum likelihood estimation 121.

📝 If a Poisson regression model yields a coefficient of -0.2642 for incomestd, an increase of 1 unit in incomestd multiplies the expected number of loans by exp⁡(−0.2642)≈0.768\exp(-0.2642) \approx 0.768. Similarly, if the coefficient for marital (single vs. married) is 0.27737, single individuals are expected to have exp⁡(0.27737)≈1.32\exp(0.27737) \approx 1.32 times more loans than married individuals, representing a 32% increase 122.

This image displays the output of a statistical model summary, likely a Poisson regression, showing coefficients, standard errors, z-values, and p-values for various predictor variables.

21. Causal inference

21.1 Association versus causation

Causal inference focuses on determining the causal effect of one variable on another, distinguishing it from mere association between variables. Association implies a relationship, but not necessarily that one variable directly influences the other 124.

ConceptDescription
AssociationDescribes a relationship between two variables without implying direct influence.
CausationIdentifies a direct influence of one variable on another, where a change in one leads to a change in the other.

📝 Wearing sunglasses is associated with eating ice cream, but neither causes the other; both are caused by the presence of the sun 125.

21.2 The fundamental problem of causal inference

The fundamental problem of causal inference arises because it is impossible to observe an individual's outcome under both treatment and control conditions simultaneously. For any given individual, we can only observe one of the potential outcomes 125.

  • Policy evaluation: Causal inference is crucial for evaluating the effectiveness of policies, medical treatments, and interventions.
  • Binary treatment: We are typically interested in the causal effect of a binary treatment, Zi∈{0,1}Z_i \in \{0, 1\}, on an outcome of interest, YiY_i 126.

21.3 Potential outcomes and counterfactuals

Potential outcomes define what an individual's outcome would be under different treatment assignments. Yi(1)Y_i(1) represents the outcome if an individual receives the treatment (Zi=1Z_i=1), and Yi(0)Y_i(0) represents the outcome if they do not (Zi=0Z_i=0) 127.

  • Observed outcome: The observed outcome YiY_i is a function of the actual treatment received: Yi=Zi×Yi(1)+(1−Zi)×Yi(0)Y_i = Z_i \times Y_i(1) + (1 - Z_i) \times Y_i(0).
  • Counterfactual outcome: If Zi=0Z_i=0, then Yi(1)Y_i(1) is the counterfactual outcome for individual ii, representing what would have happened if they had received treatment. Conversely, if Zi=1Z_i=1, then Yi(0)Y_i(0) is the counterfactual 127.

📝 For an individual participating in a job-training program, Yi(1)Y_i(1) would be their earnings if they participated, and Yi(0)Y_i(0) would be their earnings if they did not participate 127.

21.4 Stable-unit-treatment-value assumption (SUTVA)

SUTVA is a critical assumption in causal inference that ensures the treatment is well-defined and that an individual's outcome is only affected by their own treatment assignment. It comprises two main components 128.

AssumptionDescription
ConsistencyThe observed outcome YiY_i is precisely the potential outcome Yi(z)Y_i(z) if the individual actually received treatment zz. This implies no ambiguity in treatment definition.
No interferenceAn individual's outcome Yi(Z)Y_i(Z) is solely determined by their own treatment ZiZ_i, not by the treatments ZjZ_j received by other individuals j≠ij \neq i.
  • Implication: SUTVA ensures that there is only one version of treatment and that treatment assignment to one unit does not affect the outcomes of other units 128.

21.5 Identifiability of causal effects

Individual causal effects, such as Yi(1)−Yi(0)Y_i(1) - Y_i(0), are generally not identifiable from observed data due to the fundamental problem of causal inference. Identifiability means that the causal effect can be uniquely determined from the observed data given a set of assumptions 129.

  • Average treatment effect (ATE): Researchers often focus on aggregated causal effects, such as the average treatment effect (ATE), defined as E[Yi(1)−Yi(0)]E[Y_i(1) - Y_i(0)]. This represents the average difference in potential outcomes across the entire population.
  • Assumptions for identification: Specific assumptions are required to identify different causal treatment effects, which then allow for estimation methods to be applied 129.

22. Randomized controlled trials

22.1 Definition and principles of RCTs

A randomized controlled trial (RCT) is a study design where individuals are randomly assigned to either a treatment group or a control group, ensuring that any observed differences between groups can be attributed to the treatment 130 131.

  • Treatment randomization: This is represented by Zi⊥⊥(Yi(0),Yi(1))Z_i \perp \perp (Y_i(0), Y_i(1)), indicating statistical independence between treatment assignment (ZiZ_i) and potential outcomes (Yi(0)Y_i(0) for control, Yi(1)Y_i(1) for treatment).
  • Exchangeability: A direct consequence of treatment randomization, meaning that the treated and untreated groups are statistically equivalent in all aspects, both observed and unobserved, prior to treatment 131.
  • This implies that treatment assignment does not systematically depend on an individual's expected performance with or without treatment.
  • Violation occurs if treatment is deliberately assigned based on expected outcomes, such as giving treatment more often to individuals expected to perform poorly without it.
  • Exchangeability does not mean Zi⊥⊥YiZ_i \perp \perp Y_i, which would imply no causal effect of ZiZ_i on YiY_i 132.

22.2 Identification of the average treatment effect (ATE)

Under treatment exogeneity, which is achieved through randomization in RCTs, the Average Treatment Effect (ATE) can be directly identified from observed data. This is because any differences between groups are due to the treatment, and missing potential outcomes are solely due to chance 133.

  • Treatment exogeneity: The treatment assignment is independent of potential outcomes, meaning the treatment is not influenced by factors that also affect the outcome.
  • ATE identification: The ATE is defined as the expected difference between potential outcomes and can be estimated by the difference in observed means between the treated and control groups 133.

Mathematical equations illustrating the identification of the Average Treatment Effect (ATE) under treatment exogeneity.

📝 In an RCT, if a new drug is randomly assigned, any observed difference in health outcomes between the drug group and the placebo group can be causally attributed to the drug. This is because randomization ensures that, on average, both groups were comparable in all other health-related factors before the drug was administered 133.

22.3 Statistical testing of ATE in RCTs

To test the null hypothesis that the ATE is zero (H0:ATE=0H_0: ATE = 0), a two-sample proportion Z-test can be employed, especially when the outcome is binary 135.

  • Test statistic: Under the null hypothesis, the difference in sample proportions, normalized by the standard error, asymptotically follows a standard normal distribution. Yˉ1−Yˉ0Yˉ(1−Yˉ)(1n0+1n1)\frac{\bar{Y}_1 - \bar{Y}_0}{\sqrt{\bar{Y}(1-\bar{Y})\left(\frac{1}{n_0} + \frac{1}{n_1}\right)}}
  • Variables:
  • n1n_1: Number of individuals in the treatment group.
  • n0n_0: Number of individuals in the control group.
  • Yˉ1\bar{Y}_1: Mean outcome in the treatment group.
  • Yˉ0\bar{Y}_0: Mean outcome in the control group.
  • Yˉ\bar{Y}: Overall mean outcome 135.

📝 In a randomized trial of streptomycin versus placebo for tuberculosis, with 107 patients, the outcome was "improved" (binary). The observed ATE was 0.364, indicating a 36.4 percentage-point increase in the probability of improvement due to streptomycin. A prop.test yielded a p-value less than 0.001, suggesting a statistically significant effect 134 136 137.

22.4 Limitations of RCTs and observational studies

While RCTs are considered the gold standard for causal inference due to their inherent exchangeability, they are not always feasible or ethical 137.

  • Observational studies: In these studies, treatment is not randomly assigned, leading to potential systematic differences between treated and untreated individuals before treatment.
  • Confounding: This occurs when a variable influences both treatment assignment and the outcome, creating a spurious association. For instance, age might confound the relationship between job-training participation and earnings if younger individuals are more likely to participate and also earn less regardless of participation 137.
Study TypeTreatment AssignmentExchangeabilityCausal Inference
Randomized Controlled Trial (RCT)RandomAchieved by designDirect (correlation = causation)
Observational StudyNon-randomNot guaranteedChallenging (potential confounding)

23. Measured confounding

23.1 Definition of measured confounding

Measured confounding occurs when a confounder, which is an observed variable, influences both the treatment and the outcome of interest. This creates a non-causal association between the treatment and outcome, making direct comparisons between treated and untreated groups unreliable 139 140.

A causal directed acyclic graph (DAG) illustrating measured confounding.

  • Causal DAG: A directed acyclic graph visually represents causal relationships, where arrows indicate the direction of influence.
  • Confounder (XiX_i): A variable that affects both the treatment participation (ZiZ_i) and the outcome (YiY_i) 139.
  • Non-exchangeability: Due to confounding, the treated and untreated groups are not comparable, meaning they differ systematically in ways that affect the outcome, beyond the treatment itself 140.

📝 In a study examining the effect of higher education on lifetime income, family income could act as a confounder. Higher family income might increase the likelihood of completing higher education and also directly contribute to higher lifetime income, independent of education 140.

23.2 Simulation example

A simulation can demonstrate how measured confounding leads to biased estimates of treatment effects, even when the true average treatment effect (ATE) is zero 141.

  • Simulation setup:
  • A sample size (nn) of 1000 is generated.
  • A confounder (XX) is drawn from a uniform distribution between -1 and 1.
  • Treatment participation (ZZ) is a binary variable, influenced by XX.
  • The outcome (YY) is determined by a constant, XX, and random noise, but not directly by ZZ.
  • Observed ATE: The difference in mean outcomes between the treated (Z=1Z=1) and untreated (Z=0Z=0) groups is calculated.
  • Result: Despite the true ATE being 0 in the simulation design, the observed ATE (ATERCT) was 1.051 with a statistically significant p-value (<0.001< 0.001), indicating a spurious effect due to confounding 141.

24. Assumptions

24.1 Conditional exchangeability (ignorability)

Conditional exchangeability, also known as ignorability, is a fundamental assumption in causal inference for observational studies, positing that treatment assignment is effectively random once all observed confounders are accounted for 143.

  • Definition: The treatment assignment ZiZ_i is conditionally independent of the potential outcomes (Yi(0),Yi(1))(Y_i(0), Y_i(1)) given the observed covariates XiX_i.
  • Implication: All confounding variables influencing both treatment assignment and outcomes are observed and included in XiX_i.
  • Testability: This assumption is generally untestable in observational studies, requiring substantive knowledge of the data-generating process 143.

Mathematical notation representing conditional independence in causal inference.

📝 If physicians assign a treatment based on patient age and baseline disease severity, conditional exchangeability assumes that, within groups of patients with similar age and disease severity, the treatment assignment is random with respect to their potential outcomes 143.

24.2 Positivity (overlap)

The positivity, or overlap, assumption is crucial for identifying treatment effects, ensuring that for every covariate profile, there is a non-zero probability of receiving any treatment 144.

  • Definition: For all xx in the support of XiX_i, the probability of receiving treatment Zi=1Z_i=1 given Xi=xX_i=x, denoted as the propensity score e(x)=P(Zi=1∣Xi=x)e(x) = P(Z_i = 1 | X_i = x), must be strictly between 0 and 1, i.e., e(x)∈(γ,1−γ)e(x) \in (\gamma, 1-\gamma) for some γ>0\gamma > 0.
  • Intuition: Both treated and untreated individuals must be present within each relevant covariate group, allowing for meaningful comparisons 144.

24.3 Strong ignorability

Strong ignorability combines conditional exchangeability and positivity, forming a sufficient condition for identifying average treatment effects (ATE) from observed data 145.

  • Identification: Under strong ignorability, the expected potential outcomes E[Yi(1)]E[Y_i(1)] and E[Yi(0)]E[Y_i(0)] can be identified from observed data by integrating conditional expectations over the distribution of covariates 145.
AssumptionCondition
Conditional ExchangeabilityZi⊥⊥(Yi(0),Yi(1))∣XiZ_i \perp \perp (Y_i(0), Y_i(1)) \vert X_i
PositivityP(Zi=1∣Xi=x)∈(γ,1−γ)P(Z_i = 1 \vert X_i = x) \in (\gamma, 1-\gamma) for all xx and γ>0\gamma > 0

25. Regression estimators

25.1 Estimating the average treatment effect with regression

Regression estimators are used to estimate causal effects, specifically the Average Treatment Effect (ATE), under the assumption of strong ignorability. This approach involves estimating the conditional expectation of the outcome given the treatment status and covariates 147.

  • Conditional expectation: μ(z,x)=E[Yi∣Zi=z,Xi=x]\mu(z, x) = E[Y_i | Z_i = z, X_i = x], representing the expected outcome YiY_i for an individual ii with treatment status Zi=zZ_i = z and covariates Xi=xX_i = x.
  • Strong ignorability: A key assumption that allows for the identification of causal effects, implying that treatment assignment is independent of potential outcomes given observed covariates.
  • ATE estimation: Under strong ignorability, the ATE, E[Yi(1)−Yi(0)]E[Y_i(1) - Y_i(0)], can be estimated by E[μ(1,Xi)−μ(0,Xi)]E[\mu(1, X_i) - \mu(0, X_i)].
  • Consistent estimator: If bμ(z,x)b\mu(z, x) is a consistent estimator of μ(z,x)\mu(z, x), then the ATE can be consistently estimated by averaging the difference in predicted outcomes across all individuals: ATEREG=n−1∑i=1n{bμ(1,Xi)−bμ(0,Xi)}\text{ATEREG} = n^{-1} \sum_{i=1}^{n} \{b\mu(1, X_i) - b\mu(0, X_i)\} This regression function bμ(z,x)b\mu(z, x) can be estimated using various methods, including linear regression, generalized linear models, or machine learning techniques 147.

This diagram shows an equation for the average treatment effect (ATE) using regression estimation.

25.2 Linear regression example

When the conditional expectation μ(z,x)\mu(z, x) is modeled using linear regression, the ATE can be directly estimated by the coefficient of the treatment variable 148.

  • Model specification: μ(z,x)=β1+β2z+β3x\mu(z, x) = \beta_1 + \beta_2z + \beta_3x, where β2\beta_2 represents the effect of the treatment zz.
  • OLS estimate: bμ(z,x)=bβ1+bβ2z+bβ3xb\mu(z, x) = b\beta_1 + b\beta_2z + b\beta_3x is the Ordinary Least Squares (OLS) estimate of μ(z,x)\mu(z, x).
  • ATE calculation: Under strong ignorability and correct model specification, the ATEREG simplifies to bβ2b\beta_2, which is a consistent estimator of the ATE and has a causal interpretation 148.

📝 If a linear regression model lm(Y~Z) is fitted, where Y is the outcome and Z is the treatment, the estimated coefficient for Z (e.g., 1.0511.051 with a p-value <0.001< 0.001) directly represents the ATE 150.

25.3 Logistic regression example

For binary outcomes, logistic regression is used to model the conditional expectation, and the ATE calculation differs from linear regression 149.

  • Binary outcome: YiY_i is a binary variable.
  • Logistic model: μ(z,x)=Λ(β1+β2z+β3x)\mu(z, x) = \Lambda(\beta_1 + \beta_2z + \beta_3x), where Λ(u)=exp⁡(u)1+exp⁡(u)\Lambda(u) = \frac{\exp(u)}{1+\exp(u)} is the logistic function.
  • MLE estimate: bμ(z,x)=Λ(bβ1+bβ2z+bβ3x)b\mu(z, x) = \Lambda(b\beta_1 + b\beta_2z + b\beta_3x) is the Maximum Likelihood Estimate (MLE) from logistic regression.
  • ATE calculation: Unlike linear regression, bβ2b\beta_2 itself is not the ATE. Instead, the ATEREG is calculated by averaging the difference in predicted probabilities: ATEREG=n−1∑i=1n{Λ(bβ1+bβ2+bβ3Xi)−Λ(bβ1+bβ3Xi)}\text{ATEREG} = n^{-1} \sum_{i=1}^{n} \left\{ \Lambda(b\beta_1 + b\beta_2 + b\beta_3X_i) - \Lambda(b\beta_1 + b\beta_3X_i) \right\} 149.

This diagram illustrates the logistic regression model and its components.

Regression TypeOutcome TypeATE Estimation
Linear RegressionContinuousCoefficient of treatment variable (bβ2b\beta_2)
Logistic RegressionBinaryAverage of predicted probability differences

📝 When fitting lm(Y~Z+X) where Y is the outcome, Z is treatment, and X is a covariate, the ATEREG might be approximately 0 with a p-value of 0.4580.458, indicating no significant treatment effect after controlling for X 151.

26. Matching estimators

26.1 Introduction to matching estimators

Matching estimators are a causal inference technique used to estimate treatment effects by pairing treated individuals with similar untreated individuals based on observed covariates. The primary goal is to construct a counterfactual for each treated individual by identifying untreated counterparts that share similar characteristics 153.

  • Treated individuals (Zi=1Z_i = 1): For each treated individual ii, the observed outcome Yi(1)Y_i(1) is YiY_i. The missing potential outcome Yi(0)Y_i(0) is estimated by averaging the outcomes of kk nearest untreated neighbors.
  • Untreated individuals (Zi=0Z_i = 0): A similar process is applied to estimate Yi(1)Y_i(1) for untreated individuals, using treated neighbors.
  • kk-nearest neighbors (Mk(i)M_k(i)): This set consists of kk untreated individuals (Zj=0Z_j=0) whose covariate values XjX_j are closest to the treated individual's XiX_i, minimizing a chosen distance metric ∥Xi−Xj∥\lVert X_i - X_j \rVert. Y^i(0)=k−1∑j∈Mk(i)Yj\hat{Y}_i(0) = k^{-1} \sum_{j \in M_k(i)} Y_j 153.

26.2 Average treatment effect estimation

Under the assumption of strong ignorability, the average treatment effect (ATE) can be estimated by averaging the difference between the estimated potential outcomes for all individuals. This approach aims to balance covariates between treatment and control groups, thereby reducing confounding. ATE^MATCH=n−1∑i=1n(Y^i(1)−Y^i(0))\widehat{ATE}_{MATCH} = n^{-1} \sum_{i=1}^n \left( \hat{Y}_i(1) - \hat{Y}_i(0) \right) 154.

26.3 Bias-variance trade-off in matching

The selection of the number of matches (kk) involves a critical bias-variance trade-off, a fundamental concept in statistical learning. This choice impacts the quality of the matches and the stability of the ATE estimate 154.

Number of matches (k)Effect on matchesEffect on variability
Small kCloser matchesMore variability
Large kLess similar matchesLess variability

26.4 Choice of distance metrics

The selection of a distance metric is crucial for accurately identifying similar individuals. Different metrics quantify similarity in distinct ways, influencing the composition of the kk-nearest neighbors 154.

Distance metricFormulaDescription
Euclidean distance∑ℓ=1p(Xiℓ−Xjℓ)2\sqrt{\sum_{\ell=1}^p (X_{i\ell} - X_{j\ell})^2}Standard straight-line distance; requires covariate standardization.
Mahalanobis distance(Xi−Xj)⊤SX−1(Xi−Xj)\sqrt{(X_i - X_j)^\top S_X^{-1} (X_i - X_j)}Accounts for correlations between covariates and scales them by their variance; SXS_X is the estimated covariance matrix of covariates.

📝 In a simulation using the Matching library, an ATE was estimated with k=1k=1 nearest neighbor and Mahalanobis distance. The Match function was called with Y (outcome), Tr (treatment indicator), X (covariates), estimand = "ATE", M = 1, and Weight = 2 (for Mahalanobis distance). The resulting ATE^MATCH\widehat{ATE}_{MATCH} was approximately 0, with a p-value of 0.509, suggesting no significant treatment effect in this specific simulation 155.

27. Propensity score estimators

27.1 Propensity score and conditional exchangeability

Propensity score estimators leverage the probability of treatment assignment conditional on covariates, e(Xi)=P(Zi=1∣Xi)e(X_i) = P(Z_i=1 | X_i), to achieve conditional exchangeability. Under this condition, treatment assignment ZiZ_i is independent of potential outcomes (Yi(0),Yi(1))(Y_i(0), Y_i(1)) given the propensity score e(Xi)e(X_i) 157.

  • Strong ignorability: This condition allows for identification of the Average Treatment Effect (ATE) by conditioning on the scalar propensity score e(Xi)e(X_i) instead of the full set of covariates XiX_i.
  • Application in estimators: Propensity scores can be used in matching estimators by pairing individuals based on the absolute difference in their propensity scores, ∣e(Xi)−e(Xj)∣|e(X_i) - e(X_j)|. They can also be incorporated into regression estimators, though a simple linear regression on the propensity score may be misspecified 157.

27.2 Inverse Probability Weighting (IPW) for ATE

Under positivity and conditional exchangeability, the Average Treatment Effect (ATE) can be identified using inverse probability weighting. This method reweights observations to account for confounding by balancing covariates between treatment groups 158.

  • Identification of E[Yi(1)]E[Y_i(1)]: The expected value of the outcome under treatment, E[Yi(1)]E[Y_i(1)], can be expressed as E[ZiYie(Xi)]E\left[\frac{Z_iY_i}{e(X_i)}\right].
  • ATE formula: The ATE is identified as the difference between the reweighted expected outcomes for the treated and control groups: ATE=E[ZiYie(Xi)−(1−Zi)Yi1−e(Xi)]ATE = E\left[\frac{Z_iY_i}{e(X_i)} - \frac{(1-Z_i)Y_i}{1-e(X_i)}\right] 158.

📝 The ATE is identified as E[ZiYie(Xi)−(1−Zi)Yi1−e(Xi)]E\left[\frac{Z_iY_i}{e(X_i)} - \frac{(1-Z_i)Y_i}{1-e(X_i)}\right] 158.

27.3 Horvitz-Thompson and Hájek estimators

When a consistent estimator e^(Xi)\hat{e}(X_i) of the propensity score is available, the ATE can be consistently estimated using IPW estimators. These estimators differ in how they normalize the weights 159.

EstimatorFormula
Horvitz-Thompson estimatorATE^IPW=n−1∑i=1n[1(Zi=1)Yie^(Xi)−1(Zi=0)Yi1−e^(Xi)]\widehat{ATE}_{IPW} = n^{-1} \sum_{i=1}^{n} \left[ \frac{1(Z_i = 1)Y_i}{\hat{e}(X_i)} - \frac{1(Z_i = 0)Y_i}{1-\hat{e}(X_i)} \right]
Hájek estimatorATE^IPW∗=∑i=1n1(Zi=1)Yie^(Xi)∑i=1n1(Zi=1)e^(Xi)−∑i=1n1(Zi=0)Yi1−e^(Xi)∑i=1n1(Zi=0)1−e^(Xi)\widehat{ATE}_{IPW}^\ast = \frac{\sum_{i=1}^{n} \frac{1(Z_i=1)Y_i}{\hat{e}(X_i)}}{\sum_{i=1}^{n} \frac{1(Z_i=1)}{\hat{e}(X_i)}} - \frac{\sum_{i=1}^{n} \frac{1(Z_i=0)Y_i}{1-\hat{e}(X_i)}}{\sum_{i=1}^{n} \frac{1(Z_i=0)}{1-\hat{e}(X_i)}}
  • Stability: The Hájek estimator, which normalizes the weights, is often more stable than the Horvitz-Thompson estimator 159.

27.4 Propensity score estimation methods

The propensity score e(Xi)e(X_i) can be estimated using various statistical models, with logistic regression being a common choice 160.

  • Logistic regression: This method models the probability of treatment assignment as a function of covariates using a logit link function. Formula for estimating the propensity score using logistic regression. The formula e^(Xi)=exp⁡{Xi⊤β^}1+exp⁡{Xi⊤β^}\hat{e}(X_i) = \frac{\exp\{X_i^\top \hat{\beta}\}}{1 + \exp\{X_i^\top \hat{\beta}\}} provides the estimated propensity score.
  • Alternative methods: Other methods like probit regression and more flexible machine learning techniques can also be employed for propensity score estimation.
  • Efficiency improvement: A counterintuitive finding is that estimating the propensity score can enhance the efficiency of IPW estimators, even when the true propensity score is known. Using an estimated propensity score, e^\hat{e}, can lead to a smaller asymptotic variance compared to using the true propensity score, ee 160.

27.5 Simulation example

A simulation demonstrates the application of the Hájek estimator and the impact of using an estimated versus true propensity score on estimator efficiency 161.

  • Hájek estimator with logistic model: Using the PSweight package in R, a Hájek estimator with a logistic model for the propensity score can be fitted. In a simulated example where the true ATE is 0, the estimator yields a result close to 0 with a non-significant p-value 161. This is a simulation example showing the output of a statistical model with a table of results.
  • Impact of true propensity score: When the true propensity score is used instead of an estimated one, the standard error of the ATE estimate increases, and the confidence interval becomes significantly wider (e.g., 66% wider in the simulation). This illustrates the efficiency gain from estimating the propensity score 162.

28. The JTPA data set

28.1 The National Job Training Partnership Act (JTPA) Study

The National Job Training Partnership Act (JTPA) Study was conducted between 1987 and 1989 to evaluate the effectiveness of over 600 federally funded job-training programs in the United States. These programs offered services such as classroom training, on-the-job training, and job search assistance 164.

  • Study participants: Over 20,000 eligible adults and out-of-school youths were enrolled, with follow-up data collected on employment, earnings, and program participation 164.
  • Random assignment: Participants were initially randomly assigned to either a treatment group (eligible for JTPA services) or a control group (not eligible for 18 months).
  • Noncompliance: Approximately 3% of the control group members accessed JTPA services despite their assignment, indicating potential noncompliance with randomization guidelines.
  • Confounding: Noncompliance can lead to confounding if individuals self-select into programs, potentially biasing the assessment of JTPA participation.
  • Sample restriction: The dataset used for analysis is restricted to 9,223 individuals aged 22 or older 165.

28.2 Observed variables in the JTPA dataset

The jtpa.csv dataset includes several observed variables crucial for assessing the causal effect of job training programs on earnings 166.

VariableDescription
earningsTotal earnings (in USD) in the 30 months following random assignment
sex1 if male, 0 if female
eduYears of completed education
prevearnTotal earnings (in USD) during the 12 months before random assignment
Z1 if participation in job training program, 0 if no participation
W1 if assigned to treatment group, 0 if assigned to control group
  • Research interest: The primary objective is to determine the causal effect of the job training program on participants' earnings 166.

28.3 Causal inference estimators and their results

Various causal inference estimators were applied to the JTPA dataset to estimate the average treatment effect (ATE) of the job training program on earnings. These methods include regression, matching, and inverse probability weighting 167 168 169.

  • Regression estimator (ATE_REG): A linear model lm(earnings~sex+edu+prevearn+Z, data=jtpadata) yielded an ATE_REG of 2796.9 USD with a p-value < 0.001 167.
  • Matching estimator (ATE_MATCH): Using Match with Y = jtpadata$earnings, Tr = jtpadata$Z, and X = cbind(jtpadata$sex, jtpadata$edu, jtpadata$prevearn), an ATE_MATCH of 2719.4 USD was obtained with a p-value < 0.001 168.
  • Inverse Probability Weighting (ATE_IPW): The PSweight function with ps.formula = Z ~ sex+edu+prevearn and yname = "earnings" resulted in an ATE_IPW of 2813.7 USD with a p-value < 0.001 169.
  • Naive estimator (ATE_RCT): A simple linear model lm(earnings~Z, data=jtpadata) that ignores measured confounding produced an ATE_RCT of 2690.4 USD with a p-value < 0.001.
  • Bias observation: Ignoring measured confounding variables tends to underestimate the true treatment effect 170.

28.4 Assumptions and limitations of estimators

Each causal inference estimator relies on specific assumptions and has inherent sensitivities, influencing its suitability for a given dataset 171.

Estimator TypeAdvantagesDisadvantages
RegressionNo need to estimate e(Xi)e(X_i)Sensitive to errors in estimating μ(Zi,Xi)\mu(Z_i, X_i)
MatchingNo need to estimate μ(Zi,Xi)\mu(Z_i, X_i) or e(Xi)e(X_i)Sensitive to metric choice and may perform poorly with many covariates
Inverse Probability WeightingNo need to estimate μ(Zi,Xi)\mu(Z_i, X_i)Sensitive to errors in estimating e(Xi)e(X_i) and potentially unstable when propensity scores are close to 0 or 1
  • Estimator choice: The selection of an appropriate estimator depends critically on the modeling assumptions and design choices the researcher is willing to make 171.

28.5 Strong ignorability and unobserved confounding

The assumption of strong ignorability is fundamental to many causal inference methods, implying that all confounding variables are observed and accounted for 172.

  • Plausibility for JTPA: The plausibility of strong ignorability for the JTPA dataset is questionable.
  • Unobserved motivation example: If individuals with higher unobserved motivation are more likely to participate in job training and would also earn more independently of the training, then the observed earnings difference may be attributed to motivation rather than the program itself.
  • Conditional exchangeability: Such a scenario violates conditional exchangeability, leading to biased estimates from estimators that rely on this assumption 172.

📝 Consider a situation where participants in a job training program show higher post-training earnings. If these participants also possessed a higher intrinsic motivation for career advancement that was not measured, then the observed earnings increase might be partly due to this unobserved motivation rather than solely the training program. This unobserved factor (motivation) confounds the relationship between training and earnings, making it difficult to isolate the true causal effect of the training. A causal diagram illustrating the relationship between treatment, observed covariates, unobserved common cause, and outcome.

29. Unmeasured confounding

29.1 Unmeasured confounding and conditional exchangeability

Unmeasured confounding occurs when an unobserved common cause, UiU_i, influences both the treatment assignment, ZiZ_i, and the outcome, YiY_i, even after conditioning on all observed covariates, XiX_i. This scenario violates the assumption of conditional exchangeability, which posits that Zi⊥⊥(Yi(0),Yi(1))∣XiZ_i \perp \perp (Y_i(0), Y_i(1)) | X_i.

When this assumption fails, the treatment is considered endogenous, meaning its assignment is correlated with unobserved factors that also affect the outcome, leading to biased causal effect estimates 174.

29.2 Instrumental variables (IV)

An instrumental variable (IV), denoted as WiW_i, is a method to address unmeasured confounding by exploiting exogenous variation in the treatment. The core idea is to utilize the variation in ZiZ_i that is induced by WiW_i to estimate the causal effect of ZiZ_i on YiY_i, ensuring this variation is unrelated to the unobserved confounder UiU_i 175.

📝 In a study examining the effect of a new medication (ZiZ_i) on patient recovery (YiY_i), unmeasured patient health status (UiU_i) might influence both medication adherence and recovery. A patient's geographic proximity to a specialized clinic (WiW_i) could serve as an instrumental variable if it affects the likelihood of receiving the medication but does not directly influence recovery or correlate with unmeasured health status.

This diagram illustrates the concept of an instrumental variable (IV) in causal inference, showing the relationships between variables W_i, Z_i, X_i, Y_i, and U_i.

30. Instrumental variables

30.1 Introduction to instrumental variables

Instrumental variables (IV) address confounding by unobserved factors when estimating causal effects, particularly when individuals self-select into treatments based on unmeasured characteristics. The IV approach isolates a source of treatment variation that is effectively random, allowing for a more robust comparison of outcomes 176.

30.2 Conditions for a valid instrument

A valid instrument is a variable that satisfies three critical conditions, which collectively enable the estimation of causal effects in the presence of unmeasured confounding 178.

ConditionDescription
Instrument exogeneityThe instrument is independent of unmeasured causes of the outcome (Ui⊥⊥WiU_i \perp \perp W_i).
Exclusion restrictionThe instrument affects the outcome only through the treatment and has no direct effect on the outcome (Wi↛YiW_i \not\to Y_i).
RelevanceThe instrument has a direct effect on the treatment (Wi→ZiW_i \to Z_i).

The exclusion restriction and instrument exogeneity conditions generally cannot be empirically tested from observed data because they pertain to unobserved relationships 178.

30.3 Instrumental variables in JTPA data

In the Job Training Partnership Act (JTPA) dataset, treatment assignment (WW) serves as a potential instrument for treatment participation (ZZ) to estimate its effect on earnings (YY).

  • Treatment assignment: W=1W=1 for the treatment group, W=0W=0 for the control group.
  • Instrument exogeneity: This condition is met by design due to the randomized assignment to treatment and control groups, similar to exchangeability in a Randomized Controlled Trial (RCT).
  • Exclusion restriction: This is assumed to hold, as it is plausible that treatment assignment influences earnings solely through actual treatment participation.
  • Relevance: If this condition is satisfied, treatment assignment is considered a valid instrument for treatment participation 179.

30.4 Testing the relevance condition

The relevance condition can be empirically tested using observed data, typically through a first-stage F-test 180.

  • First-stage regression: This regression models the relationship between the treatment (ZiZ_i) and the instrument (WiW_i), controlling for exogenous covariates (XiX_i). The equation is: Zi=Xi⊤η+λWi+viZ_i = X_i^\top \eta + \lambda W_i + v_i where XiX_i includes an intercept and exogenous covariates, and parameters are estimated using Ordinary Least Squares (OLS).
  • F-test for relevance: The null hypothesis H0:λ=0H_0: \lambda = 0 is tested. A common rule of thumb suggests that an F-statistic greater than 10 provides strong evidence for the relevance condition.
  • Relationship between F and t-statistic: The F-statistic is equal to the square of the t-statistic (F=t2F = t^2) 180.

📝 In the JTPA data, a first-stage regression of Z on W, sex, edu, and prevearn yields a t-value for W of 73.7922. Squaring this gives an F-statistic of 5445.259, which is significantly greater than 10, indicating strong evidence for the relevance condition. However, it is important to note that first-stage errors are often heteroscedastic. When robust standard errors are used, the t-value for W becomes 99.47942, resulting in an F-statistic of 9896.151, further confirming the satisfaction of the relevance condition 181 182. This image displays the output of a statistical regression analysis, including residuals, coefficients, and significance codes. A statistical output table showing coefficients, standard errors, t-values, and p-values for a regression model.

30.5 Formal definition of IV conditions

Let Yi(w,z)Y_i(w, z) represent the potential outcome for individual ii if Wi=wW_i = w and Zi=zZ_i = z. The IV conditions can be formally defined as follows 183:

  • Relevance: P(Zi=1∣Wi=1)≠P(Zi=1∣Wi=0)P(Z_i = 1 | W_i = 1) \neq P(Z_i = 1 | W_i = 0). This means the instrument must influence the probability of receiving the treatment.
  • Exclusion restriction: Yi(w,z)=Yi(z)Y_i(w, z) = Y_i(z) for all (w,z)∈{0,1}2(w, z) \in \{0, 1\}^2. This implies that the instrument affects the outcome only through its effect on the treatment.
  • Instrument exogeneity: (Yi(0,0),Yi(1,0),Yi(0,1),Yi(1,1))⊥⊥Wi(Y_i(0, 0), Y_i(1, 0), Y_i(0, 1), Y_i(1, 1)) \perp \perp W_i. This means the instrument is independent of all potential outcomes 183.

These assumptions can also be made conditional on measured exogenous covariates XiX_i 183.

30.6 Challenges in finding valid instruments

Identifying a valid instrumental variable can be challenging in empirical research due to the stringent conditions required 184.

📝 Examples of commonly used instruments include draft lottery eligibility for military service, season of birth for educational attainment, distance to university for years of education, and year of medical treatment for receiving a specific treatment 184.

31. Effect homogeneity

31.1 Identifying the average treatment effect

Identifying the Average Treatment Effect (ATE) under unmeasured confounding generally requires additional assumptions beyond the standard instrumental variable (IV) conditions. Different assumptions lead to the identification of distinct treatment effects 185.

AssumptionIdentified Treatment Effect
Effect homogeneityAverage Treatment Effect (ATE)
MonotonicityLocal Average Treatment Effect (LATE)

31.2 Effect homogeneity and the Wald ratio

Effect homogeneity, in its strongest form, posits that the effect of an instrument ZiZ_i on an outcome YiY_i is constant across all individuals, expressed as Yi(1)−Yi(0)=αY_i(1) - Y_i(0) = \alpha for all i∈{1,…,n}i \in \{1, \dots, n\}, where α∈R\alpha \in \mathbb{R}. Under the IV conditions and effect homogeneity, without exogenous covariates XiX_i, the ATE can be identified using the Wald ratio 187.

The Wald ratio is defined as: ATE=E[Yi∣Wi=1]−E[Yi∣Wi=0]E[Zi∣Wi=1]−E[Zi∣Wi=0]ATE = \frac{E[Y_i | W_i = 1] - E[Y_i | W_i = 0]}{E[Z_i | W_i = 1] - E[Z_i | W_i = 0]} This ratio represents the effect of the instrument on the outcome relative to its effect on the treatment. In an ideal Randomized Controlled Trial (RCT) where Wi=ZiW_i = Z_i, the Wald ratio simplifies to E[Yi∣Zi=1]−E[Yi∣Zi=0]E[Y_i | Z_i = 1] - E[Y_i | Z_i = 0] 187 188.

📝 If an instrument WiW_i (e.g., encouragement to participate in a program) increases participation ZiZ_i by 10% and increases the outcome YiY_i (e.g., earnings) by 500 USD, the ATE would be 500/0.10=5000500 / 0.10 = 5000 USD, assuming effect homogeneity.

The ATE can be estimated using the sample-based Wald estimator: ATE^WALD=YˉW=1−YˉW=0ZˉW=1−ZˉW=0\widehat{ATE}_{WALD} = \frac{\bar{Y}_{W=1} - \bar{Y}_{W=0}}{\bar{Z}_{W=1} - \bar{Z}_{W=0}} where YˉW=w\bar{Y}_{W=w} and ZˉW=w\bar{Z}_{W=w} are the sample means of YiY_i and ZiZ_i for individuals with Wi=wW_i = w 188.

31.3 Two-Stage Least Squares (2SLS)

When exogenous covariates XiX_i are present, Two-Stage Least Squares (2SLS) is commonly employed to estimate the ATE. 2SLS involves two sequential Ordinary Least Squares (OLS) regressions:

  • First-stage regression: Zi=Xi⊤η+λWi+viZ_i = X_i^\top \eta + \lambda W_i + v_i. This stage estimates the effect of the instrument WiW_i on the treatment ZiZ_i, controlling for covariates XiX_i. The estimated Z^i\widehat{Z}_i is then used in the second stage.
  • Second-stage regression: Yi=Xi⊤β+αZ^i+ϵiY_i = X_i^\top \beta + \alpha \widehat{Z}_i + \epsilon_i. This stage estimates the effect of the predicted treatment Z^i\widehat{Z}_i on the outcome YiY_i, where α\alpha represents the ATE under IV conditions and effect homogeneity 189.

2SLS effectively isolates the variation in treatment ZiZ_i that is solely attributable to the instrument WiW_i, given XiX_i, and uses this variation to estimate the treatment effect. It is important to note that the first stage serves as a linear projection, and the fact that Z^i\widehat{Z}_i may fall outside the [0,1][0,1] range does not invalidate the method.

While coefficient estimates are obtained via OLS, statistical inference requires appropriate standard error correction 190.

If no exogenous covariates XiX_i are included, the 2SLS estimator is equivalent to the Wald estimator: This equation shows that the 2SLS estimator is equal to the Wald estimator for the average treatment effect. α^2SLS=ATE^WALD\widehat{\alpha}_{2SLS} = \widehat{ATE}_{WALD} This equivalence highlights that both methods aim to identify the ATE under similar assumptions, with 2SLS extending to incorporate covariates 190.

📝 In a study on job training, if 2SLS estimates an ATE of 850 USD less than an estimate under strong ignorability, this difference, under treatment-effect homogeneity and valid IV assumptions, suggests positive selection into job training. This could mean more motivated individuals are more likely to enroll and earn more even without training 192.

31.4 Wu–Hausman test and control-function approach

The Wu–Hausman test is used to assess whether the treatment variable ZiZ_i is endogenous, with the null hypothesis (H0H_0) stating that ZiZ_i is exogenous. Rejecting H0H_0 provides evidence of endogeneity, but failing to reject H0H_0 does not confirm exogeneity 192.

The control-function (CF) approach offers an alternative method for handling endogeneity in linear models. It involves:

  • Computing the residuals v^i=Zi−Xi⊤η^−λ^Wi\widehat{v}_i = Z_i - X_i^\top \widehat{\eta} - \widehat{\lambda} W_i from the first-stage regression.
  • Estimating an augmented structural equation: Yi=Xi⊤β+αZi+ρv^i+ϵiY_i = X_i^\top \beta + \alpha Z_i + \rho \widehat{v}_i + \epsilon_i using OLS 193.

In this approach, v^i\widehat{v}_i captures the potentially endogenous component of ZiZ_i. In linear models, the coefficient α^CF\widehat{\alpha}_{CF} from the control-function approach is identical to α^2SLS\widehat{\alpha}_{2SLS} from 2SLS.

The Wu-Hausman test can also be formulated as testing H0:ρ=0H_0: \rho = 0 in the augmented structural equation 193.

32. Monotonicity

32.1 Monotonicity assumption and latent subgroups

The monotonicity assumption is a critical condition in causal inference that allows for heterogeneous treatment effects while restricting how an instrumental variable (IV) influences treatment selection. It posits that individuals do not take the opposite treatment than assigned, effectively ruling out "defiers" 195 196.

  • Potential treatment status Zi(w)Z_i(w): This refers to the treatment an individual ii would receive if the instrumental variable WiW_i were set to ww 195.
  • Monotonicity assumption: Formally stated as P(Zi(0)>Zi(1))=0P(Z_i(0) > Z_i(1)) = 0, this implies that no individual would receive treatment when assigned to the control group (Wi=0W_i=0) but not receive treatment when assigned to the treatment group (Wi=1W_i=1).
  • One-sided noncompliance: If individuals in the control group cannot access the treatment, monotonicity is inherently satisfied 196.
SubgroupDefinition
CompliersZi(1)=1Z_i(1) = 1 and Zi(0)=0Z_i(0) = 0
Always-takersZi(1)=1Z_i(1) = 1 and Zi(0)=1Z_i(0) = 1
DefiersZi(1)=0Z_i(1) = 0 and Zi(0)=1Z_i(0) = 1
Never-takersZi(1)=0Z_i(1) = 0 and Zi(0)=0Z_i(0) = 0

📝 In a study evaluating a new drug, a complier is someone who takes the drug if prescribed and does not take it if not prescribed. A defier would be someone who refuses the drug if prescribed but somehow obtains and takes it if not prescribed, which monotonicity rules out.

32.2 Extended instrumental variable conditions

The extended IV conditions are a set of assumptions necessary for identifying causal effects, particularly when combined with monotonicity. These conditions build upon standard IV assumptions by extending exogeneity to potential treatment statuses 197.

  • Extended instrument exogeneity: This condition states that (Yi(0,0),Yi(1,0),Yi(0,1),Yi(1,1),Zi(1),Zi(0))⊥⊥Wi(Y_i(0, 0), Y_i(1, 0), Y_i(0, 1), Y_i(1, 1), Z_i(1), Z_i(0)) \perp \perp W_i.
  • It implies that the proportions of compliers, always-takers, never-takers, and defiers are consistent across both treatment and control groups.
  • This ensures that the treatment assignment is not disproportionately allocated to individuals who would inherently follow the treatment.
  • Components: The extended IV conditions comprise the relevance condition, the exclusion restriction, and the extended instrument exogeneity condition 197.

32.3 Local average treatment effect (LATE)

Under the extended IV conditions and the monotonicity assumption, the Local Average Treatment Effect (LATE) is identified. LATE represents the average treatment effect specifically for the subpopulation of compliers 198.

  • LATE formula: LATE=E[Yi(1)−Yi(0)∣Zi(1)>Zi(0)]LATE = E[Y_i(1) - Y_i(0) | Z_i(1) > Z_i(0)].
  • This measures the average difference in potential outcomes for individuals who would comply with their assigned treatment status.
  • Complier proportion: The proportion of compliers is identifiable and is equivalent to the denominator of the Wald ratio: P(Zi(1)>Zi(0))=E[Zi∣Wi=1]−E[Zi∣Wi=0]P(Z_i(1) > Z_i(0)) = E[Z_i | W_i = 1] - E[Z_i | W_i = 0] 198.
  • Wald ratio and 2SLS: Under these conditions, the Wald ratio and the Two-Stage Least Squares (2SLS) estimator identify the LATE, providing a causal interpretation for the complier subgroup 199.

📝 In the JTPA study on job training services, the LATE was estimated to be 1946.09 USD, meaning that for the 64% of individuals who were compliers, the average treatment effect on earnings was approximately 1946.09 USD 199.

32.4 Average treatment effect for the treated (ATT)

When the extended IV conditions are met, and there is one-sided noncompliance, the monotonicity assumption is automatically satisfied, and always-takers are also ruled out. In this specific scenario, all treated individuals are considered compliers, and the Average Treatment Effect for the Treated (ATT) is identified 200.

  • ATT formula: ATT=E[Yi(1)−Yi(0)∣Zi=1]ATT = E[Y_i(1) - Y_i(0) | Z_i = 1].
  • This answers the question of how beneficial the treatment is for those who actually receive it.
  • Relationship with LATE: Under extended IV conditions and one-sided noncompliance, ATT is equal to LATE 200.

Formula for Average Treatment Effect for the Treated (ATT)

32.5 Causal effects under different assumptions

The specific causal effect identified by methods like the Wald ratio or 2SLS depends on the additional assumptions imposed alongside the extended IV conditions 201.

AssumptionIdentified Causal Effect
Effect homogeneityAverage Treatment Effect (ATE)
MonotonicityLocal Average Treatment Effect (LATE)
One-sided noncomplianceAverage Treatment Effect for the Treated (ATT)

33. Alternative approaches

33.1 Alternative approaches to instrumental variables

Beyond instrumental variables, several alternative methodologies exist for causal inference, each offering distinct advantages in specific research contexts. These approaches provide robust frameworks for estimating treatment effects under varying assumptions 202.

ApproachDescription
Regression discontinuity designTreatment assignment changes deterministically at a known threshold of an observed variable, allowing for comparison of individuals near the cutoff to approximate a randomized experiment.
Partial identificationInstead of strong identifiability assumptions, these methods aim to bound treatment effects, providing a range rather than a point estimate.

📝 In an educational intervention, if a scholarship is awarded to students with a GPA above 3.0, a regression discontinuity design would compare students with GPAs just above 3.0 to those just below 3.0 to estimate the scholarship's causal effect on future academic performance 202.

33.2 Transition to longitudinal data

The subsequent focus in causal inference shifts to analyzing data where the same individuals are observed across multiple time periods. This type of data is commonly referred to as longitudinal data or panel data 202.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also