Announcement

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

  • How to export elasticities and marginal effects of multiple logistic models in only one Excel file?

    Hello to all,

    I have 2 logistic models of which I have exported without problems the regressions in Excel. The commands used were:

    Code:
    logit BTProp pobrelogit
    outreg2 using "C:\Users\Luisa Amanda Lòpez M\Desktop\b.xls", replace dec(3) excel
    logit ProgSoc pobrelogit
    outreg2 using "C:\Users\Luisa Amanda Lòpez M\Desktop\b.xls", append dec(3) excel
    However, I'd like to also export the marginal effects and the elasticity of these models to the same Excel file. I have tried to do the following:

    1. For the marginal effects:
    Code:
    margins, dydx( pobrelogit)
    outreg2 using "C:\Users\Luisa Amanda Lòpez M\Desktop\b.xls", append ctitle(Logit Marg) stat(dy/dx)
    2. For the elasticities
    Code:
    margins, eyex( pobrelogit)
    outreg2 using "C:\Users\Luisa Amanda Lòpez M\Desktop\b.xls", append ctitle(Logit Elast) stat(ey/ex)
    In both cases gives me error. Use the STATA 13.

    I would be very grateful for your support

  • #2
    Hello Louisa,

    I don't use the SSC outreg2.

    That said, you may store coefficients after the - logit - command, then you can also store the marginal effects (including the elasticities) by adding the option "post" in - margins - command.

    By taking the precaution of using the - post - option, I'm quite optimistic that - outreg2 - will eventually catch up with both logit coefficients and elasticities.

    Best,

    Marcos
    Last edited by Marcos Almeida; 16 Jan 2017, 05:14.
    Best regards,

    Marcos

    Comment


    • #3
      I've not done this with margins (probably with pose as Marcos suggests), but instead of appending as you do, I normally use estimates store to save the estimates and then have outreg2 write them all at once. You may get columns you don't intend if outreg2 sees each as a separate estimate.

      Comment


      • #4

        Thank you very much for your answers, I can export the elasticities and marginal effects following its recommendations
        Code:
        xi: logit ProgSoc pob_ge_sprog sexo_jefelogit edad_jefe educjefeH consu2pc_mensual_sin2 vivienda_titulada DPared DPiso DTecho Dagua DAlcant DElect arealogit víaacceso dsalud descuela_primaria jefetraba rremesase leña ind_equip i.MUNCEN
        margins, eyex(pob_ge_sprog sexo_jefelogit edad_jefe educjefeH consu2pc_mensual_sin2 vivienda_titulada  DPared DPiso DTecho Dagua DAlcant DElect arealogit víaacceso dsalud descuela_primaria jefetraba rremesase leña ind_equip) post
        outreg2 using "C:\Users\Luisa Amanda Lòpez M\Desktop\Elasticidades.xls", excel replace ctitle(Programas Sociales) label


        regards

        Comment

        Working...
        X