5  Effects

PDF version

Section 4 defined marginal effects as changes in the population conditional expectation function (CEF).

We now study how these effects are estimated and interpreted.

We also distinguish conditional associations from causal effects.

5.1 Marginal Effects and Their Estimates

Let D_i denote the regressor of interest and let \boldsymbol C_i collect the control variables.

The population CEF is m(d,\boldsymbol c) =E[Y_i\mid D_i=d,\boldsymbol C_i=\boldsymbol c].

For a continuous regressor, its marginal effect is ME_D(d,\boldsymbol c) :=\frac{\partial m(d,\boldsymbol c)}{\partial d}. \tag{5.1}

For a discrete change from d to d', the corresponding effect is \Delta_D(d,d';\boldsymbol c) :=m(d',\boldsymbol c)-m(d,\boldsymbol c). \tag{5.2}

In both cases, the control variables \boldsymbol C_i are held fixed at \boldsymbol c.

For an additive linear CEF, m(d,\boldsymbol c) =\beta_1+\beta_Dd+\boldsymbol c'\boldsymbol\gamma, the continuous marginal effect and the one-unit discrete change are \beta_D.

More generally, changing d to d' changes the CEF by \beta_D(d'-d).

Estimated effects replace the population coefficients with their estimates.

5.2 Conditional Association and Causality

A conditional-mean difference compares different groups in the population.

A causal effect asks what would happen to the same unit under different values of D_i.

NotePotential outcomes

Let Y_i(d) denote the outcome unit i would have if D_i were set to d.

The individual causal effect of changing D_i from d to d' is Y_i(d')-Y_i(d).

