Hi everyone.
I am currently trying to run a Monte-Carlo analysis on a meta-dataset to calculate standard errors after creating simulated coefficients. My drawnorm code has been working on all (~600) observations in my dataset except for two. For these two observations, I get error r(506) - matrix not positive (semi)definite. I can't figure out quite what the problem is. I have almost no experience with matrix math, so I'm hoping someone here can help me troubleshoot the problem.
For one of the troublesome observations, `coef_list' holds: coef_1 coef_2 coef_3 coef_4 coef_5, which are all the variables I'm trying to fill in with this command.
the means matrix `m' :
the covariance matrix:
I'm hoping someone has an idea of where the problem is. I didn't generate the covariance matrix myself, it was provided by the author of the original regression that I am simulating coefficients for. I don't know if something is wrong with my code, the matrix, or if Stata is just reading something wrong. I appreciate any insights anyone can provide. Thanks.
I am currently trying to run a Monte-Carlo analysis on a meta-dataset to calculate standard errors after creating simulated coefficients. My drawnorm code has been working on all (~600) observations in my dataset except for two. For these two observations, I get error r(506) - matrix not positive (semi)definite. I can't figure out quite what the problem is. I have almost no experience with matrix math, so I'm hoping someone here can help me troubleshoot the problem.
Code:
drawnorm "`coef_list'", means(m) cov(`cov_mat') cstorage(full)
the means matrix `m' :
Code:
m[1,5] wq_1 wq_2 wq_3 wq_4 wq_5 r1 -.172 -.018 .022 .002 .071
Code:
wq_1 wq_2 wq_3 wq_4 wq_v5 wq_1 .001867 wq_2 -.0004 .000589 wq_3 -.00024 .0000674 .0000399 wq_4 -.000086 -9.900e-07 9.880e-07 .0000146 wq_5 -.000063 -.000014 -.000012 .0000175 .000218
Comment