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

RE: st: Statsby and weights


From   Roger Newson <[email protected]>
To   [email protected]
Subject   RE: st: Statsby and weights
Date   Thu, 25 Mar 2004 21:19:45 +0000

At 19:28 25/03/04 +0000, Nick Cox wrote(in reply to Jeff Pitblado's reply to Dale Plummer):

In the case of frequency weights, a prior
=expand- is presumably another possibility.
Of course, this changes your dataset, but
since -statsby- is going to change it too, that
itself is secondary. More importantly, the
dataset might become very large; and even
more importantly, this technique doesn't
help with non-frequency weights. I guess
Jeff may be able to think of other disadvantages.
I think I now know why I wasn't tempted to introduce a "parsing engine" for -parmby-, which is like -statsby-, but only works with estimation commands, and generates an output data set with one observation per parameter per by-group, instead of an output data set with one observation per by-group.

One price of not using a parsing engine is that occurrences of _n and _N, in expressions passed to the command, are interpreted in terms of the order of an observation within its by-group, not in terms of the order of the observation in the whole data set. However, I don't know if that is a good thing or a bad thing, and StataCorp didn't seem too sure either when I raised this issue on Statalist on 5 August 2003. (My email is on the public archive at

http://www.stata.com/statalist/archive/2003-08/msg00065.html

and Ken Higbee later replied to me privately on 13 August 2003, but, understandably, such a minor issue seemed to get deprioritised, with the result that I still do not know the party line on _n, _N and by-groups.)

Best wishes

Roger

PS The -parmby- command is part of the -parmest- package, downloadable from SSC.



> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of
> Jeff Pitblado,
> StataCorp LP
> Sent: 25 March 2004 19:08
> To: [email protected]
> Subject: Re: st: Statsby and weights
>
>
>
> Dale Plummer <[email protected]> asks about using
> weights with
> -statsby-:
>
> > I may have overlooked something obvious, but I cannot see why the
> > statsby command will not allow weights in the commands it
> is executing.
> > Would someone please explain this?
>
> There really isn't a good reason for this.  From a
> development point of view,
> -statsby- uses the same parsing engine as -bootstrap-,
> -jknife-, -simulate-,
> and -permute-; some of which require careful consideration
> (and new code) to
> handle weights.
>
> There are ways around this.  The long way is to set up
> -postfile- and use
> -post- within a -forvalues- loop.  This requires a decent
> amount of coding to
> reproduce some of the features of -statsby-.
>
> The short way, involves tricking -statsby-.  I generally
> would warn users
> against trying to "trick" a command to do something that a
> developer purposely
> tried to prevent, but this is one of those special cases.
>

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

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://www.kcl-phs.org.uk/rogernewson

Opinions expressed are those of the author, not the institution.

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