Displaying 1 result from an estimated 1 matches for "volquintil".
Did you mean:
volquintile
2013 Apr 06
1
Creating quintiles on monthly basis
...lt;-as.vector(unique(x$DATE))
dfx<-data.frame()
for(n in seq(1,length(months))){
num<-5
print(paste("Appending month",months[n],sep=""))
df<-subset(x,DATE==months[n])
breaks<-quantile(df$VOLATILITY,probs=seq(0,1, 1/num),na.rm=TRUE)
df$volquintile <- cut(df$VOLATILITY,unique(breaks),
label=FALSE, na.rm=TRUE)
dfx<-rbind(dfx,df)
}
return(dfx)
}
Frame.Quintile <- quintilesVolByMonth(x)
Example of data: (I have 30 years of monthly data for over 1000 stocks)
Variable 'VolQuintile' is...