Sorry but I still can't get this to work. I tried using a stata dataset as a test. I used
use http://fmwww.bc.edu/ec-p/data/macro/abdata.dta
After the forval, I get an error message 0 values to be winsorized. I tried creating a local variable for max and min year and a few other things but for some reason, it still isn't working. What would the syntax be for this dataset? Thanks a bunch, KK
-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: Mon 08/02/2004 11:39
To: [email protected]
Cc:
Subject: RE: st: Winsor by group
-winsor- doesn't support a -by()- option or -by:-.
Your options include rewriting it so that it does,
or
(say)
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
}
Nick
[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.
>
> DESCRIPTION/AUTHOR(S)
>
> 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:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/