Announcement

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

  • AIC in a table with outreg2

    Hello, I found this old response in relation to getting AIC or BIC in a table using outreg2. Following response below, I wrote this code, but I got this message "command addrows is unrecognized"
    I thought it could be because a typo error replacing "`AIC'" by "'AIC'", but I got the same problem.
    Or is it because I'm using outreg2 instead of outreg?
    Could you please help me? Thanks!

    xtmixed WMvocab evedagec|| idcoleg1:, cov(unstruc) ||idchild: evedagec, mle cov(unstruc) var
    xtmrho
    estat ic
    mat es_ic = r(S)
    local AIC : display %4.1f es_ic[1,5]
    outreg2 using C:\xx.doc, addstat ("ICC L1", e(rho1), "ICC L2", e(rho2), "-2LL", e(ll), "df",e(df_m))
    addrows("AIC", "`AIC'") bdec(3) alpha(.001, .01, .05, .10) symbol(***, **, *, ~) replace long

    From John Luke Gallup <[email protected]>
    To [email protected]
    Subject Re: st: outreg- including Heckman estimation results
    Date Tue, 5 Mar 2013 19:46:30 -0800


    Suryadipta, You are correct that you can include the AIC or BIC statistics using the -addrows- option of -outreg-. The reason your code below doesn't work is that the AIC statistic is not stored in e(AIC) by -estat ic-. Instead, it is stored (rather awkwardly) in the matrix r(S). If the AIC statistic were stored in e(AIC), you could have included it to your -summstat- option. You cannot access individual elements of r() matrices, so it is necessary to copy r(S) into a regular Stata matrix. From there I put the AIC statistic in the local variable "AIC". The "display" in -local AIC : display ...- applies a 1 decimal place format on the value of AIC. The code below does the job: tobit depvar `controls' , ll(0) estat ic mat es_ic = r(S) local AIC : display %4.1f es_ic[1,5] outreg, summstat(N \ r2_p \ ll ) /// summtitle(# of observations \ Pseudo R-squared \ log-likelihood ) /// addrows("AIC", "`AIC'") You could access the BIC statistic with the following command: local BIC : display %4.1f es_ic[1,6] John On Mar 5, 2013, at 10:15 AM, Suryadipta Roy <[email protected]> wrote: > I had a related query as to whether it is possible to obtain the AIC/ > BIC test statistics using the -addrows- option after -outreg- . For > example, I have been running the following commands but have not been > able to obtain the AIC or the BIC result on the table. I would very > much appreciate some help to get this right. > > tobit depvar `controls' , ll(0) > estat ic > outreg, summstat(N \ r2_p \ ll ) summtitle(# of observations \ Pseudo > R-squared \ log-likelihood ) addrows("AIC", "`e(AIC)'") merge > > Any help is greatly appreciated. > > Sincerely, > Suryadipta.

  • #2
    Welcome to the Stata Forum / Statalist.

    Surely, - the user-written outreg is different from the user-written outreg2.

    To get the AIC, I recommend you take a look at this message.
    Best regards,

    Marcos

    Comment


    • #3
      Marcos is quite right. outreg and outreg2 are quite different programs. See (e.g.) my summary at #8 of

      https://www.statalist.org/forums/for...gramming-names

      In broad terms, both are popular downloads, but neither program author is active here. Also, none of the people who answer questions frequently here appears to be very familiar with either program (there are various reasons for that), so questions on them often don't get answers.

      Comment


      • #4
        Many thanks Marcos and Nick, now I'd appreciate too much if you can give me some idea to get the random effect part of the model in the outreg2 tables.

        This is my updated code after Marco's suggestion:
        xtmixed WMvocab|| idcoleg1:, cov(unstruc) ||idchild:, mle cov(unstruc) var
        xtmrho
        estat ic
        mat es_ic = r(S)
        local AIC : display %4.1f es_ic[1,5]
        outreg2 using C:\Users\Smendive\Dropbox\fondecytINICIO2014_SM\pa pervoc.doc, addstat ("ICC L1", e(rho1), "ICC L2", e(rho2), "-2LL", e(ll), "df",e(df_m), AIC, `AIC', BIC, `BIC') nolabel replace alpha (.001, .01, .05, .10) symbol(***, **, *, ~)

        Comment

        Working...
        X