Announcement

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

  • Change label of interaction with esttab; matching latex table with stata output

    Dear members of the Statalist forum,

    I'm having an issue with my current statistical analysis, and I'm hoping you can help me. I'm looking at the effect of temperature anomalies on voting behavior by party identification. To accomplish this, I'm only including one hash mark since I'm interested in the effects by the three different categories of party identification only.

    Code:
     xtreg votegreen i.pidgreen#c.d1_temp_hav_ i.pidgreen#c.d1_temp_cav_ i.wave, fe i(lfdn) vce(cluster district)
    estadd local individual "yes"
    estadd local district "no"
    estadd local wave "yes"
    est store m1_tempch_tw_6
    This is the output I received:

    Code:
     . xtreg votegreen i.pidgreen#c.d1_temp_hav_ i.pidgreen#c.d1_temp_cav_ i.wave, fe i(lfdn) vce(cluster
    >  district)
    
    Fixed-effects (within) regression               Number of obs     =     60,785
    Group variable: lfdn                            Number of groups  =     13,606
    
    R-squared:                                      Obs per group:
         Within  = 0.0507                                         min =          1
         Between = 0.5683                                         avg =        4.5
         Overall = 0.3343                                         max =          6
    
                                                    F(11, 298)        =      63.55
    corr(u_i, Xb) = 0.5362                          Prob > F          =     0.0000
    
                                              (Std. err. adjusted for 299 clusters in district)
    -------------------------------------------------------------------------------------------
                              |               Robust
                  votegreen_w | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------------------+----------------------------------------------------------------
    pidgreen_w#c.d1_temp_hav_ |
                    no party  |  -.0076466   .0036942    -2.07   0.039    -.0149167   -.0003765
                 other party  |  -.0173924   .0023559    -7.38   0.000    -.0220287    -.012756
      Alliance 90/The Greens  |   .0910125   .0074497    12.22   0.000     .0763519    .1056731
                              |
    pidgreen_w#c.d1_temp_cav_ |
                    no party  |   .0035544   .0069646     0.51   0.610    -.0101516    .0172603
                 other party  |   -.023229    .005547    -4.19   0.000    -.0341452   -.0123128
      Alliance 90/The Greens  |   .1336553   .0089553    14.92   0.000     .1160316    .1512789
                              |
                         wave |
                     wave 17  |  -.0338466   .0085772    -3.95   0.000    -.0507262    -.016967
                     wave 18  |  -.0395805   .0075325    -5.25   0.000    -.0544042   -.0247569
                     wave 19  |  -.0618459   .0086743    -7.13   0.000    -.0789165   -.0447752
                     wave 20  |  -.0602933   .0086149    -7.00   0.000    -.0772471   -.0433395
                     wave 21  |  -.0577739   .0075376    -7.66   0.000    -.0726075   -.0429403
                              |
                        _cons |    .224089   .0083132    26.96   0.000      .207729     .240449
    --------------------------+----------------------------------------------------------------
                      sigma_u |    .304346
                      sigma_e |  .21116474
                          rho |  .67503637   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------------------
    I tried to export this output to Latex using the following code:

    Code:
     esttab m1_tempch_tw_1 m1_tempch_tw_2 m1_tempch_tw_3 m1_tempch_tw_4 m1_tempch_tw_5 m1_tempch_tw_6 using m1_temp_ch_av_tw.tex, replace label ///
     refcat(2.pidgreen#c.d1_temp_hav_ "PI" 2.edu "Education (Ref. low)"  1.agegroup "Age (Ref. 65+)", nolabel) b(%9.4f) se(%9.4f)  ///
     star(+ 0.10 * 0.05 ** 0.01 *** 0.001) drop(*district *wave) ///
     nobaselevels booktabs obslast nonotes nomtitle collabels(none) compress alignment(D{.}{.}{-1}) noomitted ///
     stats(individual district wave k r2_w N, fmt(0 0 0 0 4 0) layout("\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}" "\multicolumn{1}{c}{@}")  labels("individual fixed effects" "constituency fixed effects" "wave fixed effects" \hline "\(R^{2}\)" "Observations")) varlabel(_cons "Constant" ) ///
     mlabels("\multicolumn{1}{c}{(1)}" "\multicolumn{1}{c}{(2)}" "\multicolumn{1}{c}{(3)}" "\multicolumn{1}{c}{(4)}" "\multicolumn{1}{c}{(5)}" "\multicolumn{1}{c}{(6)}") ///
     mgroups("DV: Green Party voting", pattern(1 0 0 0 0 0 0) span prefix(\multicolumn{@span}{c}{) suffix  (})) nonumbers
    However, what I get in Latex is this table:
    Click image for larger version

Name:	latex.PNG
Views:	1
Size:	34.3 KB
ID:	1745930


    Does anyone of you know how to change the esttab code, so that the Latex table mirrors the Stata output (the effects of temperature anomalies are displayed by each category of party identification). I was thinking about renaming the labels in the table but haven't found a way yet. Further, I want to include all PI categories (no party is currently missing in the Latex table).

    Please let me know if you have any suggestions or insights. Thank you for your time.

    Best,
    Jessica

  • #2
    estout is from SSC (FAQ Advice #12). See the -order()- option to reorder coefficients. However, I cannot see a reason why you lose the coefficient on "no party". A reproducible example (at least of the last regression) would help your case.

    Code:
    help estout

    Comment


    • #3
      I think the coefficients on “no party” might be dropped as base values. Try omitting “nobaselevels” or alternatively specify ibn.pidgreen instead of i.pidgreen.

      Comment

      Working...
      X