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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: resticting the sample? |

Date |
Thu, 7 Oct 2004 10:52:04 +0100 |

I haven't got any gun in my hand, but I'm not clear that we need this syntax. Are you asking for what can be done by ... if !inlist(_n,10,100,250) If that gets tedious, a macro assignment cuts the typing local outliers "inlist(_n,10,100,250)" regress <whatever> if !`outliers' Note that this could bite you. Sort the data and the observation numbers refer to different observations, but then -suspendin()- as I understand it suffers from exactly the same problem. So I go back to my earlier suggestion to -generate- an in-sample indicate variable, or the other suggestions made. See also -inrange()-. Nick n.j.cox@durham.ac.uk Clive Nicholas > Dimitriy V. Masterov replied to Shuaizhang Feng: > > > Your can use preserve/restore to do this: > > > preserve > > keep if age<40 > > reg .... > > restore > > And Nick Cox replied to Shuaizhang Feng with: > > > gen mysample = (age < 40) & (nobel_prize == 1) & > (extrasensoryperception > > == 1) > > > > ... > > > > reg ... if mysample > > > > See also http://www.stata.com/support/faqs/data/trueorfalse.html > > Running regressions using restricted samples (or by leaving out > disqualifying observations) is something I've been really > keen to do for > quite some time. But solutions such as the ones above seem to > be the only > ones available (but that doesn't mean to say that they're bad). > > I'm not really one for adding to StataCorp's burden, for they probably > have enough to do in preparing for version 9. But wouldn't it > be great if > one could run a regression in the following way: > > . reg tomatoes potatoes onions sausages, suspendin(10 100 250) > > so that you could simply suspend the observations without > having to -drop- > them for that regression and then have to -restore- the dataset > afterwards? Desirably, this option would automatically pick up the > observation numbers as they appear by row in the data editor. > > No doubt this idea will be shot down in myriad ways and > people would say > that it couldn't work. But, to quote the British comedy duo > Armstrong and > Miller, "Yes, but it would be good if it did." > > CLIVE NICHOLAS |t: 0(044)191 222 5969 > Politics |e: clive.nicholas@ncl.ac.uk > Newcastle University |http://www.ncl.ac.uk/geps > * > * 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/ > * * 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/

**Follow-Ups**:**RE: st: RE: resticting the sample?***From:*"Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>

**Re: st: RE: resticting the sample?***From:*Daniel Egan <dp.egan@gmail.com>

- Prev by Date:
**Re: st: survival analysis vs ols** - Next by Date:
**st: RE: Sqaure root** - Previous by thread:
**Re: st: RE: resticting the sample?** - Next by thread:
**Re: st: RE: resticting the sample?** - Index(es):

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