Skip to content

Instantly share code, notes, and snippets.

@shabbychef
Created January 27, 2019 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shabbychef/cbada3037656a6591c89d1a81f4510f2 to your computer and use it in GitHub Desktop.
Save shabbychef/cbada3037656a6591c89d1a81f4510f2 to your computer and use it in GitHub Desktop.
this causes segfaults for fromo. sad.
library(fromo)
set.seed(1234)
nel <- 20
xna <- rnorm(nel)
xna[xna < -0.5] <- NA
xall <- list(rnorm(nel),
xna,
as.integer(rnorm(nel,sd=100)))
wna <- runif(nel,min=1,max=3)
wna[wna < 1.5] <- NA
wall <- list(rep(1.0,nel),
runif(nel,min=0.9,max=3.5),
wna,
NULL)
ptiles <- c(0.1,0.25,0.5,0.75,0.9)
for (thingy in xall) {
for (wts in wall) {
for (window in c(5,21,Inf,NULL)) {
for (na_rm in c(FALSE,TRUE)) {
running_sum(thingy,wts=wts,window=window,restart_period=2L,na_rm=na_rm)
running_sum(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_mean(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_sd(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_skew(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_kurt(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_sd3(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_skew4(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_kurt5(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
for (mol in c(1L,2L,5L)) {
running_cent_moments(thingy,wts=wts,max_order=mol,window=window,restart_period=50L,na_rm=na_rm)
running_cent_moments(thingy,wts=wts,max_order=mol,window=window,restart_period=50L,na_rm=na_rm,max_order_only=TRUE)
}
running_std_moments(thingy,wts=wts,max_order=5L,window=window,restart_period=50L,na_rm=na_rm)
running_cumulants(thingy,wts=wts,max_order=5L,window=window,restart_period=50L,na_rm=na_rm)
running_apx_quantiles(thingy,wts=wts,p=ptiles,max_order=5L,window=window,restart_period=50L,na_rm=na_rm)
running_apx_median(thingy,wts=wts,max_order=5L,window=window,restart_period=50L,na_rm=na_rm)
running_centered(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
for (lookahead in c(0,8)) {
running_centered(thingy,wts=wts,window=window,restart_period=50L,lookahead=lookahead,na_rm=na_rm)
running_scaled(thingy,wts=wts,window=window,restart_period=50L,lookahead=lookahead,na_rm=na_rm)
running_zscored(thingy,wts=wts,window=window,restart_period=50L,lookahead=lookahead,na_rm=na_rm)
}
running_sharpe(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
running_sharpe(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm,compute_se=TRUE)
running_tstat(thingy,wts=wts,window=window,restart_period=50L,na_rm=na_rm)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment