Hello,
I am using Stata 13.1. I have variables a b c d e f. I want to create 15 new variables using the values from the inverse of the covariance matrix of these variables. Typically, to get the covariance matrix I use "corr varlist, cov", however I could not work out how to get the inverse of this. Therefore, through a great deal of trawling the Stata forums I have so far done the following:
At this point, I can see the inverted covariance matrix tabled. After any attempt I have made using svmat, or even just trying to create another matrix with the same values, Stata informs me that "matrix inv_cov cannot be found", and therefore I cannot begin to work out how to create my variables.
I would appreciate any help to further my efforts in creating these variables.
Best,
Sarah Rhatigan
I am using Stata 13.1. I have variables a b c d e f. I want to create 15 new variables using the values from the inverse of the covariance matrix of these variables. Typically, to get the covariance matrix I use "corr varlist, cov", however I could not work out how to get the inverse of this. Therefore, through a great deal of trawling the Stata forums I have so far done the following:
Code:
mkmat a b c d e f, matrix(test1) mata test1 = st_matrix("test1") mata st_matrix("vce", variance(test1)) mat li vce mata inv_cov=cholinv(st_matrix("vce")) mata inv_cov
I would appreciate any help to further my efforts in creating these variables.
Best,
Sarah Rhatigan
Comment