Statalist The Stata Listserver


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

st: Matrix manipulation of regression results


From   Herb Smith <[email protected]>
To   [email protected]
Subject   st: Matrix manipulation of regression results
Date   Tue, 2 Jan 2007 09:17:55 -0500 (EST)

The general problem:  What is the best way to access, interactively,
results from a regression (or other model?)

The specific issue:  I was preparing a handout for class.  I wanted --
don't ask me why -- to show the students how one used to do generalized
least square, before the days of weighting, proper standard errors, etc.
One transforms the data, but then the standard errors need to be divided
through by the root mean square error.  To motivate the use of matrix
operations in Stata, I wanted to do this quickly.

Mis-step 1:  Although I have already written one program using -mata- , in
which I went from "normal" Stata data to -mata- matrxies, I have not been
able to figure out how you turn a result matrix such as e(V)  into
something that you can manipulate within the -mata- language.  This must
be simple, but I have missed it in the help instructions (and was doing
all this on an airplane, far from any manuals....)

Mis-step 2:  Okay, what about using the old -matrix- commands?  When I had
a vector of coefficient variances, I could locate within -mata- a simple
command for taking element-by-element square roots, but not under the old
-matrix- commands.  I ended up turning this vector into a diagonal matrix
and getting square roots via Cholesky; but this is inelegant and hardly
the sort of thing that gets social science graduate students into using a
set of commands to do things....

	Thanks in advance, best to all for the New Year,

	--Herb

Herbert L. Smith
Professor of Sociology and
Director, Population Studies Center
230 McNeil Building
3718 Locust Walk CR
University of Pennsylvania
Philadelphia, PA  19104-6298

[email protected]

215.898.7768 (office)
215.898.2124 (fax)
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index