Announcement

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

  • Problem with Pseudo R squared. ".z" displayed. What is it?

    Hello!

    I am working on a binomial logistic regression with around 1.6mln observations (panel data). I use xtlogit with fixed effects. Independent variables are both dummy and numerical variables. When I use asdoc function, pseudo R squared is displayed as ".z" (with esttab function pseudo R squared is displayed as blank). There is no pseudo R squared shown among estimation results in STATA. Did you have anything like that in your analysis? How can I solve this issue?

    Kind regards,
    Firangiz Aghayeva

  • #2
    This is a problem with the comunity-contributed asdoc. Attaullah Shah, the author of asdoc, might be able to explain.

    Comment


    • #3
      .z is a missing value. -xtlogit, fe- allegedly calculates Pseudo R-quared and saves it in e(r2 p).

      Check what you have after your estimation, by say typing
      -ereturn list- and seeing what is in e(r2 p),
      or typing -display e(r2 p)- and seeing what is being displayed.

      Comment


      • #4
        In case it's not apparent, something erased underscore characters in Joro's post - running
        Code:
        display e(r2_p)
        after xtlogit, fe will confirm that a Pseudo R-squared was calculated, as documented in help xtlogit. The fact that it's not displayed in the output of xtlogit can be misleading.

        Comment


        • #5
          Thank you for your answers. I tried "display e(r2_p)", but nothing is displayed. "ereturn list" also doesn't display pseudo R squared. What could it mean? Does it mean my model is not correct?

          Comment


          • #6
            I don't know anything about esttab, but -xtlogit- with FE does have a pseudo-r2; please show us, as requested by the FAQ, exactly what you typed and exactly what Stata (not esttab) gave back to you

            Comment


            • #7
              As Rich said show exactly what you typed at Stata, and exactly what Stata returned, where you type:

              Code:
              xtlogit y x, fe
              
              ereturn list

              Comment


              • #8
                Dear Rich Goldstein and @Joro Kolev,
                Please, see below the STATA output of what I typed and what STATA returned:

                5 . set sortseed 123


                6 . xtset LP_ID

                Panel variable: LP_ID (unbalanced)

                7 . xtlogit Dummy_invested_or_not Dummy_LP_Fund_PRI Dummy_fund_PRI Dummy_LP_PRI Prior_relationship Dummy_home_bias log_fund_sequence_number i.Fund_region_num i.Fund_industry_num i.Fund_vintage, vce(cluster LP_region)

                Fitting comparison model:

                Iteration 0: log pseudolikelihood = -48013.658
                Iteration 1: log pseudolikelihood = -46895.703
                Iteration 2: log pseudolikelihood = -38906.955
                Iteration 3: log pseudolikelihood = -38403.311
                Iteration 4: log pseudolikelihood = -37171.3
                Iteration 5: log pseudolikelihood = -37166.422
                Iteration 6: log pseudolikelihood = -37166.421

                Fitting full model:

                tau = 0.0 log pseudolikelihood = -37166.421
                tau = 0.1 log pseudolikelihood = -36371.442
                tau = 0.2 log pseudolikelihood = -36279.049
                tau = 0.3 log pseudolikelihood = -36281.203

                Iteration 0: log pseudolikelihood = -36278.278
                Iteration 1: log pseudolikelihood = -36124.382
                Iteration 2: log pseudolikelihood = -36119.408
                Iteration 3: log pseudolikelihood = -36119.393
                Iteration 4: log pseudolikelihood = -36119.393

                Calculating robust standard errors ...

                Random-effects logistic regression Number of obs = 1,595,341
                Group variable: LP_ID Number of groups = 2,057

                Random effects u_i ~ Gaussian Obs per group:
                min = 116
                avg = 775.6
                max = 3,622

                Integration method: mvaghermite Integration pts. = 12

                Wald chi2(7) = .
                Log pseudolikelihood = -36119.393 Prob > chi2 = .

                (Std. err. adjusted for 8 clusters in LP_region)
                ------------------------------------------------------------------------------------------
                | Robust
                Dummy_invested_or_not | Coefficient std. err. z P>|z| [95% conf. interval]
                -------------------------+----------------------------------------------------------------
                Dummy_LP_Fund_PRI | .360916 .1494298 2.42 0.016 .068039 .653793
                Dummy_fund_PRI | -.5526997 .1271336 -4.35 0.000 -.8018771 -.3035224
                Dummy_LP_PRI | -.0267808 .179703 -0.15 0.882 -.3789922 .3254306
                Prior_relationship | 4.484332 .2249435 19.94 0.000 4.04345 4.925213
                Dummy_home_bias | .6723201 .1494194 4.50 0.000 .3794633 .9651768
                log_fund_sequence_number | .3110024 .6432726 0.48 0.629 -.9497888 1.571794
                |
                Fund_region_num |
                2 | .0399756 .3970461 0.10 0.920 -.7382205 .8181717
                3 | -.0123732 .4394583 -0.03 0.978 -.8736956 .8489493
                4 | -.1256316 .4559336 -0.28 0.783 -1.019245 .7679819
                5 | -.0019979 .2965385 -0.01 0.995 -.5832027 .5792068
                |
                Fund_industry_num |
                2 | -.3614807 .1697753 -2.13 0.033 -.6942341 -.0287272
                3 | -.5969741 .4020793 -1.48 0.138 -1.385035 .191087
                4 | -.3183784 .1922162 -1.66 0.098 -.6951151 .0583584
                5 | -.5843853 .2238303 -2.61 0.009 -1.023085 -.1456859
                6 | -.525885 .1175568 -4.47 0.000 -.756292 -.295478
                7 | -.3058262 .2969135 -1.03 0.303 -.887766 .2761136
                8 | -.5488518 .1062835 -5.16 0.000 -.7571637 -.3405399
                9 | -.7461087 .5087303 -1.47 0.142 -1.743202 .2509843
                10 | -.9997778 .6044649 -1.65 0.098 -2.184507 .1849517
                11 | -.409583 .1349732 -3.03 0.002 -.6741257 -.1450403
                |
                Fund_vintage |
                2007 | -.0140132 .0363593 -0.39 0.700 -.0852761 .0572497
                2008 | -.0192336 .0848916 -0.23 0.821 -.1856181 .147151
                2009 | .0912352 .1614439 0.57 0.572 -.2251891 .4076595
                2010 | -.0553971 .2067173 -0.27 0.789 -.4605555 .3497613
                2011 | -.2150118 .1255786 -1.71 0.087 -.4611413 .0311178
                2012 | -.1713196 .1268857 -1.35 0.177 -.4200109 .0773718
                2013 | -.2094859 .2032533 -1.03 0.303 -.6078551 .1888832
                2014 | -.3440877 .2471677 -1.39 0.164 -.8285276 .1403522
                2015 | -.6053826 .185353 -3.27 0.001 -.9686678 -.2420973
                2016 | -.6692628 .1882094 -3.56 0.000 -1.038146 -.300379
                2017 | -.4904899 .1533822 -3.20 0.001 -.7911134 -.1898664
                2018 | -.511232 .1757973 -2.91 0.004 -.8557883 -.1666756
                2019 | -.5290861 .2060593 -2.57 0.010 -.9329549 -.1252173
                2020 | -.52424 .2321195 -2.26 0.024 -.9791859 -.0692942
                2021 | -.5818161 .2709813 -2.15 0.032 -1.11293 -.0507026
                |
                _cons | -5.595157 .2272539 -24.62 0.000 -6.040567 -5.149748
                -------------------------+----------------------------------------------------------------
                /lnsig2u | -.6099625 .7153801 -2.012082 .7921568
                -------------------------+----------------------------------------------------------------
                sigma_u | .7371372 .2636666 .3656638 1.485986
                rho | .1417525 .0870322 .0390556 .4016269
                ------------------------------------------------------------------------------------------



                8 . display e(r2_p)
                .

                9 . ereturn list

                scalars:
                e(df_m) = 7
                e(chi2) = .
                e(p) = .
                e(N_clust) = 8
                e(ll_c) = -37166.42075489485
                e(chi2_c) = 2094.055561565459
                e(sigma_u) = .7371371966902871
                e(rho) = .1417524951655696
                e(k_aux) = 1
                e(g_avg) = 775.5668449197861
                e(g_min) = 116
                e(N_g) = 2057
                e(n_quad) = 12
                e(k_eq_model) = 1
                e(ll) = -36119.39297411212
                e(rc) = 0
                e(converged) = 1
                e(k_dv) = 1
                e(k_eq) = 2
                e(k) = 40
                e(ic) = 4
                e(N) = 1595341
                e(rank) = 37
                e(g_max) = 3622

                macros:
                e(cmdline) : "xtlogit Dummy_invested_or_not Dummy_LP_Fund_PRI Dummy_fund_PRI Dummy.."
                e(cmd) : "xtlogit"
                e(marginsdefault) : "predict(pr)"
                e(predict) : "xtlogit_re_p"
                e(model) : "re"
                e(clustvar) : "LP_region"
                e(ivar) : "LP_ID"
                e(chi2_ct) : "LR"
                e(chi2type) : "Wald"
                e(vcetype) : "Robust"
                e(vce) : "robust"
                e(depvar) : "Dummy_invested_or_not"
                e(title) : "Random-effects logistic regression"
                e(distrib) : "Gaussian"
                e(intmethod) : "mvaghermite"
                e(opt) : "moptimize"
                e(user) : "xtlogit_d2"
                e(ml_method) : "d2"
                e(technique) : "nr"
                e(which) : "max"
                e(properties) : "b V"

                matrices:
                e(b) : 1 x 40
                e(V) : 40 x 40
                e(Cns) : 3 x 41
                e(V_modelbased) : 40 x 40
                e(ilog) : 1 x 20
                e(gradient) : 1 x 40

                functions:
                e(sample)

                Comment


                • #9
                  In post #1 you tell us you fit xtlogit with fixed effects. In post #8 we see that the xtlogit command did not include the fe option, so in fact Stata tells you that it fit the default random effects model in the output you displayed
                  Calculating robust standard errors ...

                  Random-effects logistic regression Number of obs = 1,595,341
                  Group variable: LP_ID Number of groups = 2,057

                  Random effects u_i ~ Gaussian Obs per group:
                  min = 116
                  avg = 775.6
                  max = 3,622
                  You need to reread the documentation for xtlogit to understand the meaning of a fixed effects model in the panel data setting.
                  Last edited by William Lisowski; 23 Jul 2022, 11:13.

                  Comment


                  • #10
                    In addition to William Lisowski 's comment, with which I fully agree, please read the FAQ and learn how to post things so they are more easily legible

                    Comment


                    • #11
                      Thank you for your valuable comments. I corrected my model and got pseudo R squared properly displayed. Now I use clogit, because I need to cluster robust standard errors. In xtlogit, fe function vce options allow only oim, bootstrap and jackknife.

                      Comment


                      • #12
                        Excellent ! We probably also learnt something new today, apparently the -xtlogit, re- does not display a pseudo R-squared...

                        Comment

                        Working...
                        X