Displaying 1 result from an estimated 1 matches for "ind1year1999winsorized".
2010 Aug 01
3
remove extreme values or winsorize – loop - dataframe
...nd year I calculate
the 10% and 90% quantiles, then I create a X2 variable
like this:
industry1<-subset(data,data$industry==1)
ind1year1999<-subset(industry1,industry1$year==1999)
q1<-quantile(ind1year1999$X1,probs=0.1,na.rm=TRUE)
q99<-quantile(ind1year1999$X1,probs=0.90,na.rm=TRUE)
ind1year1999winsorized<-transform(ind1year1999,X2=ifelse(X1<q1,q1,ifelse(X1>q99,q99,X1)))
ind1year2000<-subset(industry1,industry1$year==2000)
q1<-quantile(ind1year2000$X1,probs=0.1,na.rm=TRUE)
q99<-quantile(ind1year2000$X1,probs=0.90,na.rm=TRUE)
ind1year2000winsorized<-transform(ind1year2000,X2=ife...