[Returnanalytics-commits] r2708 - in pkg/FactorAnalytics: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 3 00:32:44 CEST 2013


Author: chenyian
Date: 2013-08-03 00:32:44 +0200 (Sat, 03 Aug 2013)
New Revision: 2708

Modified:
   pkg/FactorAnalytics/R/factorModelSdDecomposition.R
   pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd
   pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd
   pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd
   pkg/FactorAnalytics/man/plot.FundamentalFactorModel.Rd
   pkg/FactorAnalytics/man/plot.StatFactorModel.Rd
   pkg/FactorAnalytics/man/plot.TimeSeriesFactorModel.Rd
Log:
modify .Rd file for the change of VaR.method

Modified: pkg/FactorAnalytics/R/factorModelSdDecomposition.R
===================================================================
--- pkg/FactorAnalytics/R/factorModelSdDecomposition.R	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/R/factorModelSdDecomposition.R	2013-08-02 22:32:44 UTC (rev 2708)
@@ -19,34 +19,22 @@
 #' @examples
 #' 
 #' # load data from the database
-#' data(managers.df)
-#' ret.assets = managers.df[,(1:6)]
-#' factors    = managers.df[,(7:9)]
-#' # fit the factor model with OLS
-#' fit <- fitMacroeconomicFactorModel(ret.assets,factors,fit.method="OLS", 
-#'                                  variable.selection="all subsets",
-#'                                  factor.set = 3)
-#' # factor SD decomposition for HAM1
-#' cov.factors = var(factors)
-#' manager.names = colnames(managers.df[,(1:6)])
-#' factor.names  = colnames(managers.df[,(7:9)])
-#' factor.sd.decomp.HAM1 = factorModelSdDecomposition(fit$beta.mat["HAM1",],
-#'                                                    cov.factors, fit$residVars.vec["HAM1"])
+#' data("stat.fm.data")
+#' fit.stat <- fitStatisticalFactorModel(sfm.dat,k=2)
+#' cov.factors = var(fit.stat$factors)
+#' names = colnames(fit.stat$asset.ret)
+#' factor.sd.decomp.list = list()
+#' for (i in names) {
+#'  factor.sd.decomp.list[[i]] =
+#'    factorModelSdDecomposition(fit.stat$loadings[,i],
+#'                               cov.factors, fit.stat$resid.variance[i])
+#' }
 #'  
 #' @export                                       
 #' 
 factorModelSdDecomposition <-
 function(beta.vec, factor.cov, sig2.e) {
-## Inputs:
-## beta   		   k x 1 vector of factor betas with factor names in the rownames
-## factor.cov		 k x k factor excess return covariance matrix 
-## sig2.e			   scalar, residual variance from factor model (residVars.vec in fitFundamentalFactorModel)
-## Output:
-## A list with the following components:
-## sd.fm              scalar, std dev based on factor model
-## mcr.fm             k+1 x 1 vector of factor marginal contributions to risk (sd)
-## cr.fm              k+1 x 1 vector of factor component contributions to risk (sd)
-## pcr.fm             k+1 x 1 vector of factor percent contributions to risk (sd)
+
 ## Remarks:
 ## The factor model has the form
 ## R(t) = beta'F(t) + e(t) = beta.star'F.star(t)

Modified: pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd	2013-08-02 22:32:44 UTC (rev 2708)
@@ -4,7 +4,7 @@
 \usage{
   factorModelEsDecomposition(Data, beta.vec, sig2.e,
     tail.prob = 0.05,
-    VaR.method = c("HS", "CornishFisher"))
+    VaR.method = c("modified", "gaussian", "historical", "kernel"))
 }
 \arguments{
   \item{Data}{\code{B x (k+2)} matrix of historic or
@@ -23,11 +23,10 @@
   quantile. Typically 0.01 or 0.05.}
 
   \item{VaR.method}{character, method for computing VaR.
-  Valid choices are "HS" for historical simulation
-  (empirical quantile); "CornishFisher" for modified VaR
-  based on Cornish-Fisher quantile estimate. Cornish-Fisher
-  computation is done with the VaR.CornishFisher in the
-  PerformanceAnalytics package.}
+  Valid choices are one of
+  "modified","gaussian","historical", "kernel". computation
+  is done with the \code{VaR} in the PerformanceAnalytics
+  package. package.}
 }
 \value{
   A list with the following components:

Modified: pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd	2013-08-02 22:32:44 UTC (rev 2708)
@@ -1,43 +1,40 @@
-\name{factorModelSdDecomposition}
-\alias{factorModelSdDecomposition}
-\title{Compute factor model factor risk (sd) decomposition for individual fund.}
-\usage{
-  factorModelSdDecomposition(beta.vec, factor.cov, sig2.e)
-}
-\arguments{
-  \item{beta.vec}{k x 1 vector of factor betas with factor
-  names in the rownames.}
-
-  \item{factor.cov}{k x k factor excess return covariance
-  matrix.}
-
-  \item{sig2.e}{scalar, residual variance from factor
-  model.}
-}
-\value{
-  an S3 object containing
-}
-\description{
-  Compute factor model factor risk (sd) decomposition for
-  individual fund.
-}
-\examples{
-# load data from the database
-data(managers.df)
-ret.assets = managers.df[,(1:6)]
-factors    = managers.df[,(7:9)]
-# fit the factor model with OLS
-fit <- fitMacroeconomicFactorModel(ret.assets,factors,fit.method="OLS",
-                                 variable.selection="all subsets",
-                                 factor.set = 3)
-# factor SD decomposition for HAM1
-cov.factors = var(factors)
-manager.names = colnames(managers.df[,(1:6)])
-factor.names  = colnames(managers.df[,(7:9)])
-factor.sd.decomp.HAM1 = factorModelSdDecomposition(fit$beta.mat["HAM1",],
-                                                   cov.factors, fit$residVars.vec["HAM1"])
-}
-\author{
-  Eric Zivot and Yi-An Chen
-}
-
+\name{factorModelSdDecomposition}
+\alias{factorModelSdDecomposition}
+\title{Compute factor model factor risk (sd) decomposition for individual fund.}
+\usage{
+  factorModelSdDecomposition(beta.vec, factor.cov, sig2.e)
+}
+\arguments{
+  \item{beta.vec}{k x 1 vector of factor betas with factor
+  names in the rownames.}
+
+  \item{factor.cov}{k x k factor excess return covariance
+  matrix.}
+
+  \item{sig2.e}{scalar, residual variance from factor
+  model.}
+}
+\value{
+  an S3 object containing
+}
+\description{
+  Compute factor model factor risk (sd) decomposition for
+  individual fund.
+}
+\examples{
+# load data from the database
+data("stat.fm.data")
+fit.stat <- fitStatisticalFactorModel(sfm.dat,k=2)
+cov.factors = var(fit.stat$factors)
+names = colnames(fit.stat$asset.ret)
+factor.sd.decomp.list = list()
+for (i in names) {
+ factor.sd.decomp.list[[i]] =
+   factorModelSdDecomposition(fit.stat$loadings[,i],
+                              cov.factors, fit.stat$resid.variance[i])
+}
+}
+\author{
+  Eric Zivot and Yi-An Chen
+}
+

Modified: pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd	2013-08-02 22:32:44 UTC (rev 2708)
@@ -2,12 +2,12 @@
 \alias{factorModelVaRDecomposition}
 \title{Compute factor model factor VaR decomposition}
 \usage{
-  factorModelVaRDecomposition(bootData, beta.vec, sig2.e,
+  factorModelVaRDecomposition(Data, beta.vec, sig2.e,
     tail.prob = 0.01,
-    VaR.method = c("HS", "CornishFisher"))
+    VaR.method = c("modified", "gaussian", "historical", "kernel"))
 }
 \arguments{
-  \item{bootData}{B x (k+2) matrix of bootstrap data. First
+  \item{Data}{B x (k+2) matrix of bootstrap data. First
   column contains the fund returns, second through k+1
   columns contain factor returns, (k+2)nd column contain
   residuals scaled to have unit variance .}
@@ -20,11 +20,10 @@
   \item{tail.prob}{scalar, tail probability}
 
   \item{VaR.method}{character, method for computing VaR.
-  Valid choices are "HS" for historical simulation
-  (empirical quantile); "CornishFisher" for modified VaR
-  based on Cornish-Fisher quantile estimate. Cornish-Fisher
-  computation is done with the VaR.CornishFisher in the
-  PerformanceAnalytics package.}
+  Valid choices are one of
+  "modified","gaussian","historical", "kernel". computation
+  is done with the \code{VaR} in the PerformanceAnalytics
+  package.}
 }
 \value{
   an S3 object containing
@@ -55,8 +54,9 @@
 tmpData = cbind(managers.df[,1],managers.df[,c("EDHEC.LS.EQ","SP500.TR")] ,
 residuals(fit.macro$asset.fit$HAM1)/sqrt(fit.macro$resid.variance[1]))
 colnames(tmpData)[c(1,4)] = c("HAM1", "residual")
-factor.VaR.decomp.HAM1 = factorModelEsDecomposition(tmpData, fit.macro$beta[1,],
-                                                  fit.macro$resid.variance[1], tail.prob=0.05)
+factor.VaR.decomp.HAM1 = factorModelVaRDecomposition(tmpData, fit.macro$beta[1,],
+                                                  fit.macro$resid.variance[1], tail.prob=0.05,
+                                                  VaR.method="historical)
 }
 \author{
   Eric Zivot and Yi-An Chen

Modified: pkg/FactorAnalytics/man/plot.FundamentalFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.FundamentalFactorModel.Rd	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/man/plot.FundamentalFactorModel.Rd	2013-08-02 22:32:44 UTC (rev 2708)
@@ -6,7 +6,7 @@
     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, ...)
+    legend.txt = TRUE, VaR.method = "historical", ...)
 }
 \arguments{
   \item{x}{fit object created by
@@ -40,6 +40,12 @@
   \item{legend.txt}{Logical. TRUE will plot legend on
   barplot. Defualt is \code{TRUE}.}
 
+  \item{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".}
+
   \item{...}{other variables for barplot method.}
 }
 \description{

Modified: pkg/FactorAnalytics/man/plot.StatFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.StatFactorModel.Rd	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/man/plot.StatFactorModel.Rd	2013-08-02 22:32:44 UTC (rev 2708)
@@ -8,7 +8,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", ...)
 }
 \arguments{
   \item{x}{fit object created by
@@ -60,6 +60,12 @@
 
   \item{max.show}{Maximum assets to plot. Default is 6.}
 
+  \item{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".}
+
   \item{...}{other variables for barplot method.}
 }
 \description{

Modified: pkg/FactorAnalytics/man/plot.TimeSeriesFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.TimeSeriesFactorModel.Rd	2013-08-02 22:27:25 UTC (rev 2707)
+++ pkg/FactorAnalytics/man/plot.TimeSeriesFactorModel.Rd	2013-08-02 22:32:44 UTC (rev 2708)
@@ -6,7 +6,8 @@
     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"))
+    which.plot.single = c("none", "1L", "2L", "3L", "4L", "5L", "6L", "7L", "8L", "9L", "10L", "11L", "12L", "13L"),
+    VaR.method = "historical")
 }
 \arguments{
   \item{x}{fit object created by fitTimeSeriesFactorModel.}
@@ -43,6 +44,12 @@
   OLS residuals 12= CUSUM plot of recursive estimates
   relative to full sample estimates 13= rolling estimates
   over 24 month window}
+
+  \item{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".}
 }
 \description{
   Generic function of plot method for



More information about the Returnanalytics-commits mailing list