Announcement

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

  • add "outside" stat to etable result

    I want to add the C statistic to the table below

    I actually don't care whether this is done in -etable- or in -collect- but here is my current attempt:
    Code:
    sysuse auto, clear
    qui logistic foreign price
    est store nonmi
    qui predict acute1, pr
    qui lroc, nog
    local c1 = r(area)
    
    logistic foreign mpg
    est store mi
    qui predict ahat1, pr
    qui lroc, nog
    local c2 = r(area)
    
    etable, estimates(nonmi mi) showeq column(estimates) cstat(_r_b) cstat(_r_p) ///
    mstat(N, label("N") nformat(%5.0fc))
    and here is the result (note that I do know that there is nothing in the etable command above that would include the computed C stats (and, if it is easier to use some other command for the C stat (e.g., somersd or roc), that is fine
    Code:
    ---------------------------
                    nonmi   mi 
    ---------------------------
    Car origin                 
      Price         1.000      
                     0.68      
      Mileage (mpg)       1.173
                           0.00
      Intercept     0.340 0.013
                     0.07  0.00
    N                  74    74
    ---------------------------

  • #2
    When you want to add extra "model" statistics beyond what is posted to e() by the estimation command, it is easier to specify them in mstat() options to get the table contents you want for a single estimation, then just use etable, append for each subsequent estimation situation.

    Here is this idea in action, based on the original example.
    Code:
    sysuse auto, clear
    qui logistic foreign price
    est store nonmi
    qui predict acute1, pr
    qui lroc, nog
    local c1 = r(area)
    etable, showeq ///
            column(estimates) ///
            cstat(_r_b) ///
            cstat(_r_p) ///
            mstat(C=(r(area)), nformat(%9.3f)) ///
            mstat(N, label("N") nformat(%5.0fc))
    
    logistic foreign mpg
    est store mi
    qui predict ahat1, pr
    qui lroc, nog
    local c2 = r(area)
    etable, append
    Here is the final table.
    Code:
    ---------------------------
                    nonmi   mi 
    ---------------------------
    Car origin                 
      Price         1.000      
                     0.68      
      Mileage (mpg)       1.173
                           0.00
      Intercept     0.340 0.013
                     0.07  0.00
    C               0.577 0.729
    N                  74    74
    ---------------------------

    Comment


    • #3
      thank you Jeff Pitblado (StataCorp)

      Comment

      Working...
      X