[prev in list] [next in list] [prev in thread] [next in thread]
List: r-sig-finance
Subject: [R-SIG-Finance] VaR calculation produces unreliable result
From: Daniel Liebert <liebert.daniel () googlemail ! com>
Date: 2013-07-07 0:58:47
Message-ID: CANFB4-YsrpQw=ceRkf8jRgqnnbwcBXU6bgy5-W9Qy0vjQTMraw () mail ! gmail ! com
[Download RAW message or body]
Hi everyone,
Iam trying to calculate the modified Value at Risk with a rolling
estimation window (502) and alpha=0.4 and get the following error:
VaR calculation produces unreliable result (inverse risk) for column: 1 :
and so forth...
VaR calculations (rolling) with method=normal and method=historical dont
show any error message. Therfore Iam a little bit confused. I hope that
somebody can give me a hint.
Here is my code:
require(quantmod)
require(PerformanceAnalytics)
getSymbols("MMM", from = "2005-01-01", to = "2013-05-31")
mmm<-Ad(MMM)
mmm_ldr <- Return.calculate(mmm, method = "log")
mmm_ldr <- na.omit(mmm_ldr)
n_all = nrow(mmm_ldr)
n_test <- nrow(as.xts(mmm_ldr)["2007-01-04/2013-05-31"]) # testing window
n_est <- n_all - n_test
VaR_60_roll_mmm = rollapply(as.zoo(mmm_ldr), width = n_est,
FUN = VaR, p=0.60,
method="modified", by.column = TRUE,
align = "right")
Thanks
Daniel
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-Finance@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic