← Tutti i manuali di Economics

Economics · Econometric Analysis of Microdata

Econometric Analysis of Microdata

Causal inference from foundations to empirical research: regression, uncertainty, panel data and difference-in-differences, with worked applications on political representation and voting.

10capitoli
105sezioni
Come studiareCerca un argomento oppure apri un capitolo dall’indice. I titoli ti portano direttamente alla spiegazione corretta.

5. Nonlinear Relationships and Functional Forms

Why a straight line may be too restrictive

A linear regression assigns a constant slope to a regressor: in E[Y∣X]=β0+β1X, increasing X by one unit changes the fitted outcome by β1, wherever the change begins. That can be a useful local approximation, but it is not a universal description of economic behaviour. An additional hour of study may improve performance more when a student has studied little than after prolonged preparation. Additional police officers may have different associations with crime in understaffed and heavily staffed cities. The association between household income and educational performance may also flatten as income rises. Each example motivates examining the shape of the relationship rather than imposing a constant slope automatically.

A scatterplot of average district income and average test scores can help reveal this issue. If the fitted straight line systematically misses the curvature of the cloud, its residuals may be positive in some income ranges and negative in others. A nonlinear specification can represent that pattern more accurately. This is a statement about conditional means, not a guarantee of causation: income may be correlated with family resources, parental education, neighbourhood conditions and other determinants of achievement. Changing the curve does not eliminate omitted-variable bias.

“Nonlinear” can refer to different things. A quadratic regression is nonlinear in the regressor but linear in its unknown coefficients. Ordinary least squares can therefore estimate it after creating the squared regressor. A model such as Y=β0+β1X+β2X2+u remains a linear regression model in this statistical sense. By contrast, a probability model with a normal cumulative distribution function is nonlinear in its coefficients and generally requires a different estimation method.

Quadratic specifications and changing marginal effects

A quadratic specification extends the straight line by adding a squared term. For district income I and average test score T, write:

E[T∣I]=β0+β1I+β2I2.

The coefficient on I is no longer the slope everywhere. Differentiating the conditional mean gives the marginal effect, measured in score points per income unit:

∂E[T∣I]∂I=β1+2β2I.

If β2<0, the slope decreases with income, producing a concave curve; if β2>0, the slope increases. The curve turns where I*=−β1/(2β2), provided β2≠0. A turning point outside the observed range should not be presented as an empirical discovery. A concave curve estimated over a moderate range may eventually imply falling test scores at implausibly high incomes simply because a polynomial is being extrapolated beyond the data.

The derivative describes an infinitesimal change. For a finite change h, the exact fitted difference is β1h+β2(2Ih+h2). With a one-unit increase, this equals β1+2β2I+β2, not just the derivative at the starting point. Distinguishing derivatives from finite differences matters when the interval is large or curvature is strong. It also matters when changing units: measuring income in thousands rather than individual currency units changes both coefficients, although correctly calculated predictions remain the same.

A straight increasing line is compared with an inverted-U quadratic curve. Both are explicitly illustrative functions of income and test score.
Figure 9. Constructed linear and quadratic functions illustrate changing marginal effects. The quadratic slope is 3 − 0.07x, so it decreases with x and turns negative above approximately 42.86. These curves are not fitted estimates from the school dataset.
Open figure at full size ↗

A quadratic should usually include both the linear and squared terms. Dropping the linear term imposes a zero slope at I=0, an assumption that needs an economic justification. Centering income around a meaningful value can make the intercept and linear coefficient easier to interpret without changing fitted values, provided the corresponding transformed model includes all required terms.

Logarithms, proportional changes and skewness

The natural logarithm transforms multiplicative differences into additive differences. Its defining comparison is ln(x2)−ln(x1)=ln(x2/x1). Doubling a positive variable always increases its logarithm by ln2, whether the original change is from 1 to 2 or from 100 to 200. This makes logs useful when proportional differences are more informative than absolute differences. Unless another base is explicitly stated, log and ln here denote the natural logarithm, with base e.

For a small proportional change g, ln(1+g)≈g. Increasing income from 100 to 101 is a 1% increase and changes log income by approximately 0.01. Increasing it from 1 to 2 is a 100% increase and changes log income by approximately 0.693; treating this log difference as 1 would be a poor approximation. A log scale does not literally replace every difference by its percentage change. It expresses ratios in logarithmic units, which closely approximate proportional changes only when those changes are small.

Two one-dimensional scales show the values 1, 2, 4, 8, 16 and 32. They are increasingly separated on the linear axis and equally separated on the base-2 logarithmic axis.
Figure 10. The same positive values appear on both axes. On a linear scale, equal differences occupy equal distances; on a logarithmic scale, equal ratios do. Successive doublings from 1 to 32 are equally spaced only in the lower panel.
Open figure at full size ↗

