Announcement

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

  • (ssc) esttab and stcrreg: option equations() invalid

    For some reason esttab (an ssc package) will not let me combine these two outputs:

    Code:
    . stcrreg contrib vx1adultHazRtHat, compete(dosedByNow==2)
    
    [ . . . ]
    
    Competing-risks regression                        No. of obs      =      5,482
                                                      No. of subjects =        539
    Failure event:   dosedByNow == 1                  No. failed      =        194
    Competing event: dosedByNow == 2                  No. competing   =         37
                                                      No. censored    =        308
    
                                                      Wald chi2(2)    =       5.88
    Log pseudolikelihood = -1184.7533                 Prob > chi2     =     0.0528
    
                                   (Std. err. adjusted for 539 clusters in subject_id)
    ----------------------------------------------------------------------------------
                     |               Robust
                  _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
    -----------------+----------------------------------------------------------------
             contrib |   1.125542   .0549522     2.42   0.015     1.022831    1.238568
    vx1adultHazRtHat |   1.024642    .043759     0.57   0.569      .942367      1.1141
    ----------------------------------------------------------------------------------
    
    . eststo e1, title("cr")
    
    . stcrreg contrib vx1adultHazRtHat, compete(dosedByNow==2) tvc(contrib vx1adultHazRtHat)
    
    [ . . . ]
    
    Competing-risks regression                        No. of obs      =      5,482
                                                      No. of subjects =        539
    Failure event:   dosedByNow == 1                  No. failed      =        194
    Competing event: dosedByNow == 2                  No. competing   =         37
                                                      No. censored    =        308
    
                                                      Wald chi2(4)    =       6.33
    Log pseudolikelihood = -1184.4078                 Prob > chi2     =     0.1759
    
                                   (Std. err. adjusted for 539 clusters in subject_id)
    ----------------------------------------------------------------------------------
                     |               Robust
                  _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
    -----------------+----------------------------------------------------------------
    main             |
             contrib |   1.167825   .0900622     2.01   0.044     1.003999    1.358382
    vx1adultHazRtHat |   1.058385   .0715551     0.84   0.401     .9270347    1.208347
    -----------------+----------------------------------------------------------------
    tvc              |
             contrib |   .9991668   .0012241    -0.68   0.496     .9967704    1.001569
    vx1adultHazRtHat |   .9991421   .0013809    -0.62   0.535     .9964393    1.001852
    ----------------------------------------------------------------------------------
    Note: Variables in tvc equation interacted with _t.
    
    . eststo e2, title("tvc")
    
    . esttab e1
    
    ----------------------------
                          (1)  
                           _t  
    ----------------------------
    eq1                        
    contrib             0.118*  
                       (2.42)  
    
    vx1adultHa~t       0.0243  
                       (0.57)  
    ----------------------------
    N                    5482  
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    
    . esttab e2
    
    ----------------------------
                          (1)  
                           _t  
    ----------------------------
    main                        
    contrib             0.155*  
                       (2.01)  
    
    vx1adultHa~t       0.0567  
                       (0.84)  
    ----------------------------
    tvc                        
    contrib         -0.000834  
                      (-0.68)  
    
    vx1adultHa~t    -0.000858  
                      (-0.62)  
    ----------------------------
    N                    5482  
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001
    
    . esttab e1 e2
    option equations() invalid
    specified equation name already occurs in model 2
    r(198);
    Anyone have an idea of what is going wrong? I tried specifying "equations()" to try to clear out whatever it dislikes, to no avail. Thanks!!
    Last edited by lucas reddinger; 28 Jan 2022, 16:09.

  • #2
    Can you provide a reproducible example?

    Comment


    • #3
      Thanks for your response. Here is one:

      Code:
      . use https://www.stata-press.com/data/r17/hypoxia
      (Hypoxia study)
      
      . stset dftime, failure(failtype == 1)
      
      Survival-time data settings
      
               Failure event: failtype==1
      Observed time interval: (0, dftime]
           Exit on or before: failure
      
      --------------------------------------------------------------------------
              109  total observations
                0  exclusions
      --------------------------------------------------------------------------
              109  observations remaining, representing
               33  failures in single-record/single-failure data
          353.129  total analysis time at risk and under observation
                                                      At risk from t =         0
                                           Earliest observed entry t =         0
                                                Last observed exit t =     8.454
      
      . stcrreg ifp tumsize pelnode, compete(failtype == 2)
      
              Failure _d: failtype==1
        Analysis time _t: dftime
      
      Iteration 0:   log pseudolikelihood = -138.67925  
      Iteration 1:   log pseudolikelihood = -138.53082  
      Iteration 2:   log pseudolikelihood =  -138.5308  
      Iteration 3:   log pseudolikelihood =  -138.5308  
      
      Competing-risks regression                        No. of obs      =        109
                                                        No. of subjects =        109
      Failure event:   failtype == 1                    No. failed      =         33
      Competing event: failtype == 2                    No. competing   =         17
                                                        No. censored    =         59
      
                                                        Wald chi2(3)    =      33.21
      Log pseudolikelihood =  -138.5308                 Prob > chi2     =     0.0000
      
      ------------------------------------------------------------------------------
                   |               Robust
                _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
               ifp |   1.033206   .0178938     1.89   0.059     .9987231    1.068879
           tumsize |   1.297332   .1271191     2.66   0.008     1.070646    1.572013
           pelnode |   .4588123   .1972067    -1.81   0.070     .1975931    1.065365
      ------------------------------------------------------------------------------
      
      . eststo e1, title("cr")
      
      . stcrreg ifp tumsize pelnode, compete(failtype == 2) tvc(ifp tumsize pelnode)
      
              Failure _d: failtype==1
        Analysis time _t: dftime
      
      Iteration 0:   log pseudolikelihood = -137.02685  
      Iteration 1:   log pseudolikelihood =  -136.7927  
      Iteration 2:   log pseudolikelihood = -136.79001  
      Iteration 3:   log pseudolikelihood =    -136.79  
      
      Competing-risks regression                        No. of obs      =        109
                                                        No. of subjects =        109
      Failure event:   failtype == 1                    No. failed      =         33
      Competing event: failtype == 2                    No. competing   =         17
                                                        No. censored    =         59
      
                                                        Wald chi2(6)    =      44.93
      Log pseudolikelihood =    -136.79                 Prob > chi2     =     0.0000
      
      ------------------------------------------------------------------------------
                   |               Robust
                _t |        SHR   std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
      main         |
               ifp |   1.026556   .0179091     1.50   0.133     .9920479    1.062264
           tumsize |   1.460779   .1601932     3.46   0.001     1.178255    1.811047
           pelnode |   .4647006   .2201166    -1.62   0.106     .1836459    1.175886
      -------------+----------------------------------------------------------------
      tvc          |
               ifp |   1.005606   .0082267     0.68   0.494     .9896103     1.02186
           tumsize |   .8680375   .0789007    -1.56   0.119     .7263871    1.037311
           pelnode |   1.062947   .6033474     0.11   0.914     .3494259    3.233468
      ------------------------------------------------------------------------------
      Note: Variables in tvc equation interacted with _t.
      
      . eststo e2, title("tvc")
      
      . esttab e1
      
      ----------------------------
                            (1)   
                             _t   
      ----------------------------
      eq1                         
      ifp                0.0327   
                         (1.89)   
      
      tumsize             0.260**
                         (2.66)   
      
      pelnode            -0.779   
                        (-1.81)   
      ----------------------------
      N                     109   
      ----------------------------
      t statistics in parentheses
      * p<0.05, ** p<0.01, *** p<0.001
      
      . esttab e2
      
      ----------------------------
                            (1)   
                             _t   
      ----------------------------
      main                        
      ifp                0.0262   
                         (1.50)   
      
      tumsize             0.379***
                         (3.46)   
      
      pelnode            -0.766   
                        (-1.62)   
      ----------------------------
      tvc                         
      ifp               0.00559   
                         (0.68)   
      
      tumsize            -0.142   
                        (-1.56)   
      
      pelnode            0.0610   
                         (0.11)   
      ----------------------------
      N                     109   
      ----------------------------
      t statistics in parentheses
      * p<0.05, ** p<0.01, *** p<0.001
      
      . esttab e1 e2
      option equations() invalid
      specified equation name already occurs in model 2
      r(198);
      
      .

      Comment


      • #4
        Thanks for the reproducible example. Specify option -equations(1:1)- to match the equations one-to-one.

        Code:
        use https://www.stata-press.com/data/r17/hypoxia, clear
        stset dftime, failure(failtype == 1)
        stcrreg ifp tumsize pelnode, compete(failtype == 2)
        eststo e1, title("cr")
        stcrreg ifp tumsize pelnode, compete(failtype == 2) tvc(ifp tumsize pelnode)
        eststo e2, title("tvc")
        esttab e1 e2, equations(1:1) nomtitles
        Res.:

        Code:
        . esttab e1 e2, equations(1:1)  nomtitles
        
        --------------------------------------------
                              (1)             (2)   
        --------------------------------------------
        #1                                          
        ifp                0.0327          0.0262   
                           (1.89)          (1.50)   
        
        tumsize             0.260**         0.379***
                           (2.66)          (3.46)   
        
        pelnode            -0.779          -0.766   
                          (-1.81)         (-1.62)   
        --------------------------------------------
        tvc                                         
        ifp                               0.00559   
                                           (0.68)   
        
        tumsize                            -0.142   
                                          (-1.56)   
        
        pelnode                            0.0610   
                                           (0.11)   
        --------------------------------------------
        N                     109             109   
        --------------------------------------------
        t statistics in parentheses
        * p<0.05, ** p<0.01, *** p<0.001
        Last edited by Andrew Musau; 02 Feb 2022, 05:17.

        Comment

        Working...
        X