Bookmark and Share

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

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

Re: st: technical question on the removal of outliers

From   Eric Booth <>
To   "<>" <>
Subject   Re: st: technical question on the removal of outliers
Date   Sat, 26 Feb 2011 22:12:53 +0000


You could drop these obs using the loop below, but instead of dumping observations where some value is in the p1 or p99, how about just flagging them for exclusion in the regression?  
Also, there are better methods for investigating outliers than just dropping any value in p1 or p99, here's a good starting place:  

sysuse census, clear
unab iv_list :  pop*  medage death marriage
reg divorce `iv_list'
est sto one

***flag p1 or p99 obs.
g flag = .
foreach v in `iv_list' {
	qui su `v', d
	**you could change the line below to -drop-**
	replace flag = 1 if `v'<=r(p1) | `v'>=r(p99)

**reg w/o p1 or p99 obs.
reg divorce `iv_list' if flag!=1

est sto two
est table one two, b(%7.4f) se stats(N r2)

- Eric
Eric A. Booth
Public Policy Research Institute
Texas A&M University
Office: +979.845.6754

On Feb 26, 2011, at 3:26 PM, <>

> Dear all, 
> is there a possibility to remove outliers in the highest 99th and lowest 1st 
> percentile in stata before running regressions? I proceed currently by using 
> sum, varlist, det after which I manually drop these observations. 
> However it is rather time consuming when one needs to run a lot of regressions. 
> I would be glad if you could share such stata command with me. 
> Best,
> Rado
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

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