Announcement

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

  • Estout: storing probit result and average marginal effect in same column

    Hi, I am doing multiple probit regressions for different subsamples. I am using estout because I have a long list of fixed effects I don't need to see every time. I am also storing the average marginal effect (AME) using margins. That returns two columns per subsample: one with the probit coefficient, and one with the AME. I would like the probit coefficient and AME for each subsample to appear in the same column. I have tried using estadd, but it does not seem to work. Can anyone help me?

    An example of my code for only the main sample and one subsample, which returns 4 columns:

    Code:
    eststo probit_all: quietly probit hsdegree csla ///    
        i.sex i.degurba    i.eurovoc_region    /// controls
        i.birthyear i.l_region                        /// birth cohort & region FE
        c.birthyear#i.l_region,                        /// cohort trends by region
        vce(cluster cluster_country_birthyear)
    eststo dydx_all: quietly margins, dydx(csla) post
    
    eststo probit_men: quietly probit hsdegree csla ///
        i.degurba    i.eurovoc_region                /// controls
        i.birthyear i.l_region                        /// birth cohort & region FE
        c.birthyear#i.l_region                        /// cohort trends by region
        if sex == 1,                                            /// sample
        vce(cluster cluster_country_birthyear)
    eststo dydx_men: quietly margins, dydx(csla) post
    
    esttab probit_all dydx_all probit_men dydx_men, se r2 keep(csla) mtitle

  • #2
    I found a solution based on this old Statalist question, using estadd local. It goes like this:

    Code:
    eststo test1: probit hsdegree csla
    estadd margins, dydx(csla)
    estadd local ame "`=round(e(margins_table)[rownumb(M,"b"),1], 0.0001)'"
    estadd local ame_se "(`=round(e(margins_table)[rownumb(M,"se"),1], 0.0001)')"
    
    eststo test2: probit hsdegree csla
    estadd margins, dydx(csla)
    estadd local ame "`=round(e(margins_table)[rownumb(M,"b"),1], 0.0001)'"
    estadd local ame_se "(`=round(e(margins_table)[rownumb(M,"se"),1], 0.0001)')"
    
    esttab test1 test2, se r2 keep(csla) stats(ame ame_se N, label("AME" " " "(Obs.)")) mtitle("All" "All2") coeflabel(csla CSLA)
    Hopefully estout once gets an improvement to allow for a bit of a more handy approach

    Comment

    Working...
    X