Announcement

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

  • Margins unclustered at individual level despite panel data (xtlogit)

    Dear Statalist,

    Thank you very much for all your previous help regarding my project.

    I have panel data regarding individuals' (n=230) performance over 4 rounds - it's an experiment, so 920 observations.

    I have used
    Code:
     xtlogit reb_sa i.reb_ak i.reb_ua i.reb_g i.round i.risk i.T_C i.reby_n c.PPD_sa##c.r_sa, vce(cluster CASE) or nolog
    
    Calculating robust standard errors ...
    
    Random-effects logistic regression                   Number of obs    =    920
    Group variable: CASE                                 Number of groups =    230
    
    Random effects u_i ~ Gaussian                        Obs per group:
                                                                      min =      4
                                                                      avg =    4.0
                                                                      max =      4
    
    Integration method: mvaghermite                      Integration pts. =     12
    
                                                         Wald chi2(14)    = 156.01
    Log pseudolikelihood = -331.51916                    Prob > chi2      = 0.0000
    
                                        (Std. err. adjusted for 230 clusters in CASE)
    ---------------------------------------------------------------------------------
                    |               Robust
             reb_sa | Odds ratio   std. err.      z    P>|z|     [95% conf. interval]
    ----------------+----------------------------------------------------------------
           1.reb_ak |   8.402469   2.551766     7.01   0.000     4.633439    15.23738
           1.reb_ua |   3.879268   1.141404     4.61   0.000      2.17921    6.905584
            1.reb_g |   2.941542   .8846838     3.59   0.000     1.631442    5.303692
                    |
              round |
                 2  |   2.701071   .8781532     3.06   0.002     1.428234    5.108256
                 3  |   1.126661   .3371901     0.40   0.690     .6266768    2.025551
                 4  |   2.132915   .6343999     2.55   0.011     1.190687    3.820755
                    |
               risk |
                 2  |   1.173569   .3310536     0.57   0.570     .6751374    2.039977
                 3  |   4.309221   1.364784     4.61   0.000     2.316395    8.016504
                 4  |   4.707272    1.72959     4.22   0.000     2.290935    9.672211
                    |
                T_C |
                TG  |   .6641125   .1871551    -1.45   0.146     .3822632    1.153774
           1.reby_n |   1.090605   .2859005     0.33   0.741     .6524181    1.823092
             PPD_sa |   1.266439   .0691242     4.33   0.000     1.137954    1.409432
               r_sa |   1.04e+09   2.23e+10     0.97   0.332     6.42e-10    1.69e+27
                    |
    c.PPD_sa#c.r_sa |   1.32e-06   8.41e-06    -2.12   0.034     4.77e-12    .3629207
                    |
              _cons |   .1143815   .0573874    -4.32   0.000      .042785    .3057879
    ----------------+----------------------------------------------------------------
           /lnsig2u |   .1390501    .387292                     -.6200282    .8981284
    ----------------+----------------------------------------------------------------
            sigma_u |   1.071999   .2075883                      .7334366    1.566845
                rho |   .2588801   .0743063                      .1405323    .4273383
    ---------------------------------------------------------------------------------
    Note: Estimates are transformed only in the first equation to odds ratios.
    Note: _cons estimates baseline odds (conditional on zero random effects).
    and obtained some nice results.

    Now I wanted to use margins:

    Code:
     margins,dydx(*)
    
    Average marginal effects                                   Number of obs = 920
    Model VCE: Robust
    
    Expression: Pr(reb_sa=1), predict(pr)
    dy/dx wrt:  1.reb_ak 1.reb_ua 1.reb_g 2.round 3.round 4.round 2.risk 3.risk 4.risk 1.T_C 1.reby_n PPD_sa r_sa
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
        1.reb_ak |   .2518499   .0379563     6.64   0.000     .1774569     .326243
        1.reb_ua |   .1543498   .0368114     4.19   0.000     .0822008    .2264988
         1.reb_g |   .1169143     .03533     3.31   0.001     .0476688    .1861599
                 |
           round |
              2  |   .0969979   .0304955     3.18   0.001     .0372278     .156768
              3  |   .0127513   .0319273     0.40   0.690    -.0498251    .0753278
              4  |   .0759196   .0297198     2.55   0.011     .0176698    .1341693
                 |
            risk |
              2  |   .0184477   .0323549     0.57   0.569    -.0449667     .081862
              3  |   .1474136   .0288938     5.10   0.000     .0907828    .2040445
              4  |   .1547088   .0334769     4.62   0.000     .0890953    .2203223
                 |
             T_C |
             TG  |  -.0406796   .0279514    -1.46   0.146    -.0954633    .0141041
        1.reby_n |   .0085604   .0259302     0.33   0.741    -.0422617    .0593826
          PPD_sa |   .0179221   .0045255     3.96   0.000     .0090524    .0267919
            r_sa |   3.732591   1.870042     2.00   0.046     .0673752    7.397806
    ------------------------------------------------------------------------------
    Note: dy/dx for factor levels is the discrete change from the base level.
    but have realised that the number of observations is 920, without any groups.

    I have used the margins command right after xtlogit.

    Code:
     margins,dydx(*) vce(cluster CASE)
    did not work even though the instructions (https://www.stata.com/manuals/rmargins.pdf) say that vce is an option.

    I would be most grateful if anyone could comment on the soundness of my margins command (especially regarding the standard errors) and whether these results can be trusted.

    Thank you very much in advance!

    Kind regards,
    Mary

    I am using Stata 17 SE.

  • #2
    vce(unconditional)? may not work after xt.

    Comment

    Working...
    X