Empirical Economics

Lecture 6: Binary Outcome Data (Economics Track)

Outline

Course Overview

The core lectures developed linear regression, inference, and panel-data estimators.

The economics track now studies binary outcomes, time series, and an empirical replication. Today we consider outcomes that take the values zero and one.

What do we do today?

This lecture begins with the linear probability model, then replaces its straight line with the bounded S-curves of logit and probit.

Logit and probit are estimated by maximum likelihood. We build the likelihood step by step on one dataset, from an intercept-only model to the full specification, and read standard errors off its curvature.

Their coefficients describe a linear index; marginal effects translate those coefficients into changes in probability, including for interaction terms. Finally, we evaluate a binary model’s fit and predictions.

Material: Wooldridge, Sections 7.5 and 17.1.

What should you be able to do?

By the end of this lecture, you should be able to:

  1. Estimate and interpret a linear probability model with robust standard errors.
  2. Explain why logit and probit predictions remain between zero and one.
  3. Write down the likelihood for a binary outcome, explain what MLE maximizes, and explain where its standard errors come from.
  4. Distinguish a raw non-linear coefficient from a marginal effect, and compute an average marginal effect.
  5. Explain why an interaction coefficient in a logit or probit is not the interaction effect on the probability.
  6. Evaluate a binary model without treating accuracy or pseudo-\(R^2\) as sufficient.

Guiding question

Does the name on an otherwise similar resume change the probability of an employer callback?

Bertrand and Mullainathan (2004) sent 4,870 fictitious resumes to vacancies in Boston and Chicago. Names associated with race were randomly assigned; the outcome call records whether the employer called back.

The overall callback rate is only 8.0%. That low baseline will matter for interpretation and for prediction.

Prediction

Before seeing a model, predict the callback gap in percentage points between white-sounding and African-American-sounding names.

We compare your prediction with the estimates from all three models.

The linear probability model

The conditional mean

When \(y_i\) is either zero or one, its conditional mean equals the probability of one:

\[ E(y_i\mid x_i) =0\Pr(y_i=0\mid x_i)+1\Pr(y_i=1\mid x_i) =\Pr(y_i=1\mid x_i). \]

Modelling the conditional mean therefore means modelling the probability of the event.

The mathematics is the same whether the event is employment, loan default, treatment, purchase, voting, or an employer callback.

The linear probability model

Apply OLS to a binary outcome:

The linear probability model

\[ y_i=x_i'\beta+u_i, \qquad \Pr(y_i=1\mid x_i)=x_i'\beta. \]

The fitted value is interpreted as a probability. Estimation is ordinary least squares; only the meaning of the conditional mean has changed.

This simple model remains common because it handles many controls, interactions, and fixed effects with the linear tools we already know.

Interpretation

For a continuous regressor \(x_{ik}\),

\[ \frac{\partial \Pr(y_i=1\mid x_i)}{\partial x_{ik}}=\beta_k. \]

A coefficient of \(0.03\) means that a one-unit increase in \(x_k\) is associated with a 3 percentage-point increase in probability, holding the other regressors fixed.

For a dummy regressor, \(\beta_k\) is the discrete difference between the two fitted probabilities. Percentage points are an absolute difference; they are not a percentage change relative to the starting probability.

Callback rates

Name Resumes sent Callback rate
African-American-sounding 2,435 6.4%
White-sounding 2,435 9.7%

The raw difference is 3.2 percentage points. Relative to the callback rate for African-American-sounding names, that is about 50% more callbacks.

Random assignment makes this difference causally interpretable for the resumes and vacancies in the experiment. A regression can improve precision and show how the same estimand appears under different links.

The estimated callback gap

Quantity Value
Coefficient on white-sounding name 0.032
Same coefficient in percentage points 3.2 pp
Average callback probability 8.0%

Holding sex, years of experience, and broad occupation fixed, a white-sounding name raises the fitted callback probability by 3.2 percentage points.

Always report that number beside the baseline. A change of five percentage points is modest when the baseline is 80%, but large when the baseline is 6%.

Predictions outside the probability bounds

Within the observed middle range, a straight line can approximate a probability curve well. At sufficiently extreme \(x\), it must eventually cross zero or one.

Heteroskedasticity

