Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interaction effect and post estimation

    Hi,
    I have a question related both to model specification and to implementation in Stata.

    I’m trying to model whether a person buys a new house or not, and my main interest is to see whether this differs across age groups (I have four age categories). As a control variable, I include income (log income in dollars). Conceptually, I expect there might be an interaction between age group and income, since the effect of a 1% increase in income on the likelihood of buying a house may differ by age.
    To model this, I used the following Stata command:

    reg y c.income##i.age_group, vce(robust)


    So, my question is how I should go on about it after this. I have read about margins and marginsplot, but I am a bit unsure how this should be specified when my main interst to see if therre is differences between age groups and if the effect of income might differ depending on the age groups.

    Note also, that there is large differences in the mean level of income for each age group.

    /David D

  • #2
    Code:
    margins age_group, dyex(income)
    will give you, for each age group, the marginal effect of log income, which you can then translate into the effect of a 1% income increase in the usual way.

    Then for the other way around, pick a set of interesting, representative incomes (say, for demonstration purposes, 30000, 50000, 80000, 110000, 200000), and run
    Code:
    margins, dydx(age_group) at(income = (30000 50000 80000 110000 200000))
    marginsplot, xdimension(income)
    to get the marginal effect of each age group (relative to the omitted reference category) conditional on each of the selected ages. The graph is usually helpful in interpretation.

    Comment


    • #3
      Thank you Clyde for your helpful comments it worked perfectly!

      Just a follow up question on that. In my earlier comment I had a continuous variable I was interacting the age group variable with. But if I would expect that the effect of income might also differ depending on income levels, and I would instead create a new variable describing income as a category variable (low- middle- and high income levels), how would I interpret this when plotting the post estimations?

      In the code it would be something: reg y i.income_group##i.age_group, vce(robust)

      /David

      Comment


      • #4
        if I would expect that the effect of income might also differ depending on income levels, and I would instead create a new variable describing income as a category variable (low- middle- and high income levels)
        If you expect the effect of income to differ depending on income levels, creating a 3-category variable out of income and using it in the way you describe does not work towards that goal very well. What you will have done is replaced a more precise income variable with a less precise one, making your effect estimates noisier. To say that the effect of income depends on the income level is to say that a linear model of the income effect is inappropriate. Just what non-linear model would be better is a question you then have to confront: you have to be more precise in you hypothesis about how the effect of income varies with the income level. Various transforms of the income variable might suitably model that. Examining the income-outcome relationship graphically might help you select one. If you have no basis for specifying a particular form of non-linear relationship between the effect of income and income, you might consider using a spline (-help makespline-) representation of income in your model, although I think the interpretation of such a model would be difficult.

        What you would get from a three-category income variable is a coarse-grained approximation of the relationship of outcome to income level. By doing it as an interaction with age-group, you get coarse-grained approximations of the age-group specific relationships of outcome to income level. It is true that using a three-category income variable does relax the constraint that, within any age group, the income-outcome relationship must be linear in income. But it replaces it with other constraints which are, typically, much less realistic. For example, if your cutoff point between low and medium income groups is $65,000, then you are imposing the constraint that those with zero income are, for the purposes of your problem, in the same situation a those with income of $64,999. On top of that, that model suggests that the $64,999 income people are not only indistinguishable from the zero-income ones, but they can be radically different from the $65,001 people. Unless the nature of your outcome variable is such that this kind of discontinuous jump in its relationship to income is truly plausible, the 3-category representation is likely to be far less accurate than the linear relationship in your original model.
        Last edited by Clyde Schechter; 14 Nov 2025, 08:32.

        Comment

        Working...
        X