Ada Ma <[email protected]> asked,
> Coming back with more questions - the estimation I did have lost of
> dropped variables, and when I tried to implement:
>
> mat se= vecdiag(cholesky(diag(vecdiag(e(V)))))'
>
> Stata replies saying:
> matrix not positive definite
> r(506);
>
> How can I trim the zeros from the e(b) and e(V) matrices before I
> perform the commands posted by Maarten?
vecdiag(cholesky(diag(vecdiag(e(V)))))' is hardly an efficient way of
calculating the square roots of the diagonal elements of e(V), but I
understand why, using the old matrix language, Ada wrote it that way.
Putting aside efficiency, I do not think Ada really wants to drop rows
and columns from e(V) because, if she does that, she will no longer know
which standard error goes with which variable.
I suggest that, in Mata,
: sqrt(diagonal(st_matrix("e(V)")))
is what is desired, so rather than coding
. mat se= vecdiag(cholesky(diag(vecdiag(e(V)))))'
I would code
. mata: st_matrix(se, sqrt(diagonal(st_matrix("e(V)"))))
Mata's sqrt() function does an element-by-element squareroot.
-- Bill
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/