Announcement

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

  • linear regression interpretation/categorial reference value

    Dear all,
    I have a question about the interpretation in STATA of the p values following the change of a reference category of a predictor.
    I am studying the effect ("eff") of a treatment ("R") correcting for baseline ("bmpre", which can be 2,3,4 or 5), age ("AGE") and other covariates.

    I inserted a baseline * age interaction factor into the model.
    When I change the baseline reference category ("bmpre") from 2 to 5, the significance of the main effect of AGE changes.

    How do you explain this?
    Thank you all in advance.
    PS: it's the first time I pubish a STATA output. I'm sorry if it won't be displayed in the best way.

    . regress effpos ib1.R i.SEX c.AGE##i.bmpre i.dia

    Source | SS df MS Number of obs = 114
    -------------+---------------------------------- F(11, 102) = 14.46
    Model | 106.194343 11 9.65403121 Prob > F = 0.0000
    Residual | 68.0951304 102 .667599318 R-squared = 0.6093
    -------------+---------------------------------- Adj R-squared = 0.5672
    Total | 174.289474 113 1.54238472 Root MSE = .81707

    ------------------------------------------------------------------------------
    effpos | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    0.R | .198729 .1944451 1.02 0.309 -.1869519 .5844099
    1.SEX | -.1762637 .1651324 -1.07 0.288 -.5038029 .1512756
    AGE | .0162547 .0436516 0.37 0.710 -.070328 .1028373
    |
    bmpre |
    3 | .5395969 .4952407 1.09 0.278 -.4427107 1.521905
    4 | .4252566 .9612166 0.44 0.659 -1.481312 2.331825
    5 | 3.562841 .6331566 5.63 0.000 2.306978 4.818704
    |
    bmpre#c.AGE |
    3 | -.0113402 .0458618 -0.25 0.805 -.1023069 .0796265
    4 | .1434036 .149467 0.96 0.340 -.1530636 .4398708
    5 | -.1795416 .0760778 -2.36 0.020 -.3304415 -.0286417
    |
    dia |
    2 | -.2800586 .1732919 -1.62 0.109 -.6237822 .063665
    3 | -.0587995 .2552767 -0.23 0.818 -.5651396 .4475407
    |
    _cons | .8820809 .4806346 1.84 0.069 -.0712556 1.835417
    ------------------------------------------------------------------------------

    If I change the reference category of bmpre...

    . regress effpos ib1.R i.SEX c.AGE##ib5.bmpre i.dia

    Source | SS df MS Number of obs = 114
    -------------+---------------------------------- F(11, 102) = 14.46
    Model | 106.194343 11 9.65403121 Prob > F = 0.0000
    Residual | 68.0951304 102 .667599318 R-squared = 0.6093
    -------------+---------------------------------- Adj R-squared = 0.5672
    Total | 174.289474 113 1.54238472 Root MSE = .81707

    ------------------------------------------------------------------------------
    effpos | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    0.R | .198729 .1944451 1.02 0.309 -.1869519 .5844099
    1.SEX | -.1762637 .1651324 -1.07 0.288 -.5038029 .1512756
    AGE | -.1632869 .0629266 -2.59 0.011 -.2881015 -.0384724
    |
    bmpre |
    2 | -3.562841 .6331566 -5.63 0.000 -4.818704 -2.306978
    3 | -3.023244 .4799725 -6.30 0.000 -3.975268 -2.071221
    4 | -3.137585 .9266609 -3.39 0.001 -4.975612 -1.299557
    |
    bmpre#c.AGE |
    2 | .1795416 .0760778 2.36 0.020 .0286417 .3304415
    3 | .1682014 .0645784 2.60 0.011 .0401105 .2962924
    4 | .3229452 .1563563 2.07 0.041 .0128133 .6330771
    |
    dia |
    2 | -.2800586 .1732919 -1.62 0.109 -.6237822 .063665
    3 | -.0587995 .2552767 -0.23 0.818 -.5651396 .4475407
    |
    _cons | 4.444922 .4855814 9.15 0.000 3.481774 5.408071
    ------------------------------------------------------------------------------



    Last edited by Gianfranco Di Gennaro; 22 Dec 2021, 23:49.

  • #2
    Gianfranco:
    in your first code, the coefficient for -AGE- when -bmpre-==2 is reported;

    in your first code, the coefficient for -AGE- when -bmpre-==5 is reported.

    As what above is actually stating the obvious, a toy-example may be more helpful:
    Code:
    use "C:\Program Files\Stata17\ado\base\a\auto.dta"
    . regress price i.foreign##i.rep78, allbase
    note: 1.foreign#1b.rep78 identifies no observations in the sample.
    note: 1.foreign#2.rep78 identifies no observations in the sample.
    note: 1.foreign#5.rep78 omitted because of collinearity.
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(7, 61)        =      0.39
           Model |    24684607         7  3526372.43   Prob > F        =    0.9049
        Residual |   552112352        61  9051022.16   R-squared       =    0.0428
    -------------+----------------------------------   Adj R-squared   =   -0.0670
           Total |   576796959        68  8482308.22   Root MSE        =    3008.5
    
    -------------------------------------------------------------------------------
            price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
          foreign |
        Domestic  |          0  (base)
         Foreign  |   2088.167   2351.846     0.89   0.378     -2614.64    6790.974
                  |
            rep78 |
               1  |          0  (base)
               2  |   1403.125   2378.422     0.59   0.557    -3352.823    6159.073
               3  |   2042.574   2204.707     0.93   0.358    -2366.011    6451.159
               4  |   1317.056   2351.846     0.56   0.578    -3385.751    6019.863
               5  |       -360   3008.492    -0.12   0.905    -6375.851    5655.851
                  |
    foreign#rep78 |
      Domestic#1  |          0  (base)
      Domestic#2  |          0  (base)
      Domestic#3  |          0  (base)
      Domestic#4  |          0  (base)
      Domestic#5  |          0  (base)
       Foreign#1  |          0  (empty)
       Foreign#2  |          0  (empty)
       Foreign#3  |  -3866.574   2980.505    -1.30   0.199    -9826.462    2093.314
       Foreign#4  |  -1708.278   2746.365    -0.62   0.536    -7199.973    3783.418
       Foreign#5  |          0  (omitted)
                  |
            _cons |     4564.5   2127.325     2.15   0.036      310.651    8818.349
    -------------------------------------------------------------------------------
    
    . regress price i.foreign##ib3.rep78, allbase
    note: 1.foreign#1.rep78 identifies no observations in the sample.
    note: 1.foreign#2.rep78 identifies no observations in the sample.
    
          Source |       SS           df       MS      Number of obs   =        69
    -------------+----------------------------------   F(7, 61)        =      0.39
           Model |    24684607         7  3526372.43   Prob > F        =    0.9049
        Residual |   552112352        61  9051022.16   R-squared       =    0.0428
    -------------+----------------------------------   Adj R-squared   =   -0.0670
           Total |   576796959        68  8482308.22   Root MSE        =    3008.5
    
    -------------------------------------------------------------------------------
            price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
          foreign |
        Domestic  |          0  (base)
         Foreign  |  -1778.407    1830.91    -0.97   0.335    -5439.538    1882.723
                  |
            rep78 |
               1  |  -2042.574   2204.707    -0.93   0.358    -6451.159    2366.011
               2  |  -639.4491   1211.033    -0.53   0.599    -3061.059    1782.161
               3  |          0  (base)
               4  |  -725.5185   1157.969    -0.63   0.533    -3041.021    1589.984
               5  |  -2402.574   2204.707    -1.09   0.280    -6811.159    2006.011
                  |
    foreign#rep78 |
      Domestic#1  |          0  (base)
      Domestic#2  |          0  (base)
      Domestic#3  |          0  (base)
      Domestic#4  |          0  (base)
      Domestic#5  |          0  (base)
       Foreign#1  |          0  (empty)
       Foreign#2  |          0  (empty)
       Foreign#3  |          0  (base)
       Foreign#4  |   2158.296   2315.938     0.93   0.355    -2472.708      6789.3
       Foreign#5  |   3866.574   2980.505     1.30   0.199    -2093.314    9826.462
                  |
            _cons |   6607.074   578.9845    11.41   0.000     5449.323    7764.825
    -------------------------------------------------------------------------------
    
    .
    As an aside, whenever I'm not sure about what going on with my coefficients, I impose -allbaselevels- option.
    -
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment

    Working...
    X