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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jun 20 12:44:55 CEST 2015


Author: dacharya
Date: 2015-06-20 12:44:55 +0200 (Sat, 20 Jun 2015)
New Revision: 3683

Modified:
   pkg/Dowd/NAMESPACE
   pkg/Dowd/R/ADTestStat.R
   pkg/Dowd/R/AdjustedNormalESHotspots.R
   pkg/Dowd/R/AdjustedNormalVaRHotspots.R
   pkg/Dowd/R/AdjustedVarianceCovarianceVaR.R
   pkg/Dowd/R/BinomialBacktest.R
   pkg/Dowd/R/ChristoffersenBacktestForIndependence.R
   pkg/Dowd/R/FrechetVaRPlot2DCl.R
   pkg/Dowd/R/GParetoES.R
   pkg/Dowd/R/GParetoMEFPlot.R
   pkg/Dowd/R/GParetoMultipleMEFPlot.R
   pkg/Dowd/R/GumbelES.R
   pkg/Dowd/R/HSVaR.R
   pkg/Dowd/R/JarqueBeraBacktest.R
   pkg/Dowd/R/KSTestStat.R
   pkg/Dowd/R/KuiperTestStat.R
   pkg/Dowd/man/ADTestStat.Rd
   pkg/Dowd/man/AdjustedNormalESHotspots.Rd
   pkg/Dowd/man/AdjustedNormalVaRHotspots.Rd
   pkg/Dowd/man/AdjustedVarianceCovarianceVaR.Rd
   pkg/Dowd/man/BinomialBacktest.Rd
   pkg/Dowd/man/FrechetVaRPlot2DCl.Rd
   pkg/Dowd/man/GumbelES.Rd
   pkg/Dowd/man/JarqueBeraBacktest.Rd
   pkg/Dowd/man/KSTestStat.Rd
   pkg/Dowd/man/KuiperTestStat.Rd
Log:
InsuranceVaR : source and document and other minor change in documentation in others.

Modified: pkg/Dowd/NAMESPACE
===================================================================
--- pkg/Dowd/NAMESPACE	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/NAMESPACE	2015-06-20 10:44:55 UTC (rev 3683)
@@ -41,6 +41,7 @@
 export(HillEstimator)
 export(HillPlot)
 export(HillQuantileEstimator)
+export(InsuranceVaR)
 export(JarqueBeraBacktest)
 export(KSTestStat)
 export(KuiperTestStat)

Modified: pkg/Dowd/R/ADTestStat.R
===================================================================
--- pkg/Dowd/R/ADTestStat.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/ADTestStat.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -7,9 +7,9 @@
 #' which is equivalent to
 #' \deqn{=-n-\frac{1}{n}\sum_{i=1}^n(2i-1)[\ln F(X_i)+\ln(1-F(X_{n+1-i}))]}
 #' 
-#' @param number.trials 
-#' @param sample.size
-#' @param confidence.interval
+#' @param number.trials Number of trials
+#' @param sample.size Sample size
+#' @param confidence.interval Confidence Interval
 #' @return Confidence Interval for AD test statistic
 #' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
 #' 

Modified: pkg/Dowd/R/AdjustedNormalESHotspots.R
===================================================================
--- pkg/Dowd/R/AdjustedNormalESHotspots.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/AdjustedNormalESHotspots.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -12,7 +12,7 @@
 #' @param cl Confidence level and is scalar
 #' @param hp Holding period and is scalar
 #' 
-#' @references Dowd, K. Measurh  ing Market Risk, Wiley, 2007.
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
 #' 
 #' @author Dinesh Acharya
 #' 

Modified: pkg/Dowd/R/AdjustedNormalVaRHotspots.R
===================================================================
--- pkg/Dowd/R/AdjustedNormalVaRHotspots.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/AdjustedNormalVaRHotspots.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -12,7 +12,7 @@
 #' @param cl Confidence level and is scalar
 #' @param hp Holding period and is scalar
 #' 
-#' @references Dowd, K. Measurh  ing Market Risk, Wiley, 2007.
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
 #' 
 #' @author Dinesh Acharya
 #' 

Modified: pkg/Dowd/R/AdjustedVarianceCovarianceVaR.R
===================================================================
--- pkg/Dowd/R/AdjustedVarianceCovarianceVaR.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/AdjustedVarianceCovarianceVaR.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -10,7 +10,7 @@
 #' @param cl Confidence level and is scalar or vector
 #' @param hp Holding period and is scalar or vector
 #' 
