[Returnanalytics-commits] r3651 - in pkg/Dowd: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 27 17:41:44 CEST 2015


Author: dacharya
Date: 2015-05-27 17:41:43 +0200 (Wed, 27 May 2015)
New Revision: 3651

Added:
   pkg/Dowd/R/BlancoIhleBacktest.R
   pkg/Dowd/man/BlancoIhleBacktest.Rd
Modified:
   pkg/Dowd/NAMESPACE
Log:
BlancoIhleBacktest: source and documentation.

Modified: pkg/Dowd/NAMESPACE
===================================================================
--- pkg/Dowd/NAMESPACE	2015-05-26 19:53:32 UTC (rev 3650)
+++ pkg/Dowd/NAMESPACE	2015-05-27 15:41:43 UTC (rev 3651)
@@ -2,6 +2,9 @@
 
 export(ADTestStat)
 export(BinomialBacktest)
+export(BlancoIhleBacktest)
+export(ChristoffersenBacktestForUnconditionalCoverage)
 export(JarqueBeraBacktest)
 export(KSTestStat)
 export(KuiperTestStat)
+export(LopezBacktest)

Added: pkg/Dowd/R/BlancoIhleBacktest.R
===================================================================
--- pkg/Dowd/R/BlancoIhleBacktest.R	                        (rev 0)
+++ pkg/Dowd/R/BlancoIhleBacktest.R	2015-05-27 15:41:43 UTC (rev 3651)
@@ -0,0 +1,40 @@
+#' Blanco-Ihle forecast evaluation backtest measure
+#'
+#' Derives the Blanco-Ihle forecast evaluation loss measure for a VaR
+#' risk measurement model.
+#' 
+#' @param Ra Vector of a portfolio profit and loss
+#' @param Rb Vector of corresponding VaR forecasts
+#' @param Rc Vector of corresponding Expected Tailed Loss forecasts
+#' @param cl VaR confidence interval
+#' @return Something
+#' 
+#' @references Dowd, Kevin. Measuring Market Risk, Wiley, 2007.
+#' 
+#' Blanco, C. and Ihle, G. How Good is Your Var? Using Backtesting to Assess
+#' System Performance. Financial Engineering News, 1999.
+#' 
+#' @author Dinesh Acharya
+#' @examples
+#' 			# To be added
+#'
+#' @export
+BlancoIhleBacktest <- function(Ra, Rb, Rc, cl){
+  
+  profit.loss <- as.vector(Ra)
+  VaR <- as.vector(Rb)
+  ETL <- as.vector(Rc)
+  
+  n <- length(profit.loss)
+  p <- 1-cl
+  excess.loss <- -profit.loss(-profit.loss>VaR) # Derives excess loss
+  benchmark <- double(length(excess_loss))
+  
+  for (i in 1:length(excess_loss)){
+	benchmark[i] <- (ETL[i]-VaR[i])/Var[i]
+	score[i] <- (excess.loss[i]-VaR[i])/VaR[i]-benchmark[i]
+  }
+  
+  # First Blanco-Ihle score measure
+  return((2/n)*sum(score)^2)
+}
\ No newline at end of file

Added: pkg/Dowd/man/BlancoIhleBacktest.Rd
===================================================================
--- pkg/Dowd/man/BlancoIhleBacktest.Rd	                        (rev 0)
+++ pkg/Dowd/man/BlancoIhleBacktest.Rd	2015-05-27 15:41:43 UTC (rev 3651)
@@ -0,0 +1,59 @@
+% Generated by roxygen2 (4.1.1): do not edit by hand
+% Please edit documentation in R/BlancoIhleBacktest.R, R/ChristoffersenBacktestForIndependence.R
+\name{BlancoIhleBacktest}
+\alias{BlancoIhleBacktest}
+\title{Blanco-Ihle forecast evaluation backtest measure}
+\usage{
+BlancoIhleBacktest(Ra, Rb, cl)
+
+BlancoIhleBacktest(Ra, Rb, cl)
+}
+\arguments{
+\item{Ra}{Vector of a portfolio profit and loss}
+
+\item{Rb}{Vector of corresponding VaR forecasts}
+
+\item{cl}{VaR confidence interval}
+
+\item{Rc}{Vector of corresponding Expected Tailed Loss forecasts}
+
+\item{Ra}{Vector of portfolio profit and loss observations}
+
+\item{Rb}{Vector of corresponding VaR forecasts}
+
+\item{cl}{Confidence interval for}
+}
+\value{
+Something
+
+Probability that given the data set, the null hypothesis
+(i.e. independence) is correct.
+}
+\description{
+Derives the Blanco-Ihle forecast evaluation loss measure for a VaR
+risk measurement model.
+
+Carries out the Christoffersen backtest of independence for a VaR risk
+measurement model, for specified VaR confidence level.
+}
+\examples{
+# To be added
+# To be added
+}
+\author{
+Dinesh Acharya
+
+Dinesh Acharya
+}
+\references{
+Dowd, Kevin. Measuring Market Risk, Wiley, 2007.
+
+Blanco, C. and Ihle, G. How Good is Your Var? Using Backtesting to Assess
+System Performance. Financial Engineering News, 1999.
+
+Dowd, K. Measuring Market Risk, Wiley, 2007.
+
+Christoffersen, P. Evaluating Interval Forecasts. International Economic
+Review, 39(4), 1992, 841-862.
+}
+



More information about the Returnanalytics-commits mailing list