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, 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 <>
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 <> 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:
<>. The reason
why I prefer this is that it does not destroy any information in my

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
*   For searches and help try:

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