-#' @references Dowd, K. Measurh  ing Market Risk, Wiley, 2007.
+#' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
 #' 
 #' @author Dinesh Acharya
 #' 

Modified: pkg/Dowd/R/BinomialBacktest.R
===================================================================
--- pkg/Dowd/R/BinomialBacktest.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/BinomialBacktest.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -21,7 +21,7 @@
 #' @examples
 #' 
 #'    # Probability that the VaR model is correct for 3 failures, 100 number
-#'    observations and  95% confidence level
+#'    # observations and  95% confidence level
 #'    BinomialBacktest(55, 1000, 0.95)
 #'
 #' @export

Modified: pkg/Dowd/R/ChristoffersenBacktestForIndependence.R
===================================================================
--- pkg/Dowd/R/ChristoffersenBacktestForIndependence.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/ChristoffersenBacktestForIndependence.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -9,7 +9,6 @@
 #' @return Probability that given the data set, the null hypothesis 
 #' (i.e. independence) is correct.
 #' 
-#' 
 #' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
 #' 
 #' Christoffersen, P. Evaluating Interval Forecasts. International Economic 

Modified: pkg/Dowd/R/FrechetVaRPlot2DCl.R
===================================================================
--- pkg/Dowd/R/FrechetVaRPlot2DCl.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/FrechetVaRPlot2DCl.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -1,12 +1,11 @@
-#' @title Plots Frechet Value at Risk against Cl
+#' Plots Frechet Value at Risk against Cl
 #'
-#' @description Plots the VaR of a portfolio against confidence level assuming extreme losses
+#' Plots the VaR of a portfolio against confidence level assuming extreme losses
 #' are Frechet distributed, for specified range of confidence level and a given 
 #' holding period.
 #'
 #' Note that the long-right-hand tail is fitted to losses, not profits.
 #' 
-#'
 #' @param mu Location parameter for daily L/P
 #' @param sigma Scale parameter for daily L/P
 #' @param tail.index Tail index

Modified: pkg/Dowd/R/GParetoES.R
===================================================================
--- pkg/Dowd/R/GParetoES.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/GParetoES.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -1,6 +1,6 @@
-#' @title Expected Shortfall for Generalized Pareto
+#' Expected Shortfall for Generalized Pareto
 #'
-#' @description Estimates the ES of a portfolio assuming losses are distributed as a generalised Pareto.
+#' Estimates the ES of a portfolio assuming losses are distributed as a generalised Pareto.
 #'
 #' @param Ra Vector of daily Profit/Loss data 
 #' @param beta Assumed scale parameter

Modified: pkg/Dowd/R/GParetoMEFPlot.R
===================================================================
--- pkg/Dowd/R/GParetoMEFPlot.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/GParetoMEFPlot.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -1,6 +1,6 @@
-#' @title Plot of Emperical and Generalised Pareto mean excess functions 
+#' Plot of Emperical and Generalised Pareto mean excess functions 
 #'
-#' @description Plots of emperical mean excess function and Generalized mean excess function.
+#' Plots of emperical mean excess function and Generalized mean excess function.
 #'
 #' @param Ra Vector of daily Profit/Loss data 
 #' @param mu Location parameter

Modified: pkg/Dowd/R/GParetoMultipleMEFPlot.R
===================================================================
--- pkg/Dowd/R/GParetoMultipleMEFPlot.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/GParetoMultipleMEFPlot.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -1,6 +1,6 @@
-#' @title Plot of Emperical and 2 Generalised Pareto mean excess functions 
+#' Plot of Emperical and 2 Generalised Pareto mean excess functions 
 #'
-#' @description Plots of emperical mean excess function and two generalized pareto mean excess functions which differ in their tail-index value.
+#' Plots of emperical mean excess function and two generalized pareto mean excess functions which differ in their tail-index value.
 #'
 #' @param Ra Vector of daily Profit/Loss data 
 #' @param mu Location parameter

Modified: pkg/Dowd/R/GumbelES.R
===================================================================
--- pkg/Dowd/R/GumbelES.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/GumbelES.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -15,7 +15,8 @@
 #' 
 #' @references Dowd, K. Measuring Market Risk, Wiley, 2007.
 #' 
