Announcement

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

  • Regression Question

    I am running a regression on 12 variables and one variable needs to be restricted by head of household status. Here is my syntax:
    regress no_house_valueh famsize nchild ((age if relate==1)) no_vehicles trantime incwage incbus00 incwelfr incinvst incretir incss incsupp if statefip==53 & relate==1
    Obviously this is not working. How do I restrict the age variable to relate==1?

  • #2
    I'm going to assume here that relate is a 0/1 variable. You want the model to include age as a variable if relate == 1, but not if relate == 0. `I also assume that age is a continuous variable. There is no way to do that directly. But you can trick Stata into doing it as follows. If we had an interaction model with c.age##i.relate, then the model would, indirectly, estimate two different age coefficients, one for relate = 0 and the other for relate = 1. So we could build on that by further constraining the model so that the coefficient estimate for relate = 0 was fixed at zero. That turns out to be easy: just omit the "main" effect for age. So it would be:

    Code:
    regress no_house_valueh famsize nchild i.relate i.relate#c.age no_vehicles... //etc.
    In the output, the coefficient of age for relate == 1 will be shown as the coefficient of the 1.relate#c.age coefficient. And when relate == 0, age will have, implicitly, a zero coefficient, and hence not be in the model.

    Note: I do not understand the if-condition at the end. By including the condition relate == 1, you make the whole point of your question moot. If relate == 1 for the entire estimation sample then there is no issue of what the model does with age when relate != 1. So I assume that part is a mistake and you should just drop it. (The -if statefip == 53- part looks fine.)

    Comment


    • #3
      Hi Clyde,
      Thank you so much. I figured it out.
      -Joan

      Comment

      Working...
      X