Logging a positive variable also compresses large values. Income often has a long right tail, and a histogram of log income may be more balanced than a histogram of income. However, logging does not guarantee normality, and normally distributed regressors are not an OLS requirement. The transformation should reflect the relationship being modelled and the interpretation required. It also changes the treatment of the data: the real-valued logarithm is undefined at zero and for negative observations. Adding an arbitrary constant before logging changes the model and must not be treated as an innocuous repair.

The linear–log model: outcome units for proportional input changes

When the outcome remains in levels but the regressor is logged, the model is:

E[Y∣X]=β0+β1lnX,X>0.

The marginal effect in original units is β1/X, so an equal absolute increase in X has a smaller fitted effect at higher starting values. A 1% increase in X changes the fitted outcome by exactly β1ln(1.01), approximately 0.01β1 units of Y. If Y is a test score and β1=20, a 1% income increase corresponds to approximately 0.2 score points, not a 20% increase in scores. The coefficient remains tied to the units of the outcome.

For any finite comparison from x0 to x1, the fitted difference is β1ln(x1/x0). Doubling the regressor changes the fitted outcome by β1ln2, not by β1. The latter would correspond to multiplying the regressor by e. Changing the currency unit of a positive income regressor shifts its logarithm by a constant and changes the intercept, while leaving the slope and fitted differences unchanged.

This form is particularly useful when the raw relationship bends but the relationship between the outcome and log input appears closer to a straight line. It embodies a specific shape: with a positive coefficient, the outcome rises at a decreasing rate as the input increases. It cannot represent every possible pattern, such as a genuine U-shaped relationship, without additional terms.

Logged outcomes: semi-elasticities and elasticities

In a log–linear model, E[lnY∣X]=β0+β1X, a one-unit increase in X changes the fitted log outcome by β1. The familiar interpretation, an approximately 100β1% change in Y, is accurate only for small coefficients. The exact proportional comparison implied by the fitted log values is:

100(eβ1h−1)%

for a change of h units in X. Thus a coefficient of 0.04 corresponds to about 4.08% for a one-unit increase, whereas a coefficient of 0.42 corresponds to about 52.20%, making the linear approximation much less satisfactory. A negative coefficient of −0.50 implies about 39.35% lower, not 50% lower.

Strictly, exponentiating a conditional mean of log outcomes describes a conditional geometric mean, not automatically the arithmetic conditional mean of the original outcome. From Y=eXβeu, the latter is E[Y∣X]=eXβE[eu∣X]. If the second factor differs across the observations being compared, exponentiating the fitted log difference alone does not give the arithmetic-mean ratio. This distinction matters when predicting expenditure totals or average earnings in currency units.

When both variables are logged, E[lnY∣X]=β0+β1lnX, the slope is an elasticity: ∂lnY/∂lnX=β1. A small 1% increase in X corresponds to an approximately β1% change in Y. For a finite proportional increase g, the exact fitted proportional change is 100[(1+g)β1−1]%. The log–log specification assumes a constant elasticity, whereas the log–linear specification assumes a constant semi-elasticity. These are substantive restrictions, not interchangeable ways of presenting the same regression.

Choosing a functional form

Model choice begins with the economic question, the units of measurement and the range of the observations. Scatterplots help identify curvature and influential observations; residual plots help reveal systematic patterns left unexplained by a fitted model. A skewed regressor may motivate considering a log transformation, but skewness alone does not establish that the conditional mean is linear in its logarithm. The same distinction applies to a skewed outcome: logging it changes the estimand and the weight given to proportional versus absolute errors.

Compare candidate models using the same observations when possible, check whether their implications are plausible within the data range, and consider predictive performance on observations not used for estimation. Ordinary R2 values from a level-outcome regression and a log-outcome regression are not directly comparable measures of fit to the same dependent variable. A higher value after changing the outcome scale does not by itself establish a better model.

Interpretability is also valuable. A parsimonious specification that answers a clear question may be more useful than an elaborate curve with unstable behaviour. Report the marginal effects or fitted comparisons actually relevant to the application. In a quadratic model, give the income level at which a slope is evaluated; in a log model, distinguish a one-unit change from a 1% change. An attractive functional form still requires a credible identification strategy before its coefficients receive a causal interpretation.

Interactions and heterogeneous relationships

An additive model, E[Y∣X1,X2]=β0+β1X1+β2X2, makes the slope with respect to one regressor independent of the other. That may be too restrictive. Rainfall may have a different association with traffic accidents when impaired driving is more common. Local economic conditions may alter the relationship between a governing party’s policy preferences and public spending. An interaction allows the slope to vary systematically:

E[Y∣X1,X2]=β0+β1X1+β2X2+β3X1X2.
∂E[Y∣X1,X2]∂X1=β1+β3X2,∂E[Y∣X1,X2]∂X2=β2+β3X1.

The main coefficient β1 is now the slope of X1 when X2=0, while β2 is the slope of X2 when X1=0. The interaction coefficient measures how one slope changes as the other regressor increases. It should not be interpreted separately as the entire effect of either variable. Retaining both main effects generally avoids imposing arbitrary zero restrictions.

