Displaying 1 result from an estimated 1 matches for "winzorise".
Did you mean:
winsorize
2009 Jan 16
2
Winsorizing Multiple Variables
...th(x)
ibot<-floor(tr*n)+1
itop<-length(x)-ibot+1
xbot<-y[ibot]
xtop<-y[itop]
y<-ifelse(y<=xbot,xbot,y)
y<-ifelse(y>=xtop,xtop,y)
win<-y
win
}
#Produces an example data frame, ss is the observation id, vars 1-5
are the variables I want to winzorise.
ss
=
c
(1
:
5
);var1
=
rnorm
(5
);var2
=
rnorm
(5
);var3
=rnorm(5);var4=rnorm(5);as.data.frame(cbind(ss,var1,var2,var3,var4))-
>data
data
#Winsorizes each variable, but sorts them independently so the
observations no longer line up.
sapply(data,win)
_____________________...