mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-11-29 00:15:11 +00:00
M3: add statistical/tests.R
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
args <- commandArgs(trailingOnly=FALSE); f <- sub("^--file=", "", args[grep("^--file=", args)])
|
||||
source(file.path(dirname(normalizePath(f)), "engine.R"))
|
||||
x <- gbm_terminal(100,0.05,0.2,1/252,252,20000,7)
|
||||
expected <- 100*exp(0.05)
|
||||
stopifnot(abs(mean(x)-expected)/expected < 0.02)
|
||||
j <- merton_terminal(100,0.05,0.15,2,-0.08,0.15,1/252,252,10000,9)
|
||||
kurtosis <- mean((j-mean(j))^4)/(var(j)^2)
|
||||
stopifnot(kurtosis > 3)
|
||||
h <- heston_terminal(100,0.04,0.03,2,0.04,0.3,-0.6,1/252,252,5000,3)
|
||||
stopifnot(all(h > 0))
|
||||
set.seed(12)
|
||||
r <- c(rnorm(100,0,.01), rnorm(100,0,.05)); fit <- garch11_fit(r)
|
||||
stopifnot(fit$alpha >= 0, fit$beta >= 0, fit$alpha+fit$beta < 1)
|
||||
p <- bounded_price_prediction(100,.03,.2,1/365,30,5000,4,"30d","TEST")
|
||||
stopifnot(p$lower_bound <= p$value, p$value <= p$upper_bound)
|
||||
cat("STATISTICAL TESTS PASSED\n")
|
||||
Reference in New Issue
Block a user