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
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.
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.
Comment