Write \(p_i=\Pr(y_i=1\mid x_i)\). Because a binary outcome is Bernoulli,

\[ \operatorname{Var}(y_i\mid x_i)=p_i(1-p_i). \]

The LPM error \(u_i=y_i-p_i\) therefore satisfies

\[ \operatorname{Var}(u_i\mid x_i)=p_i(1-p_i), \]

which changes with \(x_i\) whenever the probability changes with \(x_i\).

Standard errors

The LPM needs heteroskedasticity-robust standard errors. Robust standard errors repair the inference; they do not repair out-of-range predictions or non-linearity.

Uses and limitations

LPM coefficients measure probability changes directly. OLS also accommodates interactions and many fixed effects.

The model imposes a linear conditional mean, can predict outside \([0,1]\), and requires standard errors that allow for heteroskedasticity.

The LPM can be useful for estimating an average probability change. Its restrictions may be less suitable for predicting probabilities for individual observations.

Logit and probit impose the probability bounds directly.

Logit and probit

Density and cumulative probability

The CDF \(F(z)=\Pr(Z\le z)\) gives the probability accumulated up to \(z\). Its derivative \(f(z)=F'(z)\) is the PDF, which will determine how quickly a modelled probability changes.

A latent-variable representation

Suppose each employer forms an unobserved valuation of the applicant,

\[ y_i^*=x_i'\beta+\varepsilon_i, \]

where \(\varepsilon_i\) collects everything about the employer and vacancy that the researcher does not observe. The employer calls back when the valuation exceeds a threshold:

\[ y_i= \begin{cases} 1 & \text{if } y_i^*>0,\\ 0 & \text{if } y_i^*\le 0. \end{cases} \]

We observe only \(y_i\), the decision, and never \(y_i^*\), the valuation.

Normalization

Setting the threshold at zero costs nothing: a threshold \(c\) is absorbed into the intercept, because \(y_i^*>c\) is the same event as \(y_i^*-c>0\).

The scale of \(y_i^*\) is not identified either. Multiplying \(\beta\) and \(\varepsilon_i\) by any \(c>0\) gives

\[ \Pr(c\,x_i'\beta+c\,\varepsilon_i>0)=\Pr(x_i'\beta+\varepsilon_i>0), \]

so every probability, and therefore the data, is unchanged. We fix the scale by fixing the variance of \(\varepsilon_i\). The coefficients are then measured in units of that standard deviation.

Logit and probit assumptions

The threshold rule implies

\[ \begin{aligned} \Pr(y_i=1\mid x_i) &=\Pr(\varepsilon_i>-x_i'\beta\mid x_i)\\ &=1-F(-x_i'\beta) =F(x_i'\beta), \end{aligned} \]

where the last equality uses symmetry.

Two standard choices

Probit assumes a standard normal error, with variance 1, and uses \(\Phi(x_i'\beta)\).

Logit assumes a standard logistic error, with variance \(\pi^2/3\approx 3.29\), and uses \(\Lambda(x_i'\beta)=1/(1+e^{-x_i'\beta})\).

Coefficients and marginal effects

In either model,

\[ p_i=F(x_i'\beta). \]

A one-unit increase in \(x_{ik}\) raises the index by \(\beta_k\). Its effect on probability is

\[ \frac{\partial p_i}{\partial x_{ik}} =f(x_i'\beta)\beta_k. \]

The probability change is larger near the centre of the link function than in its tails. A marginal effect must therefore specify the covariate values at which it is evaluated.

Maximum likelihood

Maximum likelihood estimation

OLS chooses coefficients that minimize a sum of squared residuals. That objective is convenient when the conditional mean is linear.

Logit and probit instead specify the full conditional probability of each binary outcome. Maximum likelihood chooses the parameter vector that makes the observed sequence of zeros and ones as probable as possible under that specification.

Maximum likelihood estimation

Given a statistical model and observed data, MLE finds the parameter values with the largest likelihood:

\[ \hat\beta_{\mathrm{MLE}}=\arg\max_\beta L(\beta\mid \text{data}). \]

A probability fixes the parameters and asks how likely different data are. The likelihood uses the same formula the other way round: it fixes the observed data and compares parameter values.

A likelihood example

Seven of ten independent coin flips are heads. If \(p\) is the probability of heads, the likelihood of that result is proportional to \(L(p)=p^7(1-p)^3\).

Setting the derivative of the log-likelihood to zero, \(7/p-3/(1-p)=0\), gives \(\hat p=7/10\): the sample share of heads.

From coins to callbacks

The intercept-only logit sets \(\Pr(\text{call}_i=1)=\Lambda(\alpha)\) for every resume. Each resume is then a flip of the same coin, and with 392 callbacks among 4,870 resumes,

\[ \ell(\alpha)=392\log\Lambda(\alpha)+4478\log\{1-\Lambda(\alpha)\}. \]

This is the coin log-likelihood with \(p=\Lambda(\alpha)\), so the maximum is at \(\Lambda(\hat\alpha)=392/4870\).

The estimate from glm is \(\hat\alpha=-2.436\), and \(\Lambda(\hat\alpha)=8.05%\), which is the sample callback rate.

Adding a binary regressor

Let \(\Pr(\text{call}_i=1\mid\text{white}_i)=\Lambda(\alpha+\gamma\,\text{white}_i)\). Substituting the two possible values of the regressor gives

\[ p_0=\Lambda(\alpha),\qquad p_1=\Lambda(\alpha+\gamma). \]

Every resume with \(\text{white}_i=g\) has the same callback probability \(p_g\). Let \(n_g\) count that group’s resumes and \(c_g\) its callbacks. Each callback contributes \(p_g\); each non-callback contributes \(1-p_g\). Independence therefore gives the two group likelihoods:

\[ L_0=p_0^{c_0}(1-p_0)^{n_0-c_0},\qquad L_1=p_1^{c_1}(1-p_1)^{n_1-c_1}. \]

The full likelihood is \(L(\alpha,\gamma)=L_0L_1\): multiply the probabilities of all observed outcomes across both groups.

Estimating the two probabilities

The two parameters \(\alpha\) and \(\gamma\) allow the two group probabilities to be chosen freely. For either group, the log-likelihood and its first-order condition are

\[ \ell_g(p_g)=c_g\log p_g+(n_g-c_g)\log(1-p_g), \]

\[ \frac{c_g}{p_g}-\frac{n_g-c_g}{1-p_g}=0 \quad\Longrightarrow\quad \hat p_g=\frac{c_g}{n_g}. \]

Thus MLE reproduces each group’s observed callback rate:

\[ \Lambda(\hat\alpha)=6.45\%, \qquad \Lambda(\hat\alpha+\hat\gamma)=9.65\%. \]

With only this dummy, logit, probit, and the LPM give identical fitted probabilities. This is a valid fit, but two group rates cannot describe how probabilities also vary with experience. Adding further regressors requires the observation-level likelihood next.

The binary likelihood

Once the model includes a continuous regressor, such as years of experience, the resumes no longer fall into a few groups with a common probability. Each resume has its own \(p_i=F(x_i'\beta)\).

One compact expression covers both possible outcomes:

\[ L_i(\beta)=p_i^{y_i}(1-p_i)^{1-y_i}. \]

When \(y_i=1\), the contribution is \(p_i\). When \(y_i=0\), it is \(1-p_i\). Assuming observations are conditionally independent, the sample likelihood multiplies those contributions:

\[ L(\beta)=\prod_{i=1}^n [F(x_i'\beta)]^{y_i} [1-F(x_i'\beta)]^{1-y_i}. \]

The log-likelihood

Maximizing \(L(\beta)\) and maximizing \(\log L(\beta)\) give the same answer because the logarithm is increasing. Products of thousands of small probabilities are numerically fragile; the log turns them into a sum.

\[ \ell(\beta)= \sum_{i=1}^n \left[ y_i\log F(x_i'\beta) +(1-y_i)\log\{1-F(x_i'\beta)\} \right]. \]

For logit, \(\hat p_i=\Lambda(x_i'\hat\beta)\) is observation \(i\)’s fitted probability of a callback. The first-order conditions are \(\sum_i (y_i-\hat p_i)\,x_i=0\). The residuals \(y_i-\hat p_i\) are orthogonal to every regressor, as in OLS. Because \(x_i\) includes a constant, the average fitted probability equals the sample callback rate.

These conditions are non-linear in \(\beta\) and have no closed-form solution. Software starts from a guess and repeatedly moves uphill until the log-likelihood stops increasing.

The log-likelihood in our data

The peak is at \(\hat\beta_{\text{white}}=0.446\). The standard error, 0.108, measures how quickly the log-likelihood falls away from the peak: a sharply curved peak gives a small standard error; a flat peak means many values fit almost equally well.

Properties and failure modes

If the model is correctly specified, the MLE is consistent, approximately normal in large samples, and has the smallest asymptotic variance among estimators with those two properties. OLS is itself the MLE of a linear model with normal errors.

Check that the optimizer converged. A common cause of non-convergence is perfect separation: if some regressor value always coincides with \(y_i=1\), the likelihood keeps rising as that coefficient grows, and no finite maximum exists. Poorly scaled regressors and too many parameters cause similar problems.

MLE estimates the specified conditional relationship; it does not make an endogenous regressor exogenous.

The likelihood-ratio test

Let \(\ell_U\) be the maximized log-likelihood of an unrestricted model and \(\ell_R\) that of a restricted model obtained by imposing \(q\) restrictions.

\[ LR=2(\ell_U-\ell_R) \overset{a}{\sim}\chi_q^2. \]

The statistic asks how much the maximized log-likelihood falls when the restrictions are imposed. Testing all slopes jointly against the intercept-only model is the likelihood analogue of an overall \(F\)-test.

For our logit model, \(\ell_U=-1336.8\) and \(\ell_R=-1363.5\), so \(LR=53.3\) with 7 restrictions and \(p<.001\).

Fixed effects with binary outcomes

An LPM can absorb unit fixed effects. Identification then requires within-unit variation in the regressor.

Conditional fixed-effects logit removes the unit intercepts by maximizing a likelihood that conditions on each unit’s total number of successes. Only units whose outcome changes over time contribute to estimation.

In non-linear models, unit dummies also complicate the calculation of probability effects. A binary regressor’s effect is the change in predicted probability when it switches from zero to one; both predictions depend on the unit intercept. Conditional logit removes these intercepts, so its slope estimates alone do not give these probability changes.

Model choice

For many policy regressions, an LPM with unit fixed effects and clustered standard errors remains a transparent and defensible choice.

Interpreting non-linear models

Estimates

LPM Logit Probit
* p < 0.1, ** p < 0.05, *** p < 0.01
Occupation dummies included but not shown. LPM: heteroskedasticity-robust SEs.
White-sounding name 0.032*** 0.446*** 0.219***
(0.008) (0.108) (0.053)
Female 0.008 0.116 0.053
(0.010) (0.139) (0.069)
Years of experience 0.004*** 0.048*** 0.024***
(0.001) (0.010) (0.005)
Num.Obs. 4870 4870 4870
Log.Lik. -1336.796 -1337.110

All three models agree on the signs and on which coefficients are significant. The magnitudes are on different scales: the LPM column is in probability units, the logit and probit columns are in units of their latent indices.

Comparing probability effects

Model White: coefficient White: average change Experience: coefficient Experience: average change
Linear probability 0.032 3.24 pp 0.004 0.40 pp
Logit 0.446 3.24 pp 0.048 0.35 pp
Probit 0.219 3.20 pp 0.024 0.35 pp

For each resume, we hold its other characteristics fixed and calculate the probability change from switching the name indicator from zero to one, or the slope of the probability curve per year of experience. The table averages these effects across resumes.

The raw coefficients use different scales, while the average probability changes almost coincide. Compare these probability effects when communicating magnitudes.

Observation-specific marginal effects

For a continuous regressor, \(ME_{ik}=f(x_i'\hat\beta)\hat\beta_k\). Every resume has the same coefficient on experience but its own position on the S-curve.

The effect ranges from 0.16 to 0.88 percentage points per year, highest for the resumes with the highest fitted callback probability.

The marginal effect at the mean

The marginal effect at the mean evaluates the derivative at \(\bar x\):

\[ MEM_k=f(\bar x'\hat\beta)\hat\beta_k. \]

It answers: what is the slope for a hypothetical observation whose every regressor equals its sample mean? For experience it is 0.34 percentage points per year.

For binary and categorical regressors, the mean covariate vector may describe no actual observation: no resume is 0.50 white and 0.77 female. With interactions or substantial non-linearity, the MEM may differ considerably from the sample average.

The average marginal effect

The average marginal effect first computes one derivative per observation, then averages:

\[ AME_k=\frac{1}{n}\sum_{i=1}^n f(x_i'\hat\beta)\hat\beta_k. \]

It answers: for the covariate distribution in this sample, what is the average local probability change associated with a one-unit increase in \(x_k\)? For experience it is 0.35 percentage points per year, against 0.40 in the LPM.

Reporting an average effect

Report an AME when the goal is a sample-wide summary on the probability scale. State the population over which it is averaged.

Binary regressors

The derivative formula treats a regressor as continuously variable. Race assignment in this experiment moves from zero to one, never by an infinitesimal amount.

For a binary regressor \(d\), use

\[ \Delta_i =F(x_i'\hat\beta\mid d_i=1) -F(x_i'\hat\beta\mid d_i=0), \qquad AME_d=\frac{1}{n}\sum_{i=1}^n\Delta_i. \]

This is what the comparison table computed for the name: predict every resume twice, change only the assigned name type, take the difference, and average.

Odds ratios

For logit,

\[ \log\left(\frac{p_i}{1-p_i}\right)=x_i'\beta. \]

A one-unit increase in \(x_{ik}\) adds \(\beta_k\) to the log-odds and multiplies the odds by \(e^{\beta_k}\).

For the name indicator, the fitted odds ratio is 1.56. Holding the other regressors fixed, the odds of a callback are about 56% higher for a white-sounding name.

Odds are not probabilities. When an event is rare they are close, but an odds ratio should never be described as a percentage-point change.

Interactions in a non-linear model

In an LPM with \(p_i=\beta_0+\beta_1x_i+\beta_2d_i+\beta_{12}x_id_i\), the effect of \(x\) is \(\beta_1\) when \(d=0\) and \(\beta_1+\beta_{12}\) when \(d=1\). The interaction coefficient \(\beta_{12}\) is the difference between the two effects.

In a logit or probit, the effect of \(x\) in each group is \(f(\cdot)\) times the index slope, and \(f(\cdot)\) is evaluated at a different point for each group:

\[ \underbrace{f(\text{index}_{d=1})(\beta_1+\beta_{12})}_{\text{effect of }x\text{ when }d=1} -\underbrace{f(\text{index}_{d=0})\,\beta_1}_{\text{effect of }x\text{ when }d=0}. \]

This difference is non-zero even when \(\beta_{12}=0\), and it can have a different sign and significance from \(\hat\beta_{12}\) (Ai and Norton, 2003). The \(z\)-test on \(\hat\beta_{12}\) tests an interaction in the index, not in the probability.

Interactions: illustration

Our logit has no interaction term, yet its average name gap is 2.5 percentage points for resumes with 2 years of experience and 5.0 with 20 years. Report an interaction on the probability scale: the difference between two discrete changes, or the interaction coefficient of an LPM.

Your prediction, revisited

The LPM estimate is 3.2 percentage points. The logit and probit average discrete changes are 3.2 and 3.2 percentage points.

The three answers almost coincide because the fitted probabilities lie in a narrow low range, 3.5% to 24.4%, where the S-curve is close to a straight line. The models diverge when the effect of interest is evaluated at very different baselines, as the experience and interaction slides showed.

Causal interpretation

Random assignment supports a causal interpretation of the name signal in this hiring context. It does not identify a universal effect of race in every labour market, nor the mechanism behind employers’ responses.

Fit, testing, and prediction

Explanation and prediction

For explanation, we care whether a regressor changes the outcome distribution and whether that change has a credible causal interpretation.

For prediction, we care how accurately fitted probabilities generalize to observations not used for estimation. A model can estimate an important average effect and still classify individuals poorly, especially when individual outcomes are noisy.

The resume experiment is such a case: the treatment effect is clearly estimated, while callbacks remain rare and difficult to predict one by one.

McFadden’s pseudo-\(R^2\)

McFadden’s measure compares the maximized log-likelihoods of the full and intercept-only models:

\[ R^2_{\text{McFadden}} =1-\frac{\ell_{\text{full}}}{\ell_{\text{null}}}. \]

For our model it equals 0.020.

Despite the notation, this is not the fraction of outcome variance explained and should not be compared numerically with OLS \(R^2\). Its most useful role is comparing specifications fitted to the same outcome on the same sample.

A pseudo-\(R^2\) does not validate a causal interpretation and does not by itself measure out-of-sample performance.

Classification thresholds

A fitted logit produces probabilities, not zeros and ones. Classification adds a decision rule such as

\[ \hat y_i= \begin{cases} 1 & \text{if }\hat p_i>c,\\ 0 & \text{if }\hat p_i\le c. \end{cases} \]

The common threshold \(c=0.5\) is a convention, not a theorem. Lowering it identifies more actual positives but also creates more false positives.

The right threshold depends on the relative cost of the two mistakes. Disease screening, fraud detection, and marketing need not use the same cutoff.

The confusion matrix

Predicted 0 Predicted 1
Actual 0 True negative: 4478 False positive: 0
Actual 1 False negative: 392 True positive: 0

The highest fitted callback probability is 24.4%, so at the 0.5 threshold the model predicts no callbacks at all. Its accuracy is nevertheless 92.0%.

This accuracy reflects the low callback rate. The classifier detects none of the observed callbacks.

Evaluating a rare outcome

A rule that always predicts the majority class is correct whenever the rare event does not occur. In our data, predicting “no callback” for every resume achieves 92.0% accuracy.

Sensitivity asks what fraction of actual positives were detected. Specificity asks what fraction of actual negatives were rejected. Precision asks what fraction of positive predictions were correct.

No single threshold-based metric captures the quality of the probability forecasts. Calibration, ROC curves, precision–recall curves, and proper scoring rules such as log loss add complementary information.

Never report accuracy without the baseline

For a rare event, always compare model accuracy with the majority-class rule and report metrics for the positive class.

Out-of-sample evaluation

Training-set fit describes observations used in estimation. Out-of-sample evaluation assesses predictions for observations excluded from that estimation.

Separate training and test data. Select the model using the training data, then evaluate the chosen model on the test data. Cross-validation can support model selection within the training data.

Random splitting is inappropriate when nearby observations share information. Time-series prediction should respect time; clustered data should keep related observations together.

The estimand and the validation design must match the deployment setting.

Software

Estimating the three models

Code
library(dplyr)
library(fixest)
library(haven)
library(modelsummary)

resumes <- read_dta(
  "https://empirical-economics.netlify.app/tutorials/datafiles/lakisha_aer.dta"
) |>
  mutate(
    white = as.integer(race == "w"),
    female = as.integer(sex == "f"),
    occupation = factor(occupbroad)
  )

# LPM with heteroskedasticity-robust standard errors
lpm <- feols(
  call ~ white + female + yearsexp + i(occupation),
  data = resumes,
  vcov = "hetero"
)

# Logit and probit, estimated by maximum likelihood
logit <- glm(
  call ~ white + female + yearsexp + occupation,
  data = resumes,
  family = binomial("logit")
)
probit <- glm(
  call ~ white + female + yearsexp + occupation,
  data = resumes,
  family = binomial("probit")
)

# One table with the log-likelihood of each model
modelsummary(
  list("LPM" = lpm, "Logit" = logit, "Probit" = probit),
  coef_omit = "occupation",
  gof_map = c("nobs", "logLik")
)
Code
import pandas as pd
import pyfixest as pf
import statsmodels.formula.api as smf

resumes = pd.read_stata(
    "https://empirical-economics.netlify.app/tutorials/datafiles/lakisha_aer.dta"
)
resumes["white"] = (resumes["race"] == "w").astype(int)
resumes["female"] = (resumes["sex"] == "f").astype(int)
resumes["occupation"] = resumes["occupbroad"].astype("category")

formula = "call ~ white + female + yearsexp + C(occupation)"
lpm = pf.feols(formula, data=resumes, vcov="hetero")
logit = smf.logit(formula, data=resumes).fit()
probit = smf.probit(formula, data=resumes).fit()

# The maximized log-likelihood is stored with each fit
print(logit.llf, probit.llf)

The link changes the scale of the raw coefficients. It should not change the definition of the outcome, sample, controls, or standard-error strategy.

Reporting probability effects

Code
library(marginaleffects)

# Average marginal effect of experience and average
# discrete change of the name indicator
avg_slopes(logit, variables = "yearsexp")
avg_comparisons(logit, variables = "white")

# The name gap on the probability scale at two experience levels
avg_comparisons(
  logit,
  variables = "white",
  newdata = datagrid(yearsexp = c(2, 20), grid_type = "counterfactual"),
  by = "yearsexp"
)
Code
# Average marginal effects; dummy=True gives discrete changes for 0/1 variables
logit.get_margeff(at="overall", dummy=True).summary()

# The name gap at 2 and at 20 years of experience
for years in (2, 20):
    as_white = resumes.assign(white=1, yearsexp=years)
    as_black = resumes.assign(white=0, yearsexp=years)
    gap = (logit.predict(as_white) - logit.predict(as_black)).mean()
    print(years, gap)

Name the quantity in the output: raw coefficient, odds ratio, marginal effect at a specified case, average marginal effect, discrete change, or predicted probability.

Summary

What did we learn?

  1. For a binary outcome, the conditional mean is the probability of one.
  2. The LPM reports probability changes directly but can predict outside \([0,1]\) and needs robust standard errors.
  3. Logit and probit use a CDF to transform a linear index into a probability; the latent scale is fixed by normalization.
  4. MLE chooses the parameters that make the observed outcomes most probable. With only a dummy regressor it reproduces the group rates; its standard errors come from the curvature of the log-likelihood.

What did we learn? (continued)

  1. Report marginal effects for continuous regressors and discrete changes for binary regressors; both vary across observations.
  2. In logit and probit, the interaction coefficient is not the interaction effect on the probability.
  3. Evaluate classification against the majority-class baseline and assess prediction out of sample.

Exit questions

  1. Why does the LPM require heteroskedasticity-robust standard errors?
  2. Why can the threshold and the variance of the latent error be fixed without loss?
  3. Why does a logit of call on white alone reproduce the two callback rates?
  4. Why can marginal effects differ across observations?

Exit questions (continued)

  1. How should you calculate the effect of a binary regressor?
  2. Why is the logit interaction coefficient not the interaction effect on the probability?
  3. How can a classifier achieve 92% accuracy without detecting any positive outcomes?
  4. Where do the standard errors of a logit or probit come from?

Answers to the exit questions

  1. Binary variance. If \(p_i=\Pr(y_i=1\mid x_i)\), then \(\operatorname{Var}(u_i\mid x_i)=p_i(1-p_i)\). It changes with \(x_i\) whenever \(p_i\) does.
  2. Normalization. A threshold is absorbed by the intercept, and scaling \(\beta\) and \(\varepsilon\) by the same constant leaves every probability unchanged.
  3. Two coins. The log-likelihood splits into one coin log-likelihood per group, each maximized at that group’s sample rate.
  4. Different locations. The effect is \(f(x_i'\beta)\beta_k\). Other covariates place observations on differently sloped parts of the S-curve.

Answers to the exit questions (continued)

  1. A discrete move. A dummy changes from zero to one. Predict at both values, subtract, and average if an AME is wanted.
  2. Two densities. The effect of \(x\) in each group is scaled by \(f(\cdot)\) at a different index, so the probability interaction is non-zero even when \(\beta_{12}=0\).
  3. Rare outcomes. If only 8% are positive, always predicting zero is already 92% accurate while detecting none of the positives.
  4. Curvature. They measure how sharply the log-likelihood falls away from its maximum: a sharp peak gives small standard errors, a flat peak large ones.

Looking ahead

Lecture 7 studies time series: observations on the same variables over time. We examine persistence, serial correlation, dynamic regression, and forecasting.

Source notes

  • Ai, Chunrong, and Edward C. Norton (2003), “Interaction Terms in Logit and Probit Models,” Economics Letters 80(1), 123–129.
  • Bertrand, Marianne, and Sendhil Mullainathan (2004), “Are Emily and Greg More Employable Than Lakisha and Jamal? A Field Experiment on Labor Market Discrimination,” American Economic Review 94(4), 991–1013.
  • Binary-response material follows Wooldridge, Introductory Econometrics, Sections 7.5 and 17.1.

The End