So simple that it would be a good user-programmer
project....
I think Stata's -expand- logic -- or rather psychology -- is this:
1. The user doesn't expect -expand- to be destructive.
In fact, the user does (and should) expect
-expand- to produce a superset of the dataset,
from which the present dataset could be selected
once more if so desired.
2. -expand 0- might be interpreted very literally
as "give me _no_ copies" of this observation, meaning
do not retain it in the dataset.
What's to give here? Stata decided rule 1 overrode rule
2. Not giving users traumas overrides biting their hands
with their own logic here when the consequence could be
very serious, a fundamental law of computing notwithstanding,
namely "Your punishment is that you got what you asked for."
An extra consideration here is what to do with
. expand -1
Here the -1 lacks an interpretation.
Perhaps it means "add an imaginary copy of the
dataset, making the whole dataset complex" but Stata only works
in real dataset space as yet.
For the moment, however, zero or negative values
are ignored by -expand-.
Nick
[email protected]
Richard Williams
>
> At 12:53 PM 9/22/2004 +0100, Ron�n Conroy wrote:
> >Nick Cox wrote:
> >
> >>I can't comment on why not. I guess no one asked, or no one
> thought of
> >>doing it.
> >>For the moment,
> >>preserve expand
> >>prtest restore
> >>
> >But beware of -expand-. If an observation represents a zero
> frequency, it
> >will be retained. You will see a warning but it's a
> behaviour that you
> >might not have anticipated.
> >
> >I transcribe tables from papers that I am reviewing into
> Stata frequently,
> >to cross-check stats, and it's easy to transcribe a zero without
> >remembering that this will create a single observation in
> the expanded dataset.
>
> Thanks Nick. And good point, Ronan, I'd overlooked that
> problem, mostly
> because I don't think I've encountered it before. Another
> alternative is
> to use -prtesti-, which might be the quickest and simplest
> thing if, as you
> say, you were transcribing a table and the only thing you
> wanted to do was
> run -prtest- on it. But adding weights to -prtest- would seem like a
> simple enough thing to do.
*
* 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/