Announcement

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

  • How to combine two table which is generated by estat

    Hi, I want to ask about is there any way to combine the two table together, which is generated by estat (not the regression of the probit model). Besides, is there any way to choose the specific column that I want to produce in the combine table? Like there are 4 column in two of the table, and I just want to produce 3 in the combine table.

    Code:
    probit unemployment EDAGE i.CURED8  if (CURED8!=-9 & CURED8!=-8 & EDAGE!=96& LIMITA!=-8 & LIMITK!=-8)
    estat ic
    
    probit unemployment AGE EDAGE ib1.SEX i.CURED8 if (CURED8!=-9 & CURED8!=-8 & EDAGE!=96& LIMITA!=-8 & LIMITK!=-8)
    estat ic
    Thank you!

  • #2
    It helps if you provide a dataset with your code example.

    Here is an example using the auto data and the new collect features in Stata 17 and 18.
    Code:
    sysuse auto
    
    * suppose this is a base-line model
    probit foreign turn trunk 
    * look at the results posted by -estat ic-
    estat ic
    return list
    * notice the column names, I assume you are interested in df AIC BIC
    matrix list r(S)
    * collect these results and tag them with fit[1]
    collect, tag(fit[1]) : estat ic
    
    * this is the model with extra predictors
    probit foreign turn trunk displ gear
    * collect these results and tag them with fit[2]
    collect, tag(fit[2]) : estat ic
    
    * format the values for AIC and BIC
    collect style cell colname[AIC BIC], nformat(%9.2f)
    
    * add some labels
    collect label dim fit "Fitted model"
    collect label levels fit 1 "Base" 2 "Extra"
    * make sure to show the dimension and level labels
    collect style header fit, title(label) level(label)
    
    * I add the N column to show the results have the same sample size
    collect layout (fit) (colname[N df AIC BIC])
    Here is the combined table.
    Code:
    --------------------------------
                 |  N df   AIC   BIC
    -------------+------------------
    Fitted model |                  
      Base       | 74  3 58.22 65.13
      Extra      | 74  5 43.66 55.19
    --------------------------------
    You can use collect export to publish this table to Word, Excel, PDF, HTML, LaTeX, and markdown.

    If you are not familiar with the new collect features, see the [TABLES] manual.

    Comment

    Working...
    X