Announcement

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

  • Get outreg2 to report AIC in summary statistics

    Greetings,

    I am using outreg2 to create a table presenting multinomial logit results and would like to add the AIC to the summary statistics. In keeping with advice I picked up from an archived Statalist post (on the same question but for outreg - not outreg2)
    HTML Code:
    http://www.stata.com/statalist/archive/2013-03/msg00216.html
    and example 9 in the help for outreg2
    HTML Code:
    http://repec.org/bocode/o/outreg2
    I have used the following code but have tried to substitute the "addstat" option for the "addrows" option.

    Code:
    mlogit DepVar IndVar1 IndVar2, base(2) r
    est store DV1M1, title(Model 1)
    estat ic
    mat es_ic = r(S)
    local AIC: display %4.1f es_ic[1,5]
    outreg2 using Table_Dev_Pref.xls, dec(3) addstat(AIC, 'AIC') groupvar(IndVar1 IndVar2) replace

    Stata returns the error:
    unknown function ()
    r(133);

    How can I correct this code to get the AIC into my outreg2 table output? Alternatively, is there an easier or other way to get the AIC into my outreg2 table?

    Kind regards,
    Christiana

  • #2
    The left sign for the local macro should be ` left single quote and not apostrophe ' (it is above the Tab and below the Escape in the keyboard)
    Code:
    outreg2 using Table_Dev_Pref.xls, dec(3) groupvar(IndVar1 IndVar2) addstat(AIC, `AIC') replace

    Comment


    • #3
      Thank you Oded for your reply, I did not realize that these were different characters. My code works perfectly now.

      Christiana

      Comment


      • #4
        Hi!
        I have the same problem and I get the error "invalid syntax". Can anyone help, please?

        set more off
        ologit sfrem_Rec i.partnertype i.agerec YearsRel i.nochall_rec i.hafsex_rec if rsex==1, or


        est sto m1, title(Mode 1)
        estat ic
        mat es_ic = r(S)
        local AIC: display %4.1f es_ic[1,5]



        outreg2 using "/Users/alexandra/Desktop/writing exercise Year 1 Review/Tables/Sample 6308/Regression/mytables.doc", bdec(2) addstat(AIC, `AIC') eform nose nocons alpha(0.001, 0.01, 0.05) symbol(***, **, *) cttop (Emotional intimacy) replace ctitle (Model 1) label

        I am trying to get the Log Likelihood and AIC, but without success!!
        Alexandra

        Comment

        Working...
        X