Announcement

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

  • How to find equation numbers for use with etable option equations()

    I would like to display two melogit models side-by-side using etable. They have different outcome variables but identical controls. On first attempt the control variables are not aligned so I attempt to fix this using the equations() option. However, non of my attempts are working. I would like to know how I can see what the equation numbers are. Can I list these somehow?

    And is the following expected behaviour? The first attempt, with no equations() option does not show the level two variance (turn var(_cons)). When I attempt to specify any equations() option, the table is rendered with only the "Number of observations" row.

    Thank you.

    This code recreates my problem:

    Code:
    webuse auto, clear
    
    melogit foreign rep78 || turn:,
    est store m1
    
    drop if mpg > 38
    
    gen high = headroom > 4
    melogit high rep78 || turn:,
    est store m2
    
    etable, estimates(m1 m2)
    etable, estimates(m1 m2) equations(1)
    etable, estimates(m1 m2) equations(1:1)
    etable, estimates(m1 m2) equations(1:1, 2:2)
    The four respective outputs look like this:

    Click image for larger version

Name:	Screenshot 2025-08-22 at 11.19.59.png
Views:	1
Size:	289.4 KB
ID:	1781218
    Attached Files

  • #2
    See #11: https://www.statalist.org/forums/for...date-for-v17-0

    Comment


    • #3
      Thank you, Andrew. I didn't spot that one when searching.

      So to update, using the information from https://www.statalist.org/forums/for...date-for-v17-0 , I can align the tables by getting the equation names using:

      Code:
      etable, replay showeq
      And then recode the equation names as I specify the etable. The following code solves my particular problem.

      Code:
      webuse auto, clear
      
      melogit foreign rep78 || turn:,
      est store m1
      
      drop if mpg > 38
      
      gen high = headroom > 4
      melogit high rep78   || turn:,
      est store m2
      
      etable, estimates(m1 m2)
      
      --------------------------------------
                             foreign   high 
      --------------------------------------
      Repair record 1978       2.287        
                             (0.793)        
      Intercept              -10.010        
                             (3.217)        
      var(_cons[turn])         4.332   0.000
                             (3.842) (0.000)
      Repair record 1978              -0.949
                                     (0.528)
      Intercept                        0.333
                                     (1.506)
      Number of observations      69      68
      --------------------------------------
      
      etable, replay showeq novarlabel
      
      --------------------------------------
                             foreign   high 
      --------------------------------------
      foreign                               
        rep78                  2.287        
                             (0.793)        
        _cons                -10.010        
                             (3.217)        
      /                                     
        var(_cons[turn])       4.332   0.000
                             (3.842) (0.000)
      high                                  
        rep78                         -0.949
                                     (0.528)
        _cons                          0.333
                                     (1.506)
      Number of observations      69      68
      --------------------------------------
      
      
      etable, estimates(m1 m2) eqrecode(foreign=xb high=xb)
      
      --------------------------------------
                             foreign   high 
      --------------------------------------
      Repair record 1978       2.287  -0.949
                             (0.793) (0.528)
      Intercept              -10.010   0.333
                             (3.217) (1.506)
      var(_cons[turn])         4.332   0.000
                             (3.842) (0.000)
      Number of observations      69      68
      --------------------------------------
      Using numbers as the manual says, e.g. any of the following, still produces the strange table with only the N row. I do wonder if that's a bug. However, I do have a solution to my particular problem (thanks again, Andrew).

      Code:
      etable, estimates(m1 m2) equations(1)
      etable, estimates(m1 m2) equations(1:1)
      etable, estimates(m1 m2) equations(1:1, 2:2)
      All produce:

      Code:
      -----------------------------------
                             foreign high
      -----------------------------------
      Number of observations      69   68
      -----------------------------------

      Comment


      • #4
        Originally posted by Kate OHara View Post

        Using numbers as the manual says, e.g. any of the following, still produces the strange table with only the N row. I do wonder if that's a bug. However, I do have a solution to my particular problem (thanks again, Andrew).

        Code:
        etable, estimates(m1 m2) equations(1)
        etable, estimates(m1 m2) equations(1:1)
        etable, estimates(m1 m2) equations(1:1, 2:2)
        All produce:

        Code:
        -----------------------------------
        foreign high
        -----------------------------------
        Number of observations 69 68
        -----------------------------------
        The option -equations()- in etable simply orders the equations in the resulting table:

        equations(eqlist) specifies the equations to be included in the table and the order in which they are reported.
        Since there is no equation named 1 or 2, the table ends up empty. My guess is that you are mixing up this option with the -equations()- option from estout (from SSC), which does what you assume:

        equations(eqmatchlist) match the models' equations
        But the two options do not do the same thing.

        Comment

        Working...
        X