Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Winsor by group

From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Winsor by group
Date   Mon, 2 Aug 2004 16:39:20 +0100

-winsor- doesn't support a -by()- option or -by:-. 

Your options include rewriting it so that it does, 



gen winsor = . 
su year, meanonly 
qui forval y = `r(min)'/`r(max)' { 
	winsor response if year == `y', <winsor_options> gen(temp) 
	replace winsor = temp if year == `y' 
	drop temp 
[email protected] 

Neil Shephard replied to KK 

> > I am working with a time series and interested in winsorizing a
> > variable by year.  What is the easiest way to do this?  Thanks, KK
> > 
> .findit winsor
> suggests that you might want to try installing and using the 
> -winsor- command.
>       winsor takes the non-missing values of a variable and 
> generates a
>       new variable  identical except that the h highest and h lowest
>       values are replaced by the  next value counting inwards from the
>       extremes. h can be specified directly or  indirectly by
>       specifying a fraction p of the number of observations: h =  [p
>       n]. This transformation is named after the biostatistician C.P.
>       Winsor. This is version 1.3.0 of  the software.

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index