-#' National Institute of Standards and Technology, Dataplot Reference Manual. Volume 1: Commands. NIST: Washington, DC, 1997, p. 8-67.
+#' National Institute of Standards and Technology, Dataplot Reference Manual. 
+#' Volume 1: Commands. NIST: Washington, DC, 1997, p. 8-67.
 #' 
 #' @author Dinesh Acharya
 #' @examples

Modified: pkg/Dowd/R/HSVaR.R
===================================================================
--- pkg/Dowd/R/HSVaR.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/HSVaR.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -94,7 +94,7 @@
     if (upper.index!=lower.index){
       # Weights attached to upper and lower VaRs
       lower.weight <- (upper.index-index)/(upper.index-lower.index) # weight on upper.var
-      
+      upper.weight <- (index-lower.index)/(upper.index-lower.index) # weight on upper_var
       # Finally, the weighted, VaR as a linear interpolation of upper and lower VaRs
       
       y <- lower.weight * lower.var + upper.weight * upper.var

Modified: pkg/Dowd/R/JarqueBeraBacktest.R
===================================================================
--- pkg/Dowd/R/JarqueBeraBacktest.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/JarqueBeraBacktest.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -21,7 +21,7 @@
 #' @examples
 #' 
 #'    # JB test statistic for sample with 500 observations with sample
-#'    skewness and kurtosis of -0.075 and 2.888
+#'    # skewness and kurtosis of -0.075 and 2.888
 #'    JarqueBeraBacktest(-0.075,2.888,500)
 #'
 #' @export

Modified: pkg/Dowd/R/KSTestStat.R
===================================================================
--- pkg/Dowd/R/KSTestStat.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/KSTestStat.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -19,7 +19,7 @@
 #' @examples
 #' 
 #'    # Plots the cdf for KS Test statistic and returns KS confidence interval
-#'    for 100 trials with 1000 sample size and 0.95 confidence interval
+#'    # for 100 trials with 1000 sample size and 0.95 confidence interval
 #'    KSTestStat(100, 1000, 0.95)
 #'
 #' @export

Modified: pkg/Dowd/R/KuiperTestStat.R
===================================================================
--- pkg/Dowd/R/KuiperTestStat.R	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/R/KuiperTestStat.R	2015-06-20 10:44:55 UTC (rev 3683)
@@ -18,16 +18,19 @@
 #' @examples
 #' 
 #'    # Plots the cdf for Kuiper Test statistic and returns Kuiper confidence 
-#'    interval for 100 trials with 1000 sample size and 0.95 confidence 
-#'    interval.
+#'    # interval for 100 trials with 1000 sample size and 0.95 confidence 
+#'    # interval.
 #'    KuiperTestStat(100, 1000, 0.95)
 #'
 #' @export
 KuiperTestStat <- function(number.trials, sample.size, confidence.interval){
   
-  if (confidence.interval>1){
+  if (confidence.interval >= 1) {
     stop("Confidence Interval should be less than 1.")
   }
+  if (confidence.interval <= 0) {
+    stop("Confidence Interval should be positive.")
+  }
   
   # Read back input parameters
   m <- number.trials

Modified: pkg/Dowd/man/ADTestStat.Rd
===================================================================
--- pkg/Dowd/man/ADTestStat.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/ADTestStat.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -8,11 +8,11 @@
 ADTestStat(number.trials, sample.size, confidence.interval)
 }
 \arguments{
-\item{number.trials}{}
+\item{number.trials}{Number of trials}
 
-\item{sample.size}{}
+\item{sample.size}{Sample size}
 
-\item{confidence.interval}{}
+\item{confidence.interval}{Confidence Interval}
 }
 \value{
 Confidence Interval for AD test statistic
@@ -26,7 +26,7 @@
 }
 \examples{
 # Probability that the VaR model is correct for 3 failures, 100 number
-   observations and  95\% confidence level
+   # observations and  95\% confidence level
    ADTestStat(1000, 100, 0.95)
 }
 \author{

Modified: pkg/Dowd/man/AdjustedNormalESHotspots.Rd
===================================================================
--- pkg/Dowd/man/AdjustedNormalESHotspots.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/AdjustedNormalESHotspots.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -41,6 +41,6 @@
 Dinesh Acharya
 }
 \references{
-Dowd, K. Measurh  ing Market Risk, Wiley, 2007.
+Dowd, K. Measuring Market Risk, Wiley, 2007.
 }
 

Modified: pkg/Dowd/man/AdjustedNormalVaRHotspots.Rd
===================================================================
--- pkg/Dowd/man/AdjustedNormalVaRHotspots.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/AdjustedNormalVaRHotspots.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -41,6 +41,6 @@
 Dinesh Acharya
 }
 \references{
-Dowd, K. Measurh  ing Market Risk, Wiley, 2007.
+Dowd, K. Measuring Market Risk, Wiley, 2007.
 }
 

Modified: pkg/Dowd/man/AdjustedVarianceCovarianceVaR.Rd
===================================================================
--- pkg/Dowd/man/AdjustedVarianceCovarianceVaR.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/AdjustedVarianceCovarianceVaR.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -39,6 +39,6 @@
 Dinesh Acharya
 }
 \references{
-Dowd, K. Measurh  ing Market Risk, Wiley, 2007.
+Dowd, K. Measuring Market Risk, Wiley, 2007.
 }
 

