Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: Using "makematrix" with "logistic"


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: Using "makematrix" with "logistic"
Date   Mon, 1 Sep 2003 14:08:42 +0100

[email protected]

> My thanks to Nick Cox for his response and I apologise if
> my message was
> confusing.  To further clarify my query, and taking an
> example below,
> "logistic" produces an output as follows:
>
> . xi:logistic lbw i.stunt3
> i.stunt3          _Istunt3_0-1        (naturally coded;
> _Istunt3_0 omitted)
> Logistic regression                               Number of obs   =
> 734
>                                                   LR chi2(1)      =
> 56.00
>                                                   Prob > chi2     =
> 0.0000
> Log likelihood = -469.55293                       Pseudo R2       =
> 0.0563
> ------------------------------------------------------------
> ----------------
> --
>          lbw | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -------------+----------------------------------------------
> ----------------
> --
>   _Istunt3_1 |   8.656607   2.938012     6.36   0.000     4.450961
> 16.8361
> ------------------------------------------------------------
> ----------------
> --
>
>
> My query is just as "mlfit" leaves behind "S_E_aic and S_E_sc", does
> "logistic" leave behind any global macros (perhaps prefixed
> by "S_E_") that
> hold the outputs "Odds Ratio z P>|z|  [95% Conf. Interval]"
>  and may replace
> (???) in the "makematrix" command line (step 2 below).
>
> 1. 	create a do-file  saved as "mydo1.do" containing one
> command line
> 		xi : logistic lbw i.`1'
>
> 2. 	run the command line
>  	  	makematrix, from(???): "run D:\mydo1" stunt3
> stunt6 stunt12
>
>
> Otherwise, I can always settle for editing the outputs
> after running a
> series of logistic models.

The globals which -logistic- leaves behind can
be seen by typing

. macro list

afterwards, and the e-class results can be seen
by typing

. ereturn list

afterwards. Now Amani wants some stuff from the body of
the estimates table, which has a row for each covariate.

As far as I can see,

either -logistic doesn't leave that stuff behind,

or it leaves it behind in a way that -makematrix-
as implemented at present cannot pick up.

For example, you can re-calculate the z-value
associated with _Istunt3_1 as _b[_Istunt3_1]/
_se[_Istunt3_1].

For -makematrix- to be able to pick that up
would require much, much fuller code than
it includes. This is partly, but not only,
because it

	prepares, in advance, a matrix

and then

	populates that matrix by cycling over
	rows and columns.

In addition, it is a rather general program,
and the way that generality is achieved is
by assuming, or knowing, as little as possible
(i.e. nothing) about the details of any program
it runs.

Amani's case is especially difficult, as -makematrix-
would need to be able to deduce from the input
specification

xi:logistic lbw i.stunt3

that it needs to pick up stuff for _Istunt3_1.
How could it do that? Only by building in
a lot of the logic of -xi-, and that would be
a major undertaking. (In addition, how many
indicators there are to deal with is a property
of the dataset.)

In other words, -makematrix- is essentially
a prospective command. Its use depends on -makematrix-
being able to look ahead and predict precisely what
form the output will take. It also depends on
stuff being left behind as globals, or r-class
results, or e-class results, or _b[varname],
or _se[varname]. That's all it can do, and
this doesn't help here.

Nick
[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/



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