Announcement

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

  • Trouble with 'esttab' and stats() in probit model ... N remain blank in the Table

    Hello everyone,

    using Stata (14.1) I'm running three probit regressions which are only different in dependent variables. I'd like to present the marginal effects of interaction variables in each model in a single table with three side-by-side columns. The number of observations and the Chi-squared statistic for each model remain blank, even though I specify them in the esttab command.
    I’d really appreciate any insights on how to fix this. Is sth wrong in my commands?—thanks in advance!

    probit X1 $attitude $info $edu $country, vce(robust)
    local pR2 = e(r2_p)
    eststo margins_1: margins , dydx(*) post

    probit X1 $attitude $info $edu $country c.env##i.income, vce(robust)
    margins , dydx(env) at(income = (1 2 3 4)) post
    estimates store het_income
    eststo margins_2: xlincom income1vsincome2 = (2._at - 1._at) , post
    estimates restore het_income
    eststo margins_3: xlincom income1vsincome3 = (3._at - 1._at) , post
    estimates restore het_income
    eststo margins_4: xlincom income1vsincome4 = (4._at - 1._at) , post

    running the same commands for X2 and X3

    eststo outcome1: appendmodels margins_1 margins_2 margins_3 margins_4
    eststo outcome2: appendmodels margins_5 margins_6 margins_7 margins_8
    eststo outcome3: appendmodels margins_9 margins_10 margins_11 margins_12

    esttab outcome1 outcome2 outcome3 using "C:\Users\.rtf", se(%4.3f) b(%4.3f) mtitles("x" "y" "z") stats(N chi2, labels("N" "Chi-squared") fmt(%4.0f %4.0f %4.2f)) star(* 0.10 ** 0.05 *** 0.01) varlabels(,elist(weight:_cons "{break}{hline u/width}")) nonotes addnotes("") compress replace




  • #2
    Try these.

    Code:
    probit X1 $attitude $info $edu $country, vce(robust)
    local    N=e(N)
    local pR2 = e(r2_p)
    eststo margins_1: margins , dydx(*) post
    
    probit X1 $attitude $info $edu $country c.env##i.income, vce(robust)
    margins , dydx(env) at(income = (1 2 3 4)) post
    estimates store het_income
    eststo margins_2: xlincom income1vsincome2 = (2._at - 1._at) , post
    estimates restore het_income
    eststo margins_3: xlincom income1vsincome3 = (3._at - 1._at) , post
    estimates restore het_income
    eststo margins_4: xlincom income1vsincome4 = (4._at - 1._at) , post
    
    running the same commands for X2 and X3
    
    eststo outcome1: appendmodels margins_1 margins_2 margins_3 margins_4
    estadd    scalar    N    =`N'
    estadd    scalar    R2    =`pR2'
    eststo outcome2: appendmodels margins_5 margins_6 margins_7 margins_8
    estadd    scalar    N    =`N'
    estadd    scalar    R2    =`pR2'
    eststo outcome3: appendmodels margins_9 margins_10 margins_11 margins_12
    estadd    scalar    N    =`N'
    estadd    scalar    R2    =`pR2'
    
    esttab outcome1 outcome2 outcome3 using "C:\Users\.rtf", se(%4.3f) b(%4.3f) mtitles("x" "y" "z") stats(N chi2, labels("N" "Chi-squared") fmt(%4.0f %4.0f %4.2f)) star(* 0.10 ** 0.05 *** 0.01) varlabels(,elist(weight:_cons "{break}{hline u/width}")) nonotes addnotes("") compress replace
    A few notes.

    1. It would be helpful wrap the code for better readability

    2. "appendmodels" seems not in the Stata default command. I used the one from (here). Not sure if this is what you use.

    Comment


    • #3
      Dear Seungmin Lee many thanks for your response! It is now working perfectly; and thanks for your notes. I use the same "appendmodels".
      All the best

      Comment

      Working...
      X