[Returnanalytics-commits] r2707 - pkg/FactorAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 3 00:27:25 CEST 2013


Author: chenyian
Date: 2013-08-03 00:27:25 +0200 (Sat, 03 Aug 2013)
New Revision: 2707

Modified:
   pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r
   pkg/FactorAnalytics/R/plot.StatFactorModel.r
   pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r
Log:
modify plot method related to VaR and ES decomposition 

Modified: pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r	2013-08-02 22:10:01 UTC (rev 2706)
+++ pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r	2013-08-02 22:27:25 UTC (rev 2707)
@@ -34,6 +34,9 @@
 #' 8 = histogram of residuals with normal curve overlayed,
 #' 9 = normal qq-plot of residuals.
 #' @param legend.txt  Logical. TRUE will plot legend on barplot. Defualt is \code{TRUE}. 
+#' @param VaR.method haracter, method for computing VaR. Valid choices are
+#' one of "modified","gaussian","historical", "kernel". computation is done with the \code{VaR}
+#' in the PerformanceAnalytics package. Default is "historical".
 #' @param ...  other variables for barplot method.
 #' @author Eric Zivot and Yi-An Chen.
 #' @examples
@@ -62,7 +65,7 @@
 function(x,which.plot=c("none","1L","2L","3L","4L","5L","6L"),max.show=4,
          plot.single=FALSE, asset.name,
          which.plot.single=c("none","1L","2L","3L","4L","5L","6L",
-                             "7L","8L","9L"),legend.txt=TRUE,...) 
+                             "7L","8L","9L"),legend.txt=TRUE,VaR.method="historical",...) 
   {
 require(ellipse)
 require(PerformanceAnalytics)  
@@ -229,7 +232,7 @@
              factor.es.decomp.list[[i]] = 
                factorModelEsDecomposition(tmpData, 
                                           x$beta[i,],
-                                          x$resid.variance[i], tail.prob=0.05)
+                                          x$resid.variance[i], tail.prob=0.05,VaR.method=VaR.method)
            }
           
            # stacked bar charts of percent contributions to ES 
@@ -256,7 +259,7 @@
                factor.VaR.decomp.list[[i]] = 
                  factorModelVaRDecomposition(tmpData, 
                                             x$beta[i,],
-                                            x$resid.variance[i], tail.prob=0.05)
+                                            x$resid.variance[i], tail.prob=0.05,VaR.method=VaR.method)
              }
              
              

Modified: pkg/FactorAnalytics/R/plot.StatFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.StatFactorModel.r	2013-08-02 22:10:01 UTC (rev 2706)
+++ pkg/FactorAnalytics/R/plot.StatFactorModel.r	2013-08-02 22:27:25 UTC (rev 2707)
@@ -33,6 +33,9 @@
 #' plot of recursive estimates relative to full sample estimates 13= rolling
 #' estimates over 24 month window
 #' @param max.show  Maximum assets to plot. Default is 6.
+#' @param VaR.method haracter, method for computing VaR. Valid choices are
+#' one of "modified","gaussian","historical", "kernel". computation is done with the \code{VaR}
+#' in the PerformanceAnalytics package. Default is "historical".
 #' @param ...  other variables for barplot method.
 #' @author Eric Zivot and Yi-An Chen.
 #' @examples
@@ -58,7 +61,7 @@
          hgrid = FALSE, vgrid = FALSE,plot.single=FALSE, asset.name,
          which.plot.single=c("none","1L","2L","3L","4L","5L","6L",
                              "7L","8L","9L","10L","11L","12L","13L"),
-         max.show=6, ...)
+         max.show=6, VaR.method = "historical",...)
 {
   require(strucchange)
   require(ellipse)
@@ -412,7 +415,7 @@
         factor.es.decomp.list[[i]] = 
           factorModelEsDecomposition(tmpData, 
                                      x$loadings[,i],
-                                     x$resid.variance[i], tail.prob=0.05)
+                                     x$resid.variance[i], tail.prob=0.05,VaR.method=VaR.method)
       }
          
              
@@ -438,7 +441,7 @@
                factor.VaR.decomp.list[[i]] = 
                  factorModelVaRDecomposition(tmpData, 
                                             x$loadings[,i],
-                                            x$resid.variance[i], tail.prob=0.05)
+                                            x$resid.variance[i], tail.prob=0.05,VaR.method=VaR.method)
              }
              
                                

Modified: pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r	2013-08-02 22:10:01 UTC (rev 2706)
+++ pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r	2013-08-02 22:27:25 UTC (rev 2707)
@@ -25,6 +25,9 @@
 #' CUSUM plot of recursive residuals 11= CUSUM plot of OLS residuals 12= CUSUM
 #' plot of recursive estimates relative to full sample estimates 13= rolling
 #' estimates over 24 month window
+#' @param VaR.method haracter, method for computing VaR. Valid choices are
+#' one of "modified","gaussian","historical", "kernel". computation is done with the \code{VaR}
+#' in the PerformanceAnalytics package. Default is "historical".
 #' @author Eric Zivot and Yi-An Chen.
 #' @examples
 #' 
@@ -45,7 +48,8 @@
   function(x,colorset=c(1:12),legend.loc=NULL,
            which.plot=c("none","1L","2L","3L","4L","5L","6L","7L"),max.show=6,
            plot.single=FALSE, asset.name,which.plot.single=c("none","1L","2L","3L","4L","5L","6L",
-                                                                  "7L","8L","9L","10L","11L","12L","13L")) {
+                                                                  "7L","8L","9L","10L","11L","12L","13L"),
+           VaR.method = "historical") {
       require(zoo)
       require(PerformanceAnalytics)
       require(strucchange)
@@ -436,7 +440,7 @@
           factor.VaR.decomp.list[[i]] = 
             factorModelVaRDecomposition(tmpData, 
                                        x$beta[i,],
-                                       x$resid.variance[i], tail.prob=0.05)
+                                       x$resid.variance[i], tail.prob=0.05,VaR.method=VaR.method)
           
         }
       } else {
@@ -450,7 +454,7 @@
           factorModelVaRDecomposition(tmpData, 
                                      x$beta[i,],
                                      x$resid.variance[i], tail.prob=0.05,
-                                      VaR.method="HS")
+                                      VaR.method=VaR.method)
       }
       }
       



More information about the Returnanalytics-commits mailing list