Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: How to find extreme values


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to find extreme values
Date   Tue, 27 Mar 2012 09:27:07 +0200

On Tue, Mar 27, 2012 at 5:24 AM, Barth Riley <barthriley@comcast.net> wrote:
> To remove outliers, you could:
>
> preserve
> replace var = . if abs(var) >= 1000000 (or some other value)
> [perform analyses]
> restore
>
> preserve and restore are added if you want to make a temporary change to
> these values

If I were to exclude such observations I would probably do something like:

gen byte touse = abs(var) <= 1e6
reg y var x if touse

-reg- could be any command, the key is the -if touse- part. The
variable touse will contain 0s and 1s such that those non-extreme
values get 1 (true) and the extreme values get 0 (false), see:
<http://www.stata.com/support/faqs/data/trueorfalse.html>. The reason
why I prefer this is that it does not destroy any information in my
dataset.

Hope this helps,
Maarten


--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index