Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: omitting outliers


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: omitting outliers
Date   Mon, 16 Dec 2013 19:44:30 +0000

This is, in my view, a terrible view to analyse data. John Tukey used
values being more than 1.5 IQR from the nearer quartile as a rule of
thumb to identify data that should be thought about. Extending this
criterion to identify data points that should be dropped automatically
is quite extraordinary.

That aside, this won't work because Stata doesn't save results
groupwise in the way you wish.

After something based on -by:- the only results visible in memory are
those from the last group analysed. You can check -return list- to see
this is so.

My personal ethical code doesn't extend to telling you how to do what
you want to do.

Nick
[email protected]


On 16 December 2013 19:33, Selay Sahan <[email protected]> wrote:
> Dear Statalisters,
>
> In order to find and omit the outliers from the data, I used the code below:
>
>
> sort nace
> by nace: lv mpg
> by nace: keep if inrange(mpg,r(l_F)-(1.5*(r(u_F) - r(l_F))) ,r(u_F)+(1.5*(r(u_F) - r(l_F))))
>
>
> However, although Stata finds the outliers, it does not drop them from the sample.
>
> ((I tried the code with simpler data sets. It worked well, i.e. the outliers were found and dropped from the sample))
>
>
> Does anyone know why Stata does not drop the outliers although it is able to find them?
>
> What may be wrong with my data set? (The code is working, as I've said I checked it with other smaller data sets)
>
> Any help will be greatly appreciated. Thank you in advance.
>
> Selay
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index