Announcement

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

  • Outreg2: add Chi2 statistic for random-effects logit model

    Hi,

    I'm relatively new at using Stata and want to create some output tables for my Master's thesis using outreg2. I figured out a lot via googling and some guides on the internet, but there are two things I just cannot get done:

    1) I want outreg2 to include the Chi2-statistic from my xtlogit regression below the observations in the output table. I tried the option "addstat", but it didn't work.

    My command is: "outreg2 using test.doc, replace ctitle (xxx) label". Now I would like to add the Chi2-statistic also...

    2) I want to create a correlation table with pairwise correlations of all variables used. Additionally, the first two columns after the variable should show the standard deviation and the mean of the variable. I cannot find any information about creating correlation tables with outreg2...

    Can I do these things with outreg2?

    Thanks for your help!
    Florian


  • #2
    As for your first question:
    Code:
    webuse union, clear
    xtlogit union age grade i.not_smsa south year
    outreg2 using myfile, adds(Likelihood-ratio test of rho=0, e(chi2_c), Prob, `=chiprob(1, e(chi2_c))*0.5') replace
    seeout using "myfile.txt"

    Comment


    • #3
      Thank you for your fast reply!

      However, now I have the following output below my Observations and ID.

      But the values from the xtlogit were as follows:

      Wald chi2(1) = 2.31
      Log likelihood = -86.71818
      Prob > chi2 = 0.1286
      Attached Files

      Comment


      • #4
        Yes this is different test from below the table. If you want the Wald chi2 from above, then:
        Code:
        outreg2 using myfile, adds("Wald chi2 (`=e(df_m)') ", e(chi2), Prob > chi2,  e(p)) replace

        Comment


        • #5
          Wow, great! Thank you so much Oded!

          Comment


          • #6
            Hi again.

            Unfortunately, I realized that I have to use the Likelihood Ratio test for evaluating model fit instead of the Wald test. For my two panel models using xtlogit this works fine with above option:

            adds(Likelihood-ratio test of rho=0, e(chi2_c), Prob, `=chiprob(1, e(chi2_c))*0.5')

            However, I also have a non-panel model where I just use the logit function. The regression gives me the Likelihood Ratio test, but I cannot produce an output with outreg2 using above formula. Stata always tells me:

            . outreg2 using Acquisition_Integration_final.doc, label ctitle (Absorption) adds(Likelihood-ratio test of rho=0, e(chi2_c), Prob, `=chiprob(1, e(> chi2_c))*0.5')

            check eret list for the existence of e(chi2_c)
            invalid syntax
            r(198);


            Can someone please help me with the option for a LR test in the logit function?

            Thanks a lot!

            Comment


            • #7
              In this case the code in #2 would work just fine:
              Code:
              outreg2 using myfile, adds("LR chi2(`=e(df_m)') ", e(chi2), Prob > chi2, e(p)) replace
              You can access all these results that Stata save after estimation of models by the ereturn list command

              Comment


              • #8
                Thank you again, it works. Strange, because I used the code from #2 before and it didn't work... Always gives me back "Invalid syntax". But great, thanks!

                Comment


                • #9
                  Hi, I have same problem when I try to add Wald test of exogeneity: χ 2 to the bottom of my regression table

                  Code:
                  outreg2 [probit ivprobit iv2sls] using myfile.doc, label adds("Wald chi2 (`=e(df_m)') ", e(chi2), Prob > chi2) replace
                  I get "check eret list for the existence of e(chi2)" too

                  Comment


                  • #10
                    Hi,

                    I want to export certain coefficients from a matrix in your example #2. In that example, I want to retrieve and export rho statistic.

                    Code:
                      
                     webuse union, clear xtlogit union age grade i.not_smsa south year  mat t = r(table) outreg2 using myfile, adds(Likelihood-ratio test of rho=0, e(chi2_c), rho, t[1,10])) replace 


                    I am getting the following typo:

                    Code:
                    too few ')' or ']'
                    r(132);
                    Oded Mcdossi Could you kindly help?

                    Thank you

                    Comment


                    • #11
                      It is easier to use e(rho) instead,
                      Code:
                      outreg2 using myfile, adds(Likelihood-ratio test of rho=0, e(chi2_c), rho, e(rho)) replace
                      but if you want to go with the matrix way you need to refer to it directly
                      Code:
                      outreg2 using myfile, adds(Likelihood-ratio test of rho=0, e(chi2_c), rho, `=t[1,10]') replace

                      Comment


                      • #12
                        Thank you Oded Mcdossi for your kind help.

                        Comment

                        Working...
                        X