Announcement

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

  • How to get only the coefficients and variance estimates from the oprobit command?

    In my Mata function, I am using the oprobit command like the following example:
    Code:
    clear all
    sysuse auto
    mata:
    opcmd = "oprobit " + "rep78 price foreign"
    op = _stata(opcmd, 1)
    
    if (op) {
        errprintf("  could not run oprobit")
        exit(op)
    }
    
    st_matrix("e(b)")
    st_matrix("e(V)")
    end
    By using the oprobit command, what I need is just e(b) and e(V).
    But, you know, the oprobit command returns so many things:
    Code:
    ereturn list
    
    scalars:
                   e(rank) =  6
                      e(N) =  69
                     e(ic) =  4
    ...
    Since the oprobit's calculation is the most time-consuming part of my code, I think calculating only e(b) and e(V) would shorten the running time significantly.
    But, I am not sure whether it is possible to get only e(b) and e(V)(, and also whether that makes my code much faster since the e(V) requires the first and second derivatives of the objective function.)

    So, Is it possible to get the oprobit to calculate only e(b) and e(V)? and if that is possible, do you think that can make significant improvement?
    (If you know of any other ways to improve the speed when using Stata commands in Mata, I would appreciate it if you could tell me too.)
Working...
X