Announcement

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

  • etable acting strangely

    I have just switched to the new "etable" from "estimates table", but I am having a bit of trouble.

    .est table bl_ols bl_wls bl_wlw, b(%7.2f) se(%7.2f) t(%7.1f) p(%7.2f) stats(N N_clust) stf(%7.0f) varlab

    runs fine and gives the following output:

    --------------------------------------------------------
    Variable | bl_ols bl_wls bl_wlw
    -------------------------+------------------------------
    Eco label | -0.02 -0.22 0.24
    | 0.39 0.36 0.34
    | -0.1 -0.6 0.7
    | 0.96 0.53 0.49
    Constant | 28.15 28.25 27.29
    | 0.29 0.26 0.25
    | 98.0 109.4 108.7
    | 0.00 0.00 0.00
    -------------------------+------------------------------
    N | 1836 1836 1835
    N_clust |
    --------------------------------------------------------
    Legend: b/se/t/p


    However, while

    .etable, estimates(bl_ols bl_wls bl_wlw) cstat(_r_b, nformat(%7.2f)) cstat(_r_se, nformat(%7.2f)) cstat(_r_z_abs, nformat(%7.1f)) cstat(_r_p, nformat(%7.2f)) stars(.1 "*" .05 "**" .01 "***", attach(_r_b)) mstat(N, label(Nr obs)) mstat(N_clust, label(Nr clusters) nformat(%7.0f)) col(estimates) varlab

    runs too and gives nicer-looking output (and allows me to export to Excel, which is great), it puts the same independent variables in different rows of the table:

    ------------------------------------------
    bl_ols bl_wls bl_wlw
    ------------------------------------------
    Eco label -0.02 -0.22
    (0.39) (0.36)
    0.1 0.6
    0.96 0.53
    Intercept 28.15 *** 28.25 ***
    (0.29) (0.26)
    98.0 109.4
    0.00 0.00
    Eco label 0.24
    (0.34)
    0.7
    0.49
    Intercept 27.29 ***
    (0.25)
    108.7
    0.00
    Nr obs 1836 1836 1835
    ------------------------------------------
    *** p<.01, ** p<.05, * p<.1


    The only difference between model bl_wls and bl_wlw is that the dependent variable is different.

    Thank you for your help!

    Thijs

  • #2
    Interactively, you can use the Tables Builder to remove coleq from the layout specification to get the row alignment you want. Here is a simplified example using the publicly available auto data.
    Code:
    sysuse auto
    gen logprice = log(price)
    
    regress logprice mpg turn trunk
    est store regress
    
    glm price mpg turn trunk, link(log)
    est store glm
    
    etable, estimates(regress glm)
    db tables
    Click on the down arrow in the first term of the rows specification.
    Click image for larger version

Name:	edit.png
Views:	1
Size:	189.2 KB
ID:	1782394




    Click on the dimension coleq to remove it from the term.
    Click image for larger version

Name:	child.png
Views:	1
Size:	250.9 KB
ID:	1782397



    Now the coefficients are aligned in the rows.
    Click image for larger version

Name:	result.png
Views:	1
Size:	160.3 KB
ID:	1782396




    Alternatively, etable has option eqrecode() that gives you the ability to recode the column equations to a common level/string. For example,

    Code:
    . etable, estimates(regress glm) eqrecode(logprice=price)
    
    ---------------------------------------
                           logprice  price
    ---------------------------------------
    Mileage (mpg)            -0.035  -0.077
                            (0.010) (0.019)
    Turn circle (ft.)        -0.013  -0.023
                            (0.014) (0.016)
    Trunk space (cu. ft.)     0.014  -0.002
                            (0.012) (0.014)
    Intercept                 9.716  11.252
                            (0.696) (0.907)
    Number of observations       74      74
    ---------------------------------------
    Last edited by Jeff Pitblado (StataCorp); 14 Oct 2025, 10:52.

    Comment


    • #3
      Thank you for your quick and very adequate reply. The eqrecode() option is exactly what I needed.

      Comment

      Working...
      X