Its population average is E[Y_i(d')-Y_i(d)].

We observe only the outcome under the realized value: Y_i=Y_i(D_i).

When Is a Conditional Comparison Causal?

Three conditions connect the observed CEF to potential outcomes:

  • Observed outcome: If D_i=d, then Y_i=Y_i(d).
  • Conditional comparability: Given \boldsymbol C_i, the value of D_i does not reveal the mean of Y_i(d).
  • Overlap: The values of D_i being compared occur for the relevant values of \boldsymbol C_i.

Conditional comparability can be written, for every d, as E[Y_i(d)\mid D_i,\boldsymbol C_i] =E[Y_i(d)\mid\boldsymbol C_i].

For continuous D_i, overlap means that d lies inside the conditional support of D_i.

Under these conditions, E[Y_i(d)\mid\boldsymbol C_i=\boldsymbol c] =E[Y_i\mid D_i=d,\boldsymbol C_i=\boldsymbol c] =m(d,\boldsymbol c). \tag{5.3}

Therefore, E[Y_i(d')-Y_i(d)\mid\boldsymbol C_i=\boldsymbol c] =m(d',\boldsymbol c)-m(d,\boldsymbol c).

For a continuous treatment, the derivative in Equation 5.1 has the analogous causal interpretation.

The zero conditional mean condition from Section 4 describes the residual around the observed CEF.

It does not by itself establish conditional comparability of potential outcomes.

5.3 Omitted Variables and Controls

Consider the population model Y_i=\beta_1+\beta_DD_i+\gamma C_i+U_i, \qquad E[U_i\mid D_i,C_i]=0, where C_i is a scalar control variable.

If we regress Y_i only on D_i, the population slope is \widetilde\beta_D =\beta_D +\gamma\frac{\mathrm{Cov}(D_i,C_i)}{\mathrm{Var}(D_i)}. \tag{5.4}

The second term is the omitted-variable bias in this linear setup.

It is nonzero when \gamma\neq0 and \mathrm{Cov}(D_i,C_i)\neq0.

Under the causal conditions above, \beta_D can describe a causal effect. Without them, Equation 5.4 compares two population regression slopes.

Causal Diagrams

A directed acyclic graph (DAG) summarizes a proposed causal structure.

An arrow represents a direct causal effect, not merely a correlation.

Confounders

A confounder is a common cause of the regressor and the outcome.

Figure 5.1: Family background is a common cause of education and wage.

The path through family background can make education and wage move together apart from the causal effect of education.

Holding an appropriate set of confounders fixed can close such noncausal paths.

Mediators

A mediator transmits part of the causal effect from the regressor to the outcome.

Figure 5.2: Job position mediates part of the effect of education on wage.

Controlling for job position blocks this part of the effect.

This is inappropriate for the total effect, but may be relevant when a direct effect is the target and additional assumptions are justified.

Colliders

A collider is a common effect of two variables.

Figure 5.3: Employment is a collider because it is affected by education and ability.

Analyzing only employed people conditions on employment. This can create an association between education and ability.

It thereby opens the noncausal path from education through ability to wage.

A variable is not a good control merely because it predicts the outcome, is correlated with the regressor, raises R^2, or stabilizes a coefficient.

Control selection requires a causal argument and depends on the effect of interest.

5.4 Application: Class Size and Test Scores

The CASchools data contain 420 California school districts.

The outcome is the district’s average test score. The student-teacher ratio STR is the average number of students per teacher and serves as a measure of class size.

data("CASchools", package = "AER")
CASchools$STR = CASchools$students / CASchools$teachers
CASchools$score = (CASchools$read + CASchools$math) / 2

We compare three specifications:

fit1 = lm(score ~ STR, data = CASchools)
fit2 = lm(score ~ STR + english + lunch, data = CASchools)
fit3 = lm(score ~ STR + english + lunch + expenditure,
          data = CASchools)

Each column in the table is one regression. The rows report coefficient estimates; a blank cell means that the variable is not included.

(1) (2) (3)
Constant 698.933 700.150 665.988
Student-teacher ratio -2.280 -0.998 -0.235
English learners (%) -0.122 -0.128
Subsidized lunch (%) -0.547 -0.546
Expenditure per pupil 0.004
Num.Obs. 420 420 420

In Model (1), one additional student per teacher is associated with a 2.280-point lower district test score.

In Model (2), the estimated difference is 0.998 points lower when english and lunch are held fixed.

In Model (3), it is 0.235 points lower when expenditure per pupil is also held fixed.

The estimates change because districts with different student-teacher ratios also differ in other ways.

The shares of English learners and students eligible for subsidized lunch may capture pre-existing district characteristics.

Expenditure is more ambiguous. It could affect both class size and scores, or it could itself change when class size changes.

The regression table cannot determine which causal structure is correct. Without a justified control strategy, the coefficients remain conditional associations.

5.5 Polynomials

Section 4 considered the quadratic CEF m_A(a)=\gamma_1+\gamma_2a+\gamma_3a^2.

Its marginal effect is ME_A(a)=\gamma_2+2\gamma_3a.

We estimate this specification for wage and experience:

cps = read.csv("cps.csv")

quadratic_fit = lm(wage ~ experience + I(experience^2), data = cps)
round(coef(quadratic_fit), 3)
    (Intercept)      experience I(experience^2) 
         14.520           0.907          -0.017 

The function I() tells R to include the squared value of experience.

The fitted quadratic function is \widehat m_A(a) \approx14.520+0.907a-0.0171a^2.

Its estimated marginal effect is \widehat{ME}_A(a) =\widehat\gamma_2+2\widehat\gamma_3a \approx0.907-2(0.0171)a. \tag{5.5}

The exact fitted difference for one additional year is \widehat m_A(a+1)-\widehat m_A(a) =\widehat{ME}_A\!\left(a+\frac{1}{2}\right).

Figure 5.4: Sample conditional means and the fitted quadratic function (left). The corresponding estimated marginal effect (right).

The fitted slope decreases with experience, is zero at about 26.5 years, and is negative thereafter.

5.6 Logarithms and Elasticities

For a positive outcome, define its conditional geometric mean as G_Y(x):=\exp(E[\log(Y_i)\mid X_i=x]).

Let p denote a proportional change in X_i. For example, p=0.01 is a one-percent increase.

Specification Change in X_i Exact change
E[Y_i\mid X_i=x]=\beta_1+\beta_2x x\to x+1 \beta_2
E[Y_i\mid X_i=x]=\beta_1+\beta_2\log(x) x\to(1+p)x \beta_2\log(1+p)
E[\log(Y_i)\mid X_i=x]=\beta_1+\beta_2x x\to x+1 G_Y changes by 100(e^{\beta_2}-1)\%
E[\log(Y_i)\mid X_i=x]=\beta_1+\beta_2\log(x) x\to(1+p)x G_Y changes by 100((1+p)^{\beta_2}-1)\%

For small p and \beta_2, \log(1+p)\approx p, \qquad e^{\beta_2}-1\approx\beta_2.

Thus, the linear-log effect is approximately \beta_2p units.

In a log-log model, the approximate change is 100\beta_2p percent. A one-percent increase in X_i therefore corresponds to about a \beta_2-percent change in G_Y.

The conditional geometric mean is generally not the conditional arithmetic mean.

With U_i=\log(Y_i)-E[\log(Y_i)\mid X_i], we have E[Y_i\mid X_i=x] =G_Y(x)E[e^{U_i}\mid X_i=x].

The factor E[e^{U_i}\mid X_i=x] is called the retransformation factor.

When the outcome is logged, the model describes proportional changes in G_Y(x).

It also describes proportional changes in E[Y_i\mid X_i=x] when E[e^{U_i}\mid X_i=x] does not vary with x.

Log Wage and Education

log_fit = lm(log(wage) ~ education, data = cps)

education_effect = coef(log_fit)["education"]
100 * (exp(education_effect) - 1)
education 
 11.42624 

One additional year of education is associated with an estimated 11.43% higher conditional geometric mean of wage.

5.7 Interactions

An interaction allows the effect of one regressor to depend on another.

Let F_i be a binary variable. Consider m(e,f) =\beta_1+\beta_2e+\beta_3f+\beta_4ef.

For wage, education, and female, we estimate

interaction_fit = lm(wage ~ education * female, data = cps)
round(coef(interaction_fit), 3)
     (Intercept)        education           female education:female 
         -19.373            3.341            6.394           -0.997 

The fitted function is \widehat m(e,f) =\widehat\beta_1+\widehat\beta_2e +\widehat\beta_3f+\widehat\beta_4ef \approx-19.373+3.341e+6.394f-0.997ef.

The fitted one-year education difference is \widehat m(e+1,f)-\widehat m(e,f) =\widehat\beta_2+\widehat\beta_4f \approx3.341-0.997f.

The fitted hourly-wage difference is USD 3.34 for observations with female equal to zero and USD 2.34 for observations with female equal to one.

The fitted difference between the two groups at education level e is \widehat m(e,1)-\widehat m(e,0) =\widehat\beta_3+\widehat\beta_4e \approx6.394-0.997e.

Thus, neither the coefficient on female nor the interaction coefficient alone is the group difference at every education level.

Figure 5.5: Sample conditional means and fitted regression lines for the two groups.

The education slopes are conditional associations within each group.

A causal interpretation of the education effect requires the conditions in Equation 5.3. The group difference itself is descriptive.

5.8 Summarizing Effects That Vary

When an effect varies across observations, we can summarize it by an average marginal effect (AME).

For a continuous regressor, the population AME is AME_D :=E[ME_D(D_i,\boldsymbol C_i)].

Its sample plug-in estimator is \widehat{AME}_D :=\frac{1}{n}\sum_{i=1}^n \widehat{ME}_D(D_i,\boldsymbol C_i). \tag{5.6}

For the quadratic experience model, \widehat{AME}_A =\widehat\gamma_2+2\widehat\gamma_3\overline A.

quadratic_beta = coef(quadratic_fit)

mean(quadratic_beta[2] +
       2 * quadratic_beta[3] * cps$experience)
[1] 0.1473215

Across the CPS sample, the average estimated slope of the fitted function is about USD 0.147 in hourly wage per year of experience.

This averages local slopes, not exact one-year changes.

For a binary regressor, the corresponding sample estimate is the average discrete change \frac{1}{n}\sum_{i=1}^n \left[\widehat m(1,\boldsymbol C_i) -\widehat m(0,\boldsymbol C_i)\right].

The AME need not equal the effect for every observation.

It has a causal interpretation only when the required identification conditions hold.

TipInterpreting an estimated effect

State:

  • which variable changes and by how much,
  • which variables are held fixed,
  • whether the effect varies with the regressors,
  • whether it is an association or a causal effect,
  • and the units of the effect.

The next section develops statistical inference for estimated regression coefficients and effects.

5.9 R Code

statistics-sec05.R