# st: Efficient way to solve for coefficents and standard errors ?

 From Thomas Cornelißen To Subject st: Efficient way to solve for coefficents and standard errors ? Date Fri, 25 Nov 2005 17:32:16 +0100

Dear all,
I want to implement a regression routine in Mata in order to use a large data set.
I have set up the system of moment equations
A*beta = B
I need to solve for beta and I need the covariance matrix of beta given by Cov(beta)=A^(-1)*(u'u)/(n-k). I want to get its diagonal elements and I am not interested in the off-diagonal elements.

Because I am concerned by memory and time restrictions I am looking for the most efficient way to solve for beta and for the standard errors.
I have considered:

Way 1: Solve for beta -cholsolve(A,B)- and then obtain A^(-1) by -cholinv(A)-
I am troubled by the fact that I am so-to-speak inverting A twice (i.e. using the solver twice). Isn't that inefficient?

Way 2: Invert A^(-1) by -cholinv(A)- and get beta by -quadcross(A^(-1), B)-
I wonder whether the additional cross product might induce numerical imprecisions, that I could possibly avoid by using way 1 to solve for beta.

Or is there a differen alternative based on the fact Given that I am only interested in the diagonal elements of A^(-1)? Is there a more time and memory saving way to ompute the standard errors, than inverting the whole A matrix?

Thanks for any remarks!
Best,
Thomas

-------------------------------------------------------------------------
Institut für Quantitative Wirtschaftsforschung
Universität Hannover
Königsworther Platz 1
30167 Hannover

Tel.: +49-(0)511-762 5661
*
* 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/