[Returnanalytics-commits] r3808 - pkg/Dowd/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 13 13:40:40 CEST 2015
Author: dacharya
Date: 2015-07-13 13:40:40 +0200 (Mon, 13 Jul 2015)
New Revision: 3808
Modified:
pkg/Dowd/R/LogtVaRPlot2DCL.R
Log:
Minor mistakes in documentation.
Modified: pkg/Dowd/R/LogtVaRPlot2DCL.R
===================================================================
--- pkg/Dowd/R/LogtVaRPlot2DCL.R 2015-07-13 11:39:19 UTC (rev 3807)
+++ pkg/Dowd/R/LogtVaRPlot2DCL.R 2015-07-13 11:40:40 UTC (rev 3808)
@@ -32,6 +32,7 @@
#'
#' @export
LogtVaRPlot2DCL <- function(...){
+ # Determine if there are four or five arguments, and ensure that arguments are read as intended
if (nargs() < 5) {
stop("Too few arguments")
}
@@ -98,10 +99,12 @@
stop("Confidence level(s) must be greater than 0")
}
if (min(hp) <= 0){
- stop("Confidence level(s) must be greater than 0")
+ stop("Holding period(s) must be greater than 0")
}
- # VaR estimation
- VaR <- investment - exp(((df-2)/df)*sigma[1,1] * sqrt(hp[1,1]) * qt(1 - cl, df)+mu[1,1]*hp[1,1]*matrix(1,cl.col,cl.row) + log(investment)
+ # VaR estimation
+ cl.row <- dim(cl)[1]
+ cl.col <- dim(cl)[2]
+ VaR <- investment - exp(((df-2)/df)*sigma[1,1] * sqrt(hp[1,1]) * qt(1 - cl, df)+mu[1,1]*hp[1,1]*matrix(1,cl.row,cl.col) + log(investment)
) # VaR
# Plotting
plot(cl, VaR, type = "l", xlab = "Confidence Level", ylab = "VaR")
More information about the Returnanalytics-commits
mailing list