If D is a binary indicator, compare predictions at D=1 and D=0 rather than imagining an infinitesimal change in group membership. In E[Y∣X,D]=β0+β1X+β2D+β3XD, the group difference is β2+β3X. Its uncertainty depends on both coefficient variances and their covariance:

Var(β̂2+xβ̂3)=Var(β̂2)+x2Var(β̂3)+2xCov(β̂2,β̂3).

Consequently, a confidence band for the combined effect cannot be reconstructed from the two reported standard errors alone. Interactions reveal heterogeneity in a fitted relationship; they do not themselves establish why that heterogeneity arises.

Worked example: education, experience and the gender wage gap

Consider a sample of 1,084 individuals from the US Current Population Survey. The outcome is the natural logarithm of hourly wage; education and experience are measured in years; Female equals 1 for women and 0 for men. Four nested regressions show how interpretation changes as controls and an interaction are added. The numbers in parentheses are standard errors. “Not included” means the regressor is absent from that specification, rather than that its coefficient was estimated as zero.

Table 6. Education and the gender wage gap: dependent variable ln(hourly wage)
RegressorModel 1Model 2Model 3Model 4
Education, years0.0692 (0.00556)0.0712 (0.00538)0.0874 (0.00562)0.0793 (0.00630)
Female indicatorNot included−0.272 (0.0302)−0.269 (0.0284)−0.594 (0.147)
Experience, yearsNot includedNot included0.0339 (0.00392)0.0347 (0.00391)
Experience squaredNot includedNot included−0.000473 (0.0000847)−0.000492 (0.0000843)
Female × educationNot includedNot includedNot included0.0253 (0.0116)
Observations1,0841,0841,0841,084

Model 1 associates an additional year of education with approximately 6.92% higher hourly wages. Adding the female indicator in Model 2 changes that slope and introduces a conditional group comparison. Model 3 adds experience and its square. The positive experience coefficient and negative squared coefficient describe a concave experience profile: early additional experience has a larger fitted association than later additional experience. These changes illustrate why a coefficient is conditional on the rest of the specification; they do not identify which regression has solved all selection problems.

Model 4 allows the education slope to differ by gender. For men, the log-wage slope is 0.0793; for women it is 0.0793+0.0253=0.1046. The exact fitted one-year proportional changes are approximately 8.25% and 11.03%, respectively, under the logged-outcome interpretation described above. The experience slope is 0.0347−0.000984Experience. Its fitted turning point is about 35.26 years, whose substantive relevance depends on the observed support and the adequacy of the quadratic specification.

Interpreting and plotting the complete gender contrast

In Model 4, the female coefficient is not the wage gap for every education level. Holding experience constant, the fitted female-minus-male contrast in log wages at education level E is:

Δln(wage)=−0.594+0.0253E.

At zero years of education, this implies a fitted geometric-mean wage ratio of e−0.594≈0.5521, or about 44.79% lower, rather than 59.4% lower. Zero education may also lie far from most observations, making the intercept contrast a poor headline summary. At 12 years the fitted gap is approximately −25.20%; at 16 years it is −17.24%; and at 18 years it is −12.94%. These percentages use 100[e−0.594+0.0253E−1], not the large-coefficient approximation.

The fitted female-versus-male wage contrast rises from about minus 43 percent at one year of education to minus 12.9 percent at 18 years. Exact transformed contrasts are minus 25.2 percent at 12 years and minus 17.2 percent at 16 years.
Figure 11. The reported interaction model implies a conditional log-wage contrast of −0.594 + 0.0253 × education. The figure transforms it exactly into 100 × [exp(contrast) − 1] percent. It compares fitted geometric means, or conditional medians under suitable assumptions; it is not automatically an arithmetic-mean wage effect. Confidence intervals cannot be reconstructed without the coefficient covariance.
Open figure at full size ↗

Each additional year of education raises the female-minus-male log-wage contrast by 0.0253. It does not close the exact percentage wage gap by a constant 2.53 percentage points, because exponentiation is nonlinear. Solving the fitted log contrast for zero gives about 23.48 years of education. That algebraic crossing extends beyond the 1–18-year range illustrated here and should not be interpreted as evidence that a particular amount of education eliminates wage inequality.

The regression documents conditional associations. Differences in occupation, hours, job tenure, employment selection and other unobserved characteristics can still affect the estimates. Nor does controlling for such variables automatically settle a discrimination question, since some controls may themselves reflect unequal opportunities. A useful empirical conclusion states precisely which wage measure, sample, controls and education level are being compared, and separates that comparison from any broader causal claim.

Torna all’inizio ↑

Ripetizioni personalizzate · Da 15€/h

Un dubbio da chiarire?
Studiamolo insieme.

Offro lezioni personalizzate per studenti delle superiori e dell’università: spiegazioni chiare, esercizi guidati e un metodo costruito sulle tue esigenze. Scopri le materie e le tariffe, oppure prenota una lezione per lavorare sul tuo programma.