Announcement

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

  • how to save a vce output of biprobit model in excel and R

    Hi everyone,
    I ran a biprobit model and used a post-estimation command of "estat vce" and "estat vce, correlation". I wonder to know how can I export the vce results into excel file or R? I would like to use the statat's vce output as an input in R as a matrix for further analyses.
    Best,
    Nader

  • #2
    That matrix is stored as an ereturn matrix, and so you'd use a combination of svmat and export excel.

    Something like the following
    Code:
    version 15.1
    
    webuse school, clear
    
    biprobit private vote logptax loginc years, nolog
    
    estat vce
    matrix list e(V)
    
    *
    * Begin here
    *
    tempname V
    matrix define `V' = e(V)
    
    drop _all
    svmat double `V'
    
    local column_names : colfullnames e(V)
    
    local index 1
    foreach var of varlist _all {
        local variable_label : word `index' of `column_names'
        label variable `var' "`variable_label'"
        local ++index
    }
    
    export excel using V.xlsx, sheet(vce) firstrow(varlabels)
    
    exit

    Comment

    Working...
    X