[Returnanalytics-commits] r3810 - pkg/Dowd/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 13 13:41:20 CEST 2015
Author: dacharya
Date: 2015-07-13 13:41:19 +0200 (Mon, 13 Jul 2015)
New Revision: 3810
Modified:
pkg/Dowd/R/LogtVaRPlot2DHP.R
Log:
Minor mistakes in documentation corrected.
Modified: pkg/Dowd/R/LogtVaRPlot2DHP.R
===================================================================
--- pkg/Dowd/R/LogtVaRPlot2DHP.R 2015-07-13 11:40:58 UTC (rev 3809)
+++ pkg/Dowd/R/LogtVaRPlot2DHP.R 2015-07-13 11:41:19 UTC (rev 3810)
@@ -100,10 +100,13 @@
stop("Confidence level(s) must be greater than 0")
}
# VaR estimation
+ cl.row <- dim(cl)[1]
+ cl.col <- dim(cl)[2]
VaR <- investment - exp(((df - 2) / df) * sigma[1,1] * sqrt(t(hp)) * qt(1 - cl[1,1], df)
+ mu[1,1] * t(hp) %*% matrix(1, cl.row, cl.col) + log(investment)) # VaR
# Plotting
plot(hp, VaR, type = "l", xlab = "Holding Period", ylab = "VaR")
+ cl.label <- 100 * cl[1,1]
title("Log-t VaR against holding period")
xmin <-min(hp)+.25*(max(hp)-min(hp))
text(xmin,max(VaR)-.1*(max(VaR)-min(VaR)),
@@ -117,5 +120,5 @@
text(xmin,max(VaR)-.3*(max(VaR)-min(VaR)),
paste('Investment size = ',investment),cex=.75)
text(xmin,max(VaR)-.35*(max(VaR)-min(VaR)),
- paste('Confidence level = ',cl,'%'),cex=.75)
+ paste('Confidence level = ',cl.label,'%'),cex=.75)
}
More information about the Returnanalytics-commits
mailing list