Announcement

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

  • Add pseudo R2 in probit with marginal effects

    Hello Stata legends,

    I've been searching on statalist for a while, but I can't seem to figure out my problem. I want to add Pseudo R2 to my Probit regression with marginal effects in outreg2 with the following code:

    Code:
    probit Exit2 ln_TotalFundSizeEUR ln_TotalFundSizeEUR2 TotalFundExp InvNumber IPO_MA SameCountry EmergingMarket i.InvTypeCat i.Year i.IndustryCat
    margins, dydx(*) atmeans post
    outreg2 using ProbitRegressionsMargins.doc, addstat(Pseudo R2, e(r2_p)) nocons stats(coef tstat) replace label dec(3) tdec(2) keep(ln_TotalFundSizeEUR ln_TotalFundSizeEUR2
    >TotalFundExp InvNumber IPO_MA SameCountry EmergingMarket) addtext(Investment Type FE, YES, Year FE, YES, Industry FE, YES)
    >title(Table 2 - Probit regression on exit probability) ctitle(Full Sample)
    However, this doesn't seem to work as I get the invalid syntax r(198) error. I suppose e(r2_p) is not available for margins, as when I run it without marginal effects, I do obtain a pseudo R2. How do I add (Pseudo) R2 to this probit model with marginal effects?

    I've already read the 'help outreg2/probit/margins' pages but I just can't figure it out.

  • #2
    outreg2 is from SSC (FAQ Advice #12). You need to save the statistic in a local prior to running the margins command. This is not tested.

    Code:
    probit Exit2 ln_TotalFundSizeEUR ln_TotalFundSizeEUR2 TotalFundExp InvNumber IPO_MA SameCountry EmergingMarket i.InvTypeCat i.Year i.IndustryCat
    local r2_p= e(r2_p)
    margins, dydx(*) atmeans post
    outreg2 using ProbitRegressionsMargins.doc, addstat(Pseudo R2, `r2_p') nocons stats(coef tstat) replace ...

    Comment


    • #3
      Thanks again Andrew, it worked!

      Comment

      Working...
      X