search for: x_foc

Displaying 1 result from an estimated 1 matches for "x_foc".

Did you mean: _foo
2013 Mar 04
2
R function for estimating historical-VaR
...responding to index 20 is the daily historical simulation VaR. I repeat the first step except the window changes the observations from 2 to 2001. Such a process provides 300 one-step ahead VaR. My function is: VaR_foc <- function (returns, value = 1000, p = 0.01, n=251) { T = length(returns) x_foc = vector(length=n) N = T-(n+1) m=sort(returns[1:N]) op = as.integer(N*p) # p % smallest for (i in 2:n) { g= returns[i:(N+i)] ys = sort(g) # sort returns x_foc[[1]] = -m[op]*value # VaR number x_foc[i] = -ys[op]*value } return(x_foc) } VaR_foc (returns=y_IBM) But the fucntion doesn't work...