Announcement

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

  • Covariates not included in margins

    Hello all,

    I'm trying to run a linear probability model with fixed effects, but I'm encountering some issues when I then try to view the predicted probabilities using 'margins'. As I understand it, margins should be based on the previous regression, and it should thus automatically include all the covariates used in that previous regression. When I run the FE regression with all covariates, and then run 'margins' afterwards, however, the predicted probabilities I am given correspond to the predicted probabilities of not having included any covariates.

    I don't understand, why the predicted probabilities from margins don't fit the output I get from xtreg. I'm crossing my fingers that someone can enlighten me.

    Thank you!

    Code:
    . xtreg purge_bi l1.i.gsdb_onset l1.(tpop_log v2x_polyarchy oil_agg latent_gdppc_mean_log), fe
    >  cluster(country)
    
    Fixed-effects (within) regression               Number of obs     =      6,238
    Group variable: country                         Number of groups  =        165
    
    R-sq:                                           Obs per group:
         within  = 0.0171                                         min =          4
         between = 0.3158                                         avg =       37.8
         overall = 0.0668                                         max =         44
    
                                                    F(5,164)          =      10.34
    corr(u_i, Xb)  = -0.1594                        Prob > F          =     0.0000
    
                                           (Std. Err. adjusted for 165 clusters in country)
    ---------------------------------------------------------------------------------------
                          |               Robust
                 purge_bi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    ----------------------+----------------------------------------------------------------
             L.gsdb_onset |
                       1  |   .0100682   .0303597     0.33   0.741    -.0498781    .0700145
                          |
                 tpop_log |
                      L1. |   .0447499   .0212925     2.10   0.037     .0027071    .0867927
                          |
            v2x_polyarchy |
                      L1. |   -.309333   .0463764    -6.67   0.000    -.4009047   -.2177613
                          |
                  oil_agg |
                      L1. |   .0002319    .001239     0.19   0.852    -.0022146    .0026783
                          |
    latent_gdppc_mean_log |
                      L1. |   .0032022   .0160167     0.20   0.842    -.0284232    .0348276
                          |
                    _cons |   -.155505   .1794069    -0.87   0.387    -.5097502    .1987402
    ----------------------+----------------------------------------------------------------
                  sigma_u |  .11790411
                  sigma_e |  .31110025
                      rho |  .12559436   (fraction of variance due to u_i)
    ---------------------------------------------------------------------------------------
    
    . margins l1.gsdb_onset
    
    Predictive margins                              Number of obs     =      6,238
    Model VCE    : Robust
    
    Expression   : Linear prediction, predict()
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    L.gsdb_onset |
              0  |   .1323669   .0011097   119.29   0.000      .130192    .1345417
              1  |   .1424351     .02925     4.87   0.000      .085106    .1997641
    ------------------------------------------------------------------------------

  • #2
    Oliver:
    welcome to this forum.
    See Example 1: A simple case after regress, -margins- entry, Stata .pdf manual.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      You got what you asked for.

      As Carlo suggests, I'd spend some time learning about margins. The commands are often easy to specify, but many complex things can be done. Margins is very useful so it's worth some investment.

      Some good videos on youtube that show you how to do some things.

      The pull down menus might be helpful.

      Comment

      Working...
      X