Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: how do i save the significance levels of coefficients after estimation?


From   wgould@stata.com (William Gould, Stata)
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: how do i save the significance levels of coefficients after estimation?
Date   Tue, 18 Apr 2006 12:42:43 -0500

Ada Ma <heu034@googlemail.com> 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
wgould@stata.com
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index