Announcement

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

  • Exporting IRR table

    Hello guys,
    I have a question related to exporting IRR table. The problem I have is that when I export the table, I don't get the same result as in the result table I got the Coef. . I am struggling to articulate my outreg2 command properly.

    I used this code:

    [outreg2 using P_2016.doc, replace ctitle (Model 1)]

  • #2
    Your question really isn't clear without more detail, or at a minimum it is too difficult to guess at a good answer from what you have shared. Please help us help you. Show example data. Show the code you ran to produce the output you are trying to export, and show us the output from the program and perhaps the . Tell us what precisely is wrong. The Statalist FAQ provides advice on effectively posing your questions, posting data, and sharing Stata output.

    The more you help others understand your problem, the more likely others are to be willing and able to help you solve your problem.

    With that said, I looked back at your previous topics here to try to figure out what you are attempting. A search for IRR suggests to me that you are perhaps using the poisson command, which is consistent with some of your earlier topics.

    If so, perhaps you used the irr option on your poisson command, which is described in the help poisson output as follows:
    Code:
        irr reports estimated coefficients transformed to incidence-rate ratios, that is, exp(b)
            rather than b.  Standard errors and confidence intervals are similarly transformed.
            This option affects how results are displayed, not how they are estimated or stored.
            irr may be specified at estimation or when replaying previously estimated results.
    And if that is what you did, note what I highlighted in red above. It suggest that outreg2 will need to make a similar transformation to present the stored coefficient estimates as IRR rather than as they are stored.

    So we turn to the output of help outreg2 and in the Viewer window we search that output for "irr" and find
    Code:
        eform specifies coefficients to be reported. This corresponds to or option for logit, clogit, and glogit
            estimation, irr for poisson estimation, rrr for mlogit, hr for cox and stcox hazard models, and eform for
            xtgee. The default form of stcox is the hazard rate form; use the eform to report it.
    This suggests you need the eform option on your outreg2 command.
    Last edited by William Lisowski; 22 Oct 2022, 18:23.

    Comment


    • #3
      As you can see in the doc file, IRR is precisely the same as Coef when I used this code.

      [outreg2 using P_2016.doc, replace ctitle (Model 1)]



      Click image for larger version

Name:	Coef._IRR.jpg
Views:	1
Size:	67.0 KB
ID:	1686444
      Click image for larger version

Name:	STATA IRR.jpg
Views:	1
Size:	55.9 KB
ID:	1686445

      Comment


      • #4
        This code reproduces the problem you describe, using the example from the output of help poisson, so that anyone who wants to help can easily reproduce your problem on their system.
        Code:
        webuse dollhill3
        poisson deaths smokes i.agecat, exposure(pyears)
        outreg2  using "~/Downloads/poisson", replace
        poisson deaths smokes i.agecat, exposure(pyears) irr
        outreg2  using "~/Downloads/poisson", word
        Click image for larger version

Name:	poisson1.png
Views:	1
Size:	149.2 KB
ID:	1686454
        This code corrects the problem following the advice given earlier in post #2 above:
        This suggests you need the eform option on your outreg2 command.
        Code:
        webuse dollhill3
        poisson deaths smokes i.agecat, exposure(pyears)
        outreg2  using "~/Downloads/poisson", replace
        poisson deaths smokes i.agecat, exposure(pyears) irr
        outreg2  using "~/Downloads/poisson", word eform
        Click image for larger version

Name:	poisson2.png
Views:	1
Size:	174.3 KB
ID:	1686455

        Comment


        • #5
          Thank you
          you gave me the keyword
          The code works.

          outreg2 using mymod.doc, append ctitle(IRR) eform

          Comment

          Working...
          X