Step 8: Functional Form: Logs and Quadratics
- “Linear regression” means linear in the parameters. Logs, squares and products of variables are just new regressors, so OLS can fit curves.
- Log-level: one more unit of \( x \) changes \( y \) by about \( 100\beta \)%, exactly \( 100(e^{\beta}-1) \)%. Log-log: \( \beta \) is an elasticity. Level-log: a 1% rise in \( x \) changes \( y \) by \( \beta/100 \) units.
- In a quadratic \( \beta_1x + \beta_2x^2 \), the marginal effect is \( \beta_1 + 2\beta_2x \) and the turning point is \( -\beta_1/(2\beta_2) \). With an interaction \( \beta_3x_1x_2 \), the effect of \( x_1 \) is \( \beta_1 + \beta_3x_2 \).
- Never compare \( R^2 \) between a model for \( y \) and a model for \( \log y \). To predict \( y \) from a log model, multiply \( e^{\widehat{\log y}} \) by \( e^{\hat\sigma^2/2} \) or a smearing factor.
- Exam point: use the exact formula \( 100(e^{\beta}-1) \) for dummies and whenever \( |\beta| \) is above about 0.1.
- How to interpret a slope in level-level, log-level, level-log and log-log models, approximately and exactly.
- How to read an elasticity from a log-log model, and why it is not automatically a causal elasticity.
- When to take logs of a variable, and when not to.
- How to fit a quadratic, find the marginal effect at any point and locate the turning point.
- How to read interaction terms, why centring helps, and how to predict \( y \) from a model for \( \log y \).
Linear in the parameters, not the variables
Real economic relationships are rarely straight lines. An extra $10,000 of income matters far more to a poor household than to a rich one. Wages rise quickly early in a career and then level off. If you force every relationship into \( y = \beta_0 + \beta_1x + u \), you get the shape wrong and the numbers wrong.
The good news is that OLS is far more flexible than it looks. All of these are linear regressions, because each \( \beta \) multiplies something you can compute from the data:
You create a new column (a log, a square, a product) and run OLS as usual. Unbiasedness, standard errors, \( t \) tests and \( F \) tests from Step 6 and Step 7 all carry over. By contrast, \( y = \beta_0 + \beta_1x^{\beta_2} + u \) is not linear in parameters and needs non-linear least squares. What changes with transformations is interpretation, and that is what this step is about.
Logs: four ways to write a model
Throughout, log means the natural logarithm. A small change in \( \log y \) is approximately the proportional change in \( y \): \( 100\,\Delta\log y \approx \%\Delta y \). If \( y \) rises from 100 to 105, the log rises by 0.0488, close to 5%. The approximation gets worse as the change grows: from 100 to 150 the log change is 0.405, not 0.5.
| Form | Model | Meaning of \( \beta_1 \) |
|---|---|---|
| Level-level | \( y \) on \( x \) | One more unit of \( x \) changes \( y \) by \( \beta_1 \) units. |
| Log-level | \( \log y \) on \( x \) | One more unit of \( x \) changes \( y \) by about \( 100\beta_1 \)%; exactly \( 100(e^{\beta_1}-1) \)%. |
| Level-log | \( y \) on \( \log x \) | A 1% rise in \( x \) changes \( y \) by about \( \beta_1/100 \) units. |
| Log-log | \( \log y \) on \( \log x \) | A 1% rise in \( x \) changes \( y \) by about \( \beta_1 \)%: an elasticity. |
Chapter 8 of Econometrics Made Simple fits all four forms to the 500 sales in houses.csv (price in $000, floor area in sq ft). The slopes are 0.14076 (level-level), 0.00037 (log-level), 251.06 (level-log) and 0.693 (log-log). Interpret each.
The elasticity is below 1: price rises less than in proportion to size, so larger houses are cheaper per square foot.
Exact versus approximate percentages
In a log-level model, if \( x \) rises by one unit, \( \log y \) rises by exactly \( \beta_1 \), so \( y \) is multiplied by \( e^{\beta_1} \):
For small coefficients the gap is tiny: \( \beta_1 = 0.05 \) gives 5% approximately and 5.13% exactly. For larger ones it matters: \( \beta_1 = 0.5 \) means 64.87%, not 50%, and \( \beta_1 = -0.5 \) means −39.35%, not −50%. Use the exact formula for dummy variables, which can only jump from 0 to 1, and whenever \( |\beta_1\Delta x| \) exceeds about 0.1. Our post How to Interpret Log Coefficients in Regression: The Four Rules drills this with more examples.
A fuller house model gives \( \widehat{\log(\text{price})} = 0.769 + 0.698\log(\text{sqft}) – 0.0051\,\text{age} + 0.0978\,\text{pool} \). Interpret the pool and age coefficients, and the effect of a house being 20 years older.
Elasticities and log-log models
An elasticity is the percentage change in \( y \) for a 1% change in \( x \): \( \varepsilon = (\Delta y/\Delta x)(x/y) \). In a log-log model it is simply \( \beta_1 \), at every value of \( x \), with its own standard error. That is why log-log models are the workhorse for demand curves, production functions and cost functions.
In a level model the elasticity changes along the line, so it is usually evaluated at the means. For the houses, \( \hat\varepsilon = 0.14076 \times 1803.71/369.11 = 0.688 \), very close to the log-log 0.693. The two forms agree in the middle of the data and differ at the edges.
The log-log house model has \( \hat\beta_1 = 0.69291 \) with \( \operatorname{se} = 0.02805 \). Test whether the elasticity equals 1, and say what happens to price per square foot as size rises.
Price per square foot falls by about 0.31% for each 1% increase in size. Big houses are cheaper per square foot.
When to take logs
Usually log: money amounts and other large positive quantities (wages, income, prices, sales, GDP, population); variables whose spread grows with their level; variables you want an elasticity for. Usually do not log: variables in years (education, experience, age); rates and percentages (unemployment, inflation), whose coefficients are read in percentage points; variables that can be zero or negative; and dummies.
Skewness is a quick guide. Hourly wages in wages.csv have a skewness of 2.40, a long right tail. The log wage has skewness 0.16, close to symmetric. Logs also tame extreme values and often make the errors closer to homoskedastic, which helps with the problem of Step 11.
Quadratics: effects that change with \( x \)
Workers’ pay rises steeply in the first years of a career, then flattens. A quadratic captures this:
If \( \beta_2 > 0 \) and \( \beta_3 < 0 \), the profile is an upside-down U. On the 1,000 workers in wages.csv the fitted equation is
Both experience terms are highly significant (\( t = 6.78 \) and \( t = -4.81 \)). The squared coefficient looks tiny, but it multiplies numbers in the hundreds. Rounding it to −0.0006 would move the turning point from 31.6 to 31.3 years, which is why it is reported to six decimal places.
Using the fitted equation, find the marginal effect of experience at 5, 15 and 30 years, and the turning point.
The safe conclusion is that wages level off after about 30 years, not that they fall sharply. A quadratic is symmetric about its turning point by construction, whether or not the data say so. From zero experience to the peak, predicted log wages rise by 0.595, a rise of \( 100(e^{0.595}-1) = 81\% \) in the wage.
To test for curvature, use the \( t \) statistic on the squared term (here −4.81, so linearity is firmly rejected). To test whether experience matters at all, test both terms jointly with an \( F \) test, as in Step 7.
Interaction terms
Is a year of schooling worth more to an experienced worker? An interaction term, the product \( x_1x_2 \), lets the effect of one variable depend on the other:
So \( \beta_3 \) is how much the effect of \( x_1 \) changes when \( x_2 \) rises by one unit, and \( \beta_1 \) alone is the effect of \( x_1 \) when \( x_2 = 0 \), which may never occur in the data.
The book estimates \( \widehat{\log(\text{wage})} = 1.5949 + 0.0925\,\text{educ} + 0.0044\,\text{exper} + 0.00065\,\text{educ}\times\text{exper} \). Find the return to education at 5, 17.67 (the mean) and 30 years of experience. What does 0.0044 mean?
The cure is to centre the variables before forming the product: subtract each mean, so zero means “average”. The interaction, fitted values and \( R^2 \) (0.189 in both versions) do not change. Now the education coefficient, 0.10409, is the return at average experience, and the experience coefficient, 0.01201, is highly significant: at average education an extra year of experience adds about 1.2%.
Comparing fit and predicting with a log dependent variable
The level-level house model has \( R^2 = 0.552 \) and the log-log model 0.551. That does not mean the level model fits better. One explains the variation in price, the other the variation in log price: different quantities. \( R^2 \), adjusted \( R^2 \), the standard error of the regression, AIC and BIC can be compared only between models with the same dependent variable on the same observations. The log-level (0.524) and log-log (0.551) models can be compared, and the log of size fits better.
To predict \( y \) itself from a model for \( \log y \), exponentiating the predicted log is not enough. Because \( E(e^u) > 1 \) even when \( E(u) = 0 \), the naive prediction estimates roughly the median of \( y \), not its mean.
A log-wage model with education, a quadratic in experience and a female dummy has \( \hat\sigma = 0.4513 \). For a man with 12 years of school and 10 of experience the predicted log wage is 2.8968. Predict his hourly wage.
Across the sample, the mean naive prediction is $18.44 against an actual mean of $20.48; after smearing it is $20.42. Naive predictions are about 11% too low.
Practise: 6 questions
Try each one on paper first, then check the worked answer.
EasyQ1. In a regression of log earnings on years of job training (and controls), the training coefficient is 0.035. Give the approximate and exact percentage effect of one more year of training. Show worked answer
Exact: \( 100(e^{0.035}-1) = 3.56\% \).
The coefficient is small, so the two are almost the same; both hold the controls fixed.
EasyQ2. A log-log demand equation gives a price coefficient of −1.2. By how much does quantity demanded change after a 5% price rise, approximately and exactly? Is demand elastic? Show worked answer
Exact: \( 100(1.05^{-1.2}-1) = -5.69\% \).
\( |\varepsilon| = 1.2 > 1 \), so demand is elastic (if the coefficient can be read causally).
MediumQ3. Crop yield (tonnes per hectare) on nitrogen fertiliser \( N \) (kg per hectare) gives \( \widehat{\text{yield}} = 2.1 + 0.048N – 0.00016N^2 \). Find the marginal effect at \( N = 100 \), the yield-maximising \( N \) and the maximum predicted yield. Show worked answer
Turning point: \( N^* = 0.048/(2 \times 0.00016) = 150 \) kg/ha. Since the squared coefficient is negative, it is a maximum.
Yield at 150: \( 2.1 + 7.2 – 3.6 = 5.7 \) tonnes/ha.
MediumQ4. A log house-price model has a coefficient of 0.18 on a garage dummy and −0.35 on a flood-zone dummy. Give the exact percentage effects and explain why the approximation is poor here. Show worked answer
Flood zone: \( 100(e^{-0.35}-1) = -29.53\% \), not −35%.
Dummies jump from 0 to 1, so there is no small change to appeal to, and both coefficients exceed 0.1 in absolute value, where the approximation \( 100\beta \) breaks down.
MediumQ5. A wage model includes \( 0.08\,\text{educ} + 0.01\,\text{exper} + 0.002\,\text{educ}\times\text{exper} \) (log wage). Find the return to education at 10 and at 25 years of experience. What does 0.08 measure? Show worked answer
At 10 years: \( 0.08 + 0.02 = 0.10 \), about 10%.
At 25 years: \( 0.08 + 0.05 = 0.13 \), about 13%.
0.08 is the return to education for a worker with zero experience, which may be outside the data. Centring experience would make it the return at average experience.
ExamQ6. A model for log monthly sales ($000) has \( \hat\sigma = 0.6 \) and \( R^2 = 0.41 \). (a) For one shop the predicted log sales are 2.5. Find the naive and the normal-corrected prediction of sales. [3] (b) A colleague’s model for sales in levels has \( R^2 = 0.38 \) and she says your model fits better. Comment. [2] (c) In a level-log model of sales on log(local income), the coefficient is 85. Find the exact effect of a 10% rise in income. [2] Show worked answer
Correction factor: \( \exp(0.6^2/2) = e^{0.18} = 1.197 \). [M1]
Corrected: \( 12.18 \times 1.197 = 14.59 \), about $14,590. [A1]
(b) The \( R^2 \)s cannot be compared: one is for log sales, the other for sales. [B1] Compare on the same scale, e.g. the squared correlation between actual sales and the log model’s predictions of sales. [B1]
(c) \( \Delta y = 85 \times \log(1.1) \) [M1] \( = 8.10 \), about $8,100 more in monthly sales. [A1]
Total: 7 marks.
Check yourself
1. In a log-log model the slope is 0.693. This means
2. \( \hat y = 10 + 4x – 0.1x^2 \). Where is the turning point?
3. Which pair of models can have their \( R^2 \) compared?
Your score: 0 out of 3
The short version
- OLS needs linearity in the parameters, not the variables. Logs, squares and products are just new regressors.
- Log-level: \( 100\beta \)% approximately, \( 100(e^{\beta}-1) \)% exactly, which you must use for dummies and when \( |\beta| > 0.1 \). Log-log: \( \beta \) is an elasticity (0.693 for house price on floor area).
- An elasticity from market data is not automatically causal: the naive coffee demand elasticity is −0.172 against a true −0.6.
- Log positive, skewed money variables; not years, rates, or variables with zeros.
- Quadratic: marginal effect \( \beta_1 + 2\beta_2x \), turning point \( -\beta_1/(2\beta_2) \). Wages peak at about 31.6 years, with only 9.4% of workers beyond.
- Interaction: the effect of \( x_1 \) is \( \beta_1 + \beta_3x_2 \); centring makes the main effects the effects at the mean.
- Never compare \( R^2 \) across \( y \) and \( \log y \). Correct log predictions with \( e^{\hat\sigma^2/2} \) or smearing (1.107 in the wage model).
- Chapter 8 of Econometrics Made Simple covers all of this in full, plus standardised coefficients, with code and a full set of exercises with answers.
Studying more than one subject? The Complete Book Bundle includes every Economics, Statistics, Mathematics and Econometrics book we publish.
Further reading on EconTutorials
Related in-depth articles from our blog, and the neighbouring steps:
