Announcement

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

  • Pseudo R2 for Poisson in Multiple Imputation

    Hi,

    I need to find the Pseudo R2 for a Poisson estimate that was run on a multiple imputed data. Is there a command for that?

    Here is the code I used to run the Poisson:

    Code:
    mi estimate, post: poisson dv iv1 iv2 iv3
    Thanks

  • #2
    see #6 in http://www.statalist.org/forums/foru...ng-mi-estimate
    this uses logistic but should be easy to modify for poisson

    Comment


    • #3
      Thank you very much Rich.

      Do you mind explaining the first and second lines in your code? I really appreciate it.
      I thought rhs are your IVs and hodc is your DV. I adjusted the code using my variables and replacing logistic with poisson but I received the following error:

      Code:
      option or not allowed with mi estimate: poisson

      I paste your original code here:

      Code:
      local rhs "armg2 armg3 tbsaburn20 tbsaburn21"
      noi mi estimate, or saving(miest, replace): logistic hodc `rhs', vce(cluster site)
      qui mi query
      local M=r(M)
      scalar r2=0
      scalar cstat=0
      qui mi xeq 1/`M': logistic hodc `rhs'; scalar r2=r2+e(r2_p); lroc, nog; scalar cstat=cstat+r(area)
      scalar r2=r2/`M'
      scalar cstat=cstat/`M'
      noi di "Pseudo R=squared over imputed data = " r2
      noi di "C statistic over imputed data = " cstat
      Last edited by Monica Muller; 25 Dec 2016, 20:45.

      Comment


      • #4
        the first line just sets up a local macro (to reduce the typing burden when I do this for several different models, e.g.) and the second uses that local to set the right-hand-side (or independent or predictor) variables; see
        Code:
        h macro
        and the associated manual entry (there is a link at the top of the help file

        Comment


        • #5
          Thanks! locals were not the problem. I got errors for saving() option. I dropped it and copied my Poisson estimation:

          Code:
          mi estimate, post: poisson DV `ivs'  `controls' , `options'
          Now, it works perfectly. I really appreciate your help. The code is super helpful.

          Comment


          • #6
            you're welcome

            Comment

            Working...
            X