search for: ind1year2000winsor

Displaying 1 result from an estimated 1 matches for "ind1year2000winsor".

2010 Aug 01
3
remove extreme values or winsorize – loop - dataframe
...ear1999$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=ifelse(X1<q1,q1,ifelse(X1>q99,q99,X1))) I repeat this for all years and industries, and then I merge/bind all again to have a new dataframe with all the columns of the dataframe ?data? plus X2. Could anyone help me doing this in a easier way? Thanks Cec?...