Announcement

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

  • Regression maintaining variable constant

    Hello, how can i make a regression maintaining one variable constante? specifically i need to show the expected change in hours worked per week of the household head by an additional household member holding the age of the household head constant. Thank you so much

  • #2
    Lorena:
    if one of your predictors is=K it will be omitted from the output table, as reported in the following toy-example:
    Code:
    use "https://www.stata-press.com/data/r16/auto.dta"
    g mpg_k=mpg[1]
    regress price i.foreign mpg_k
    . regress price i.foreign mpg_k
    note: mpg_k omitted because of collinearity
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =      0.17
           Model |  1507382.66         1  1507382.66   Prob > F        =    0.6802
        Residual |   633558013        72  8799416.85   R-squared       =    0.0024
    -------------+----------------------------------   Adj R-squared   =   -0.0115
           Total |   635065396        73  8699525.97   Root MSE        =    2966.4
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |
        Foreign  |   312.2587   754.4488     0.41   0.680    -1191.708    1816.225
           mpg_k |          0  (omitted)
           _cons |   6072.423    411.363    14.76   0.000     5252.386     6892.46
    ------------------------------------------------------------------------------
    
    .
    Therefore, the results of your OLS will be the same as the ones obtained without the predictor=K:
    Code:
    . regress price i.foreign
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(1, 72)        =      0.17
           Model |  1507382.66         1  1507382.66   Prob > F        =    0.6802
        Residual |   633558013        72  8799416.85   R-squared       =    0.0024
    -------------+----------------------------------   Adj R-squared   =   -0.0115
           Total |   635065396        73  8699525.97   Root MSE        =    2966.4
    
    ------------------------------------------------------------------------------
           price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         foreign |
        Foreign  |   312.2587   754.4488     0.41   0.680    -1191.708    1816.225
           _cons |   6072.423    411.363    14.76   0.000     5252.386     6892.46
    ------------------------------------------------------------------------------
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Cross-posted at https://www.reddit.com/r/stata/comme...able_constant/

      Please note our cross-posting policy, which is that you should tell us about it. https://www.statalist.org/forums/help#crossposting

      I read the question differently from Carlo Lazzaro. It's not about how to do the regression; it's a matter of reaching for margins and marginsplot afterwards.
      Last edited by Nick Cox; 19 Jun 2021, 04:03.

      Comment


      • #4
        Nick is correct.
        I was probably off-target (or partially so ).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you Nick! I didnt know about that rule, thanks!

          Comment


          • #6
            Thank you Carlo, you helped me!

            Comment


            • #7
              Based on my teaching, I took this to be more of a basic question about multiple regression. It's important to know that multiple regression, in effect, allows you to do the thought experiment of holding one variable fixed while changing another. Of course, that can't be true in the data set. But the estimated equation allows us to do this. So, if you use

              [CODE]reg hhheadhours hhmembers hhage, vce(robust)/CODE]

              then the coefficient on hhmembers has the ceteris paribus interpretation you're looking for. So if its coefficient is 4.3 then, holding hhage fixed, another household member increases the hours worked by the head by 4.3 hours, on average. The regression does that for you. If you run the simple regression

              Code:
              reg hhheadhours hhmembers, vce(robust)
              then you are not "controlling for" or "holding fixed" hhage. If you want a fancier model, you can interact hhmembers and hhage and then use the margins command and marginsplot, as suggested by Nick.

              Comment

              Working...
              X