Announcement

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

  • Including Control Variables

    I'm running a regression of per capita consumption expenditure on income. I have a set of controls for household size, religion, and number of males in the household. I'm a bit confused why stata reports different regression coefficients depending on how I specify the set on controls (just put them as independent variables or put them as $controls. For instance, if I run the regression

    reg consumption income householdsize religion numbermale
    I get a different coefficient for income than if I run the following code:

    local controls "household size religion numbermale"
    reg consumption income $controls
    I do not understand why this happens. Can anyone provide any insight? Thanks!


  • #2
    It seems likely to me that if you look closely at your regression output from
    Code:
    local controls "household size religion numbermale"
    reg consumption income $controls
    you will see that none of your control variables were included in the regression. That is because $controls is a global macro but you used the local command which created a local macro.

    Perhaps
    Code:
    global controls "household size religion numbermale"
    reg consumption income $controls
    will give you the same results as your initial regression.

    Comment


    • #3
      Or, even better, since global macros are an unsafe programming practice:

      Code:
      local controls householdsize religion numbermale
      reg consumption income `controls'
      By the way, your original code is inconsistent in that your first regression command has a single variable named householdsize, and your second approach has two separate variables, household and size. In #2 William Lisowski goes with two separate variables. In my code here, I'm going with a single variable. In any case, this is independent of the global vs local issue, whether it's two variables or one.

      Comment


      • #4
        Thank you both so much. That clears things up a lot (the household size thing was a typo. It should have said householdsize)!

        Comment

        Working...
        X