Announcement

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

  • How do I CREATE a variance covariance matrix?

    Hi,

    I'm estimating a model as given below

    probit y z x1 x2 x3 x4
    probit z y x1 x2 x5 x6

    I've generated the residuals for each of these regressions
    predict yhat
    gen yresid = (y-yhat)

    and similarly for z.

    Now I want to get the variance-covariance matrix for yresid and zresid..

    Is there anyway I can do this in Stata 10.

    I hope this makes sense. Thank you in advance.

    Regards,
    Rosa Abraham






  • #2
    Variance -covariance matrix can be estimated with user written command varrets
    Code:
    ssc install varrets
    Regards
    --------------------------------------------------
    Attaullah Shah, PhD.
    Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
    FinTechProfessor.com
    https://asdocx.com
    Check out my asdoc program, which sends outputs to MS Word.
    For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

    Comment


    • #3
      Thank you Prof Shah. I had to install mvport
      ssc install mvport
      to get the varrets command..

      Unfortunately, I'm using Stata 10, and varrets is a version 12.1 program. So I can't run this.. ! Any other options?

      Comment


      • #4
        Hi Rosa, not sure if I got you right. You have created two columns with residuals from two models. If you wish to see their correlation/covariance just type (you may have valid reasons for that),
        Code:
        corr yresid  zesid, cov
        . But I intuitively think you are asking for the covariance matrix for the model you ran. This is how you can do it:

        Code:
        probit y z x1 x2 x3 x4
        
        matlist e(V)   /*this will give you the variance/covariance matrix*/
        
        /*Same can be obtained with the following*/
        
        estat vce /*for var/cov matrix*/
        
        estat vce, cor /*If you want them in correlation form rather in variance form*/
        
        Note: The last option (cor) returns 1 for the diagonal elements.
        Roman

        Comment

        Working...
        X