Last active
December 17, 2015 14:18
-
-
Save jfreels/5622926 to your computer and use it in GitHub Desktop.
Drought table example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Drought | |
### A drought is a flat period in performance. | |
### The max drought is the longest flat period in a track record. | |
### The current drought is the current flat period in a track record. | |
require(devtools) | |
install_github("r_jfreels","jfreels") | |
# load data | |
require(PerformanceAnalytics) | |
data(edhec) | |
edhec<-data.frame(date=index(edhec),coredata(edhec)) | |
edhec<-melt(edhec,id.vars='date') | |
edhec<-data.table(edhec,key=c('variable','date')) | |
# max drought table | |
jf.table.drought(edhec,type='max') | |
# current drought table | |
jf.table.drought(edhec,type='current') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment