R/jSmallerVaRCount.R

jSmallerVaRCount <-
function(s,VaR){
n <- length(s)
v <- c()
j <- 1
for (i in 1:n) {
if (s[i] <= -VaR) {
v[j] <- i
j <- j + 1
}
}
k <- length(v)
for (i in k:2) {
v[i] <- v[i] - v[i-1]
}
return(v)
}

Try the jvnVaR package in your browser

Any scripts or data that you put into this service are public.

jvnVaR documentation built on May 1, 2019, 8:29 p.m.