Econometrics · Chapter 7

Logs, Dummies and Interactions

Real relationships bend. Pay grows by percents, not dollars; the hundredth ad dollar sells less than the first; a price cut sells more by a proportion. One trick handles all of it: take logs. Here you’ll fit four models to the same data, watch a curve snap into a straight line when the axes turn logarithmic, read every slope in plain English, play detective on mystery data, find the peak of a career’s earnings, and split one line into two with dummy variables.

Data

Model

Missions

    What you’re seeing

    One data set, four models. Each data set is simulated from a known rule: taxi fares grow by a fixed amount per mile (level–level), pay grows by a fixed percent per year of school (log–level), sales grow by a fixed amount each time the ad budget doubles (level–log), and coffee sales fall by a fixed percent for each percent the price rises (log–log). All four models are fitted every time, and the chosen one is drawn thick. The white dashes show the true curve.

    The plain-English box. Each model’s slope means something different, and the box at the top of the chart says what, with today’s numbers. Move the effect-size slider and watch the sentence change.

    Straighten the axes. Tick the box and the axes the model takes logs of turn logarithmic. If the model is right, the cloud slides into a straight band around a straight line. That is what “linear in parameters” means: the model is a straight line in the right coordinates.

    Residuals and the table. A wrong model leaves a pattern in its residuals: the white line through them bends. The right one leaves a flat, patternless band. The table compares fit with R² computed in the original units for all four models, because R² for log y and for y measure different things and can’t be compared directly.

    Logs: percent changes and elasticities

    The natural log has one property that makes it the economist’s favorite function: a small change in log(y) is approximately the proportional change in y.

    Δlog(y) ≈ Δy/y    so    100·Δlog(y) ≈ %Δythe change in the natural log, times 100, is about the percent change; the approximation is good for changes up to about 10%

    So putting logs on one or both sides of a regression changes what the slope measures:

    ModelEquationReading of β₁Typical use
    Level–levely = β₀ + β₁x + uΔy = β₁Δx: one more unit of x, β₁ more units of yFares per mile, output per worker-hour
    Log–levellog(y) = β₀ + β₁x + u%Δy ≈ (100β₁)Δx: one more unit of x, about 100β₁ percent more yWages and years of school (a “semi-elasticity”)
    Level–logy = β₀ + β₁log(x) + uΔy ≈ (β₁/100)%Δx: 1% more x, β₁/100 more units of yDiminishing returns to ad spending
    Log–loglog(y) = β₀ + β₁log(x) + u%Δy ≈ β₁%Δx: β₁ is the elasticityDemand and price, output and inputs

    When 100·β is not good enough. For a change in log(y) of size β̂Δx, the exact percent change in y is

    %Δŷ = 100·[exp(β̂₁Δx) − 1]

    For β̂₁ = 0.05 that is 5.13%, close to 5%. For β̂₁ = 0.25 it is 28.4%, not 25%. For dummy variables in log models, where Δx = 1 is never “small,” always use the exact form (Halvorsen and Palmquist pointed this out in 1980).

    Worked example: what a bachelor’s degree is worth, in percent

    The Bureau of Labor Statistics reports that in 2025 the median full-time worker aged 25 and over with a bachelor’s degree earned $1,578 a week, against $966 for a high school diploma.

    1. Log difference: ln(1,578) − ln(966) = ln(1.634) = 0.491.
    2. The shortcut “100 × 0.491” says 49% more.
    3. The exact gap is exp(0.491) − 1 = 1,578/966 − 1 = 63.4% more.

    For a gap this large, the shortcut understates by 14 percentage points. (These are raw medians, not causal effects: Chapters 6 and 10 explain why.)

    Worked example: an elasticity and revenue

    A coffee roaster estimates log(pounds) = 9.0 − 1.4·log(price). The elasticity is −1.4: a 1% higher price sells about 1.4% fewer pounds.

    1. A 10% price rise: the shortcut says 14% fewer pounds; exactly, 1.10−1.4 − 1 = −12.5%.
    2. Revenue = price × quantity changes by 1.10 × 0.875 − 1 = −3.7%. With demand more elastic than −1, raising the price lowers revenue.
    3. At an elasticity of exactly −1, revenue doesn’t change with price. Try the “Unit elastic” mission.

    When to take logs. Logs suit positive variables that are skewed and grow by proportions: wages, prices, sales, firm size, population. Logged coefficients don’t depend on units (dollars or thousands of dollars give the same elasticity), and logging often tames outliers and uneven spread. Variables measured in years, or already in percents or proportions (an unemployment rate), are usually left in levels. You can’t take the log of zero or a negative number.

    Predicting y from a log model. exp(fitted log y) predicts the median, not the mean, of y. If the errors are normal with variance σ², the mean is exp(σ²/2) times larger. And never compare R² from a log(y) regression with R² from a y regression: they explain different things. Compare fits in the same units, as the table in the simulation does with the squared correlation between y and its prediction.

    Try this: Choose Coffee demand, tick “Show residuals” and step through the four models. The level–level residuals form a smile: the model misses the curve at both ends. Log–log leaves a flat band. Then tick “Straighten the axes” on log–log.
    Try this: Choose Wages and push the return to 25% a year. The sentence in the box now shows a gap of several points between 100·β̂ and the exact percent.

    Quadratics and turning points

    Pay rises fast early in a career, then flattens and may dip. A straight line can’t do that; adding a squared term can:

    y = β₀ + β₁x + β₂x² + u    Δŷ ≈ (β̂₁ + 2β̂₂x)Δx

    The effect of x now depends on where you start. If β̂₁ > 0 and β̂₂ < 0 the curve is a hill whose top is at

    x* = −β̂₁ / (2β̂₂)

    A turning point is only meaningful if it lies inside the data. If few people in the sample are beyond it, the “decline” after the peak is mostly the shape of a parabola, not evidence.

    Worked example: the peak of a pay profile

    Suppose ŵage = 14.00 + 1.12·exper − 0.0224·exper² (the true curve in the simulation’s default).

    1. Turning point: 1.12 / (2 × 0.0224) = 25 years.
    2. At 5 years, one more year adds 1.12 − 2(0.0224)(5) = $0.90 an hour.
    3. At 20 years it adds 1.12 − 0.896 = $0.22. At 30 years it subtracts $0.22.
    4. Predicted wage at the peak: 14 + 1.12(25) − 0.0224(625) = $28.00.

    Jacob Mincer’s earnings equation, the most estimated equation in labor economics, combines this chapter’s tools: log(wage) = β₀ + β₁·school + β₂·exper + β₃·exper² + u. It is log–level in schooling and quadratic in experience.

    Dummy variables and interactions

    A dummy variable is 1 or 0: union member or not, treated or not, December or not. In wage = β₀ + β₁exper + δ₀union + u, δ₀ is the difference in expected wage between union and nonunion workers with the same experience. Graphically it shifts the intercept: two parallel lines.

    Categories. With g categories (four regions, say), include g − 1 dummies and an intercept. The left-out category is the base group, and each dummy’s coefficient is a difference from it. Include all g and the dummies add up to the intercept column: perfect collinearity, the dummy-variable trap.

    An interaction lets a slope differ by group. Adding δ₁(union × exper) gives

    nonunion: E(wage) = β₀ + β₁·exper    union: E(wage) = (β₀ + δ₀) + (β₁ + δ₁)·exper

    δ₀ is the union gap at zero experience and δ₁ the difference in slopes. The gap at any experience level is δ₀ + δ₁·exper. Interactions of two continuous variables work the same way: in y = β₀ + β₁x₁ + β₂x₂ + β₃x₁x₂, the effect of x₁ is β₁ + β₃x₂, so β₁ alone is the effect at x₂ = 0.

    Model

    Goals

      Testing whether two groups need separate lines. Gregory Chow’s test (1960) compares one pooled line with separate lines for each group. With SSRP from the pooled regression and SSR₁ + SSR₂ from separate regressions, each with k + 1 parameters:

      F = {[SSRP − (SSR₁ + SSR₂)] / (k + 1)} / {(SSR₁ + SSR₂) / [n − 2(k + 1)]}

      It is the same as the F test that the dummy and all its interactions are zero in one regression. In the simulation, k = 1 and n = 140, so F has 2 and 136 degrees of freedom. The test assumes the error variance is the same in both groups.

      Worked example: a Chow test by hand

      Pooled SSR = 1,200; union SSR = 500; nonunion SSR = 520; n = 140, one slope each. F = [(1,200 − 1,020)/2] / [1,020/136] = 90 / 7.5 = 12.0. The 1% critical value of F(2, 136) is about 4.8, so the groups clearly need separate lines.

      Common mistake: “a dummy coefficient of 0.40 in a log-wage equation means 40% more pay”

      For a jump of a whole unit (0 to 1), the log approximation is poor. The exact difference is exp(0.40) − 1 = 49%. For a negative coefficient of −0.30, it is exp(−0.30) − 1 = −25.9%, not −30%. A second mistake: reading δ₀ in an interaction model as “the union premium.” It is the gap at zero experience only; the gap at 25 years is δ₀ + 25δ₁, which can have the opposite sign.

      A short history

      Logarithms were published by John Napier in 1614 to speed up astronomers’ multiplication. Three centuries later they became the language of proportional change in economics.

      Elasticity as a measure of how responsive demand is to price was set out by Alfred Marshall in his Principles of Economics (1890). In 1928 Charles Cobb and Paul Douglas fitted a production function that is linear in logs, log(output) = constant + α·log(labor) + β·log(capital), whose coefficients are elasticities.

      The earnings equation. Jacob Mincer’s 1974 book Schooling, Experience, and Earnings made log wages, years of school and a quadratic in experience the standard way to study pay.

      Testing for different lines. Gregory Chow published his test for equality of coefficients in two regressions in Econometrica in 1960. Robert Halvorsen and Raymond Palmquist’s two-page 1980 note in the American Economic Review corrected the habit of reading dummy coefficients in log models as percents.

      Where it shows up

      Pricing. Price elasticities drive pricing. In textbook monopoly pricing, price over marginal cost equals ε/(1 + ε) for an elasticity ε below −1. Costco caps its markup on branded goods at about 14% over cost (see the Costco case); under that textbook rule, a 14% markup would go with an elasticity of about −8. Costco instead chose thin markups as a strategy to sell memberships, which shows the limits of a one-line rule.

      Marketing mix. Models of sales against ad spending almost always use logs of spending, so that each doubling of the budget, not each dollar, adds a fixed amount: diminishing returns.

      Growth and finance. Growth rates are differences of logs: a series that grows 3% a year is a straight line on a log scale. Investors use log returns because they add up over time. (Nothing on this page is financial or investment advice.)

      Policy. Minimum-wage, tax and trade studies report elasticities: of employment to the wage, of taxable income to the tax rate, of imports to the exchange rate. Dummies and interactions measure whether a policy’s effect differs between groups or regions.

      Practice

      1. Warm-up In log(wage) = 0.58 + 0.062·educ, what does 0.062 mean? Give the approximate and exact percent.

        Show the answer

        One more year of school goes with about 6.2% higher wages; exactly 100·[exp(0.062) − 1] = 6.4%.

      2. Warm-up In log(sales) = 7.1 − 0.8·log(price), what happens to sales if the price rises 5%?

        Show the answer

        The elasticity is −0.8, so sales fall about 0.8 × 5 = 4%. Exactly: 1.05−0.8 − 1 = −3.8%. Demand is inelastic (|ε| < 1), so revenue rises: 1.05 × 0.962 − 1 = +1.0%.

      3. Core Monthly sales ($ thousands) = 150 + 40·log(ad spending). How much do sales rise when the ad budget goes from $10,000 to $20,000? From $50,000 to $51,000?

        Show the answer

        Doubling: 40 × ln 2 = 27.7, so about $27,700. From 50 to 51 (a 2% rise): 40 × ln(1.02) = 0.79, about $790. The shortcut β₁/100 per 1% gives 2 × 0.40 = 0.80, nearly the same.

      4. Core In a log-wage regression the coefficient on a dummy for working part time is −0.30. By what percent do part-time workers earn less, other things equal?

        Show the answer

        100·[exp(−0.30) − 1] = −25.9%. Reading it as −30% overstates the gap by about 4 points.

      5. Core ŵage = 5 + 0.60·exper − 0.012·exper². Find the turning point and the effect of one more year at 10 years of experience.

        Show the answer

        Turning point: 0.60/(2 × 0.012) = 25 years. At 10 years: 0.60 − 2 × 0.012 × 10 = $0.36 an hour.

      6. Core A firm sells in four regions: North, South, East and West. An analyst puts an intercept and dummies for all four regions in a sales regression. What happens? Fix it, and say what the coefficient on South then means.

        Show the answer

        The four dummies add to 1 for every observation, which equals the intercept column: the dummy-variable trap. Drop one region, say North. The South coefficient is then the expected difference in sales between South and North, holding the other regressors fixed.

      7. Challenge Pooled SSR = 2,400; the two groups’ separate regressions give SSR = 1,050 and 1,110; n = 200 and each regression has an intercept and two slopes. Compute the Chow statistic.

        Show the answer

        k + 1 = 3. F = [(2,400 − 2,160)/3] / [2,160/(200 − 6)] = 80 / 11.13 = 7.19, with 3 and 194 degrees of freedom. The 1% critical value is about 3.9, so reject equal coefficients.

      8. Challenge In price = β₀ + β₁·sqft + β₂·age + β₃·(sqft × age), the estimates are β̂₁ = 120, β̂₃ = −1.5, with sqft in hundreds of square feet and age in years. What is the effect of 100 more square feet for a new house, and for a 40-year-old house? Why might you center age before running the regression?

        Show the answer

        The effect of sqft is β₁ + β₃·age: $120 for a new house and 120 − 1.5 × 40 = $60 for a 40-year-old one (in the units of price). β̂₁ by itself is the effect at age 0. Centering age (subtracting its mean) makes β̂₁ the effect at the average age, which is easier to report, and doesn’t change the fit.

      How the interactive works

      The data. All data are simulated with a known truth (120 points each). Taxi fares: fare = 3.50 + rate × miles + noise (sd $1.60), trips of 0.5 to 20 miles. Wages: pay = 20·exp(r·(school − 12) + 0.3u), school 8 to 20 years. Ad budgets: sales = 150 + θ·log(ads) + 15u, with ad spending spread evenly on a log scale from $1,000 to $100,000. Coffee demand: pounds = 300·(price/12)ε·exp(0.2u), price $6 to $30. Mysteries draw one of the four forms with random strength. The experience profile is wage = 14 + 14·(2·exper/P − exper²/P²) + 3.5u for 150 workers with 0 to 40 years of experience, so the true peak is at P. The union data are 140 workers, half in a union.

      The estimates. Every model is ordinary least squares from the site’s shared statistics library, with the variables transformed first. Fitted curves for log(y) models are drawn as exp(fitted value). “R² in levels” is the squared correlation between y and that prediction, so all four models are compared in the same units.

      How it was checked (node tests, all passed):

      • Over 1,000 samples each, the true model’s slope averaged 2.5008 (truth 2.5) for taxis, 0.0802 (0.08) for wages, 40.03 (40) for ads and −1.3988 (−1.4) for demand.
      • In 389 of 400 mystery data sets, the true form had the best fit in levels.
      • The estimated turning point had a median of 25.02 years over 1,000 samples with a true peak at 25; β̂₁ + 2β̂₂x matched a numerical derivative.
      • The Chow F from the interacted model equaled the F from two separate regressions to about 10⁻¹³, and with no true difference it rejected in 4.5% of 2,000 samples at the 5% level.
      • Log–log and level–log coefficients and standard errors matched NumPy to 12 or more digits.

      Check yourself

      1. In log(y) = β₀ + 0.05x, one more unit of x goes with…

        Show the answer

        Log–level: %Δy ≈ 100 × 0.05 = 5% (exactly 5.13%).

      2. In log(Q) = β₀ + 0.8·log(K), a 10% increase in capital K goes with…

        Show the answer

        Log–log: β₁ is the elasticity, so 0.8 × 10% = 8%.

      3. In y = β₀ + 50·log(x), a 1% increase in x goes with…

        Show the answer

        Level–log: Δy ≈ (β₁/100)·%Δx = 50/100 = 0.5.

      4. A regression has an intercept and a variable with three categories (small, medium, large). How many dummies should it include?

        Show the answer

        g − 1 = 2. Including all three falls into the dummy-variable trap; the left-out category is the base group.

      5. In wage = β₀ + β₁·exper + δ₀·union + δ₁·union·exper, what is δ₁?

        Show the answer

        δ₁ is the difference in slopes. Union members’ slope is β₁ + δ₁; the gap between groups is δ₀ + δ₁·exper.

      6. A fitted profile is ŵage = 10 + 0.8·exper − 0.02·exper². Where does it peak?

        Show the answer

        −β̂₁/(2β̂₂) = 0.8/0.04 = 20 years.

      Sources

      • J. M. Wooldridge, Introductory Econometrics: A Modern Approach, 7th ed. (Cengage, 2020): Section 2-4 (functional forms with logs), Chapter 6 (logs, quadratics, interaction terms, predicting y from log y, comparing R²) and Chapter 7 (dummy variables, interactions and the Chow test).
      • J. H. Stock and M. W. Watson, Introduction to Econometrics, 4th ed. (Pearson, 2019), Chapter 8 (Nonlinear Regression Functions).
      • U.S. Bureau of Labor Statistics, Education pays, 2025 (Career Outlook): median usual weekly earnings of full-time wage and salary workers aged 25 and over, from the Current Population Survey.
      • Penn State STAT 501, Lesson 8: Categorical Predictors and 9.1: Log-transforming Only the Predictor.
      • G. C. Chow, “Tests of Equality Between Sets of Coefficients in Two Linear Regressions,” Econometrica 28(3), 1960, 591–605.
      • R. Halvorsen and R. Palmquist, “The Interpretation of Dummy Variables in Semilogarithmic Equations,” American Economic Review 70(3), 1980, 474–475.
      • J. Mincer, Schooling, Experience, and Earnings (National Bureau of Economic Research, 1974). C. W. Cobb and P. H. Douglas, “A Theory of Production,” American Economic Review 18(1), Supplement, 1928, 139–165.
      Saved on this device only.
      @teddyrookbook GitHub