Modified: pkg/Dowd/man/BinomialBacktest.Rd
===================================================================
--- pkg/Dowd/man/BinomialBacktest.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/BinomialBacktest.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -26,7 +26,7 @@
 }
 \examples{
 # Probability that the VaR model is correct for 3 failures, 100 number
-   observations and  95\% confidence level
+   # observations and  95\% confidence level
    BinomialBacktest(55, 1000, 0.95)
 }
 \author{

Modified: pkg/Dowd/man/FrechetVaRPlot2DCl.Rd
===================================================================
--- pkg/Dowd/man/FrechetVaRPlot2DCl.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/FrechetVaRPlot2DCl.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -23,7 +23,8 @@
 Plots the VaR of a portfolio against confidence level assuming extreme losses
 are Frechet distributed, for specified range of confidence level and a given
 holding period.
-
+}
+\details{
 Note that the long-right-hand tail is fitted to losses, not profits.
 }
 \examples{

Modified: pkg/Dowd/man/GumbelES.Rd
===================================================================
--- pkg/Dowd/man/GumbelES.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/GumbelES.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -37,6 +37,7 @@
 \references{
 Dowd, K. Measuring Market Risk, Wiley, 2007.
 
-National Institute of Standards and Technology, Dataplot Reference Manual. Volume 1: Commands. NIST: Washington, DC, 1997, p. 8-67.
+National Institute of Standards and Technology, Dataplot Reference Manual.
+Volume 1: Commands. NIST: Washington, DC, 1997, p. 8-67.
 }
 

Modified: pkg/Dowd/man/JarqueBeraBacktest.Rd
===================================================================
--- pkg/Dowd/man/JarqueBeraBacktest.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/JarqueBeraBacktest.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -25,7 +25,7 @@
 }
 \examples{
 # JB test statistic for sample with 500 observations with sample
-   skewness and kurtosis of -0.075 and 2.888
+   # skewness and kurtosis of -0.075 and 2.888
    JarqueBeraBacktest(-0.075,2.888,500)
 }
 \author{

Modified: pkg/Dowd/man/KSTestStat.Rd
===================================================================
--- pkg/Dowd/man/KSTestStat.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/KSTestStat.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -24,7 +24,7 @@
 }
 \examples{
 # Plots the cdf for KS Test statistic and returns KS confidence interval
-   for 100 trials with 1000 sample size and 0.95 confidence interval
+   # for 100 trials with 1000 sample size and 0.95 confidence interval
    KSTestStat(100, 1000, 0.95)
 }
 \author{

Modified: pkg/Dowd/man/KuiperTestStat.Rd
===================================================================
--- pkg/Dowd/man/KuiperTestStat.Rd	2015-06-20 08:11:15 UTC (rev 3682)
+++ pkg/Dowd/man/KuiperTestStat.Rd	2015-06-20 10:44:55 UTC (rev 3683)
@@ -25,8 +25,8 @@
 }
 \examples{
 # Plots the cdf for Kuiper Test statistic and returns Kuiper confidence
-   interval for 100 trials with 1000 sample size and 0.95 confidence
-   interval.
+   # interval for 100 trials with 1000 sample size and 0.95 confidence
+   # interval.
    KuiperTestStat(100, 1000, 0.95)
 }
 \author{



More information about the Returnanalytics-commits mailing list