Announcement

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

  • Can I include fixed effect instead of control when it is interacted with main independent variable?

    So my main variable is X, and I interact it with a person's age. Of course, I include both age and X*age. But instead of age term, can I include instead i.age ? If the relationship between Y and age is not purely linear, isn't it just a precise model to include i.age instead of age?


  • #2
    The proper way to interact X and age in Stata is (assuming X is continuous)
    Code:
    c.age##c.X
    If age is categorical or X is categorical then replace c with i. The result will be test of whether the effect of age on Y differs by X or whether the effect of X on Y differs by age. To test non-linearity in age, it is common to include a quadratic age term. Again, you can do this in Stata like

    Code:
    c.age##c.age
    Which will report both age and age-squared as covariates in your model.

    Finally, if you include age as a covariate, then Stata will report the effect of a 1 unit increase in age on Y. If you include i.age, it will include the categories of age (assuming you have categories), and each will be interpreted as a binary variable relative to the omitted category.

    Comment


    • #3
      The question James asks is very deep, and he pretty much answers himself in the question.

      All that Chris says is very useful, he explains the mechanics of how this can be done, and the popular approach of including polynomials if you worry about nonlinearity.

      I would just add a few clarifying remarks. Let say that you have y, age, and X, the latter being continuous.

      The model
      Code:
      reg y age X c.age#c.X
      is parsimonious, estimates only 4 parameters, and imposes a lot of structure in the sense that the derivative dy/dX = _b[X] + _b[c.age#c.X]*age is fully parametrised by the assumed to be continuous here age.

      One can instead go fully nonparametric with respect to age, and estimate

      Code:
      reg y i.age X i.age#c.X
      and this would give many parameters, depending on how many levels of age you have. This latter model, and the derivative dy/dX it delivers, is equivalent to estimating
      Code:
      reg y X
      for each separate level of age, and getting as many derivatives dy/dX as age levels you have.

      Comment


      • #4
        Joro Kolev Thank you!

        What I am thinking of doing is using fixed effect (i.) for "age" but use continuous (c.) variable for it when it is interacted:

        Code:
         reg y i.age X c.age#c.X
        Does this have any conceptual problem?

        Comment


        • #5
          James, you can do whatever you want, it is a free world, and Stata surely will not break :-).

          What you have in mind is somewhere in between of what I described, and the "traditional" way that Chris described.

          So with what you have in mind, you will be allowing for a different intercept for every age group, but you will still be constraining the derivative to be fully parametrised by age: dy/dX = _b[X] + _b[c.age#c.X]*age.

          If you go for your plan, check out the thread below where we discussed how you can make the resulting estimates more easily interpretable by subtracting from age a certain value, e.g., by centering age by subtracting its mean:


          https://www.statalist.org/forums/for...-in-panel-data

          Comment

          Working...
          X