There any way to identify outliers using STATA?
-
Login or Register
- Log in with
set obs 100 g A=runiform() g B=runiform() g C=runiform() foreach var of varlist A-C { quietly summarize `var' g Z_`var'=1 if `var'>3*r(sd) ///the aim of Z_`var' is to detect the values beyond a threshold-value you decide to set (let's say >3 standard deviation apart)/// replace Z_`var'=0 if Z_`var'==. list `var' Z_`var' if Z_`var'==1 }
foreach var of varlist A-C { quietly summarize `var' g Z_`var'= (`var' > 3*r(sd)) if `var' < . list `var' Z_`var' if Z_`var' == 1 }
Comment