Statalist The Stata Listserver


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

Re: st: RE: tabstatmat - too many literals r(130);


From   "Ada Ma" <[email protected]>
To   [email protected]
Subject   Re: st: RE: tabstatmat - too many literals r(130);
Date   Thu, 18 May 2006 20:39:28 +0100

Hi Nick,

Thanks for the detailed reply. I was trying to calculate K adjustment
for effect coded dummy variables using Kennedy's recommended
adjustment (Rev of Econ and Stat, 1986, pp.174-5).  The weighted
approach is not supported in -xi3- and -devcon- (at least not that I'm
aware of).  Therefore I was fiddling around trying to figure out how
to do it and then I ran into the -tabstat- and your creation
-tabstatmat-.  Now that you have reminded me that extracting the
matrices is perhaps not the best way to go forward, I thought about it
again and decided to use -preserve- calculate the K using sum, etc.,
and restoring the data to run more estimations.

Thanks for your help!
Cheers,
Ada


On 5/18/06, Nick Cox <[email protected]> wrote:
You are right. -tabstatmat- can trigger this official limit
of Stata.

But your question exposes what you are doing. You are in
effect asking -tabstat- to produce 303 matrices (perhaps
more, depending on details) and then using -tabstatmat- as a
clean-up program to put them all together again. That asking
may not be conscious, because the operations are hidden in
the code. But there should be another way of getting where
you want to be more directly.

I could, no doubt should, work at -tabstatmat- to see if
this limit can be overcome. I suspect it can, but in the
first instance let us see whether there are other tools for
what you want.

-tabstat- is in essence a tabulation program and an
excellent one. I use it a lot. However, only rather
awkwardly does it serve as a data reduction program. A data
reduction program I define as one that maps some or all of
your dataset to a new dataset that you want to manipulate in
turn. -collapse- and -contract- are examples. The main
reason for saying that about -tabstat- flows from its being
sufficiently general to produce not just tables that are
equivalent to matrices, strict sense, but also tables that
are sets of matrices. So, its returned objects are set up to
match this generality. It leaves behind a set of matrices.

-tabstatmat- arose as a response to a Statalist question
from Friedrich Huebler who wanted to put together the
returned objects.  I posted a program to do it. But it's
written in the spirit of "If you find yourself in the middle
of a bog, here is a way out." Other advice might be "Don't
wander into the middle of a bog. Keep to dry ground!" I use
-tabstatmat- myself largely when I am fixing its bugs that
users have found.

More prosaically, and more generally:

You want a matrix. Why? Is it because you want do something
with it that depends on it being a matrix, such as adding it
to another matrix, or getting some eigenvalues? Or is the
matrix just a means to an end, such as exporting a reduced
dataset to other software?

If you want a matrix of descriptive statistics, qua matrix,
there are plenty of other programs designed to do that
directly. One example is -statsmat- from SSC.

If you want an output dataset, or an output table, then
again there are better programs for that, such as
-collapse-, -contract-, -tabout- from SSC or even
-tabexport- from SSC.

More advice depends on more details.

Nick
[email protected]

Ada Ma

> Hello Statalist (and Nick Cox in particular being the author
> of tabstatmat),
>
> I tried to save the results of tabstat in a matrix using tabstatmat.
> However it seems like the table I made got too many rows (303 in my
> case), and I ran into the too many parantheses error (255 is the max
> according to the error code).
>
> What would you recommend me to do in this case?  I think I can do the
> tabstat by the 100's, and then stack the matrices.  Is there any thing
> else you'd recommend?

*
*   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/


--
Ada Ma
Research Fellow
Health Economics Research Unit
University of Aberdeen, UK.
http://www.abdn.ac.uk/heru/
Tel: +44 (0) 1224 553863
Fax: +44 (0) 1224 550926

*
*   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