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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 11 23:31:25 CEST 2013


Author: chenyian
Date: 2013-09-11 23:31:25 +0200 (Wed, 11 Sep 2013)
New Revision: 3064

Modified:
   pkg/FactorAnalytics/R/factorModelEsDecomposition.R
   pkg/FactorAnalytics/R/factorModelSdDecomposition.R
   pkg/FactorAnalytics/R/factorModelVaRDecomposition.R
   pkg/FactorAnalytics/R/fitFundamentalFactorModel.R
   pkg/FactorAnalytics/R/fitStatisticalFactorModel.R
   pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R
   pkg/FactorAnalytics/R/plot.FM.attribution.r
   pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r
   pkg/FactorAnalytics/R/plot.StatFactorModel.r
   pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r
   pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd
   pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd
   pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd
   pkg/FactorAnalytics/man/fitFundamentalFactorModel.Rd
   pkg/FactorAnalytics/man/fitStatisticalFactorModel.Rd
   pkg/FactorAnalytics/man/fitTimeseriesFactorModel.Rd
   pkg/FactorAnalytics/man/plot.FM.attribution.Rd
   pkg/FactorAnalytics/man/plot.FundamentalFactorModel.Rd
   pkg/FactorAnalytics/man/plot.StatFactorModel.Rd
   pkg/FactorAnalytics/man/plot.TimeSeriesFactorModel.Rd
Log:
Improving documentation of all plot and fit method. 

Modified: pkg/FactorAnalytics/R/factorModelEsDecomposition.R
===================================================================
--- pkg/FactorAnalytics/R/factorModelEsDecomposition.R	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/factorModelEsDecomposition.R	2013-09-11 21:31:25 UTC (rev 3064)
@@ -7,10 +7,9 @@
 #' equal to its value-at-risk (VaR). VaR is compute as the sample quantile of
 #' the historic or simulated data.
 #' 
-#' The factor model has the form \cr \code{R(t) = t(beta)*F(t) + e(t) =
-#' t(beta.star)*F.star(t)} \cr where \code{beta.star = t(beta, sig.e)} and
-#' \code{F.star(t) = (t(F(t)), t(z(t)))} By Euler's theorem \cr \code{ES.fm =
-#' sum(cES.fm) = sum(beta.star*mcES.fm)} \cr
+#' The factor model has the form \cr \code{R(t) = beta'F(t) + e(t) = beta.star'F.star(t)}\cr
+#' where beta.star = (beta, sig.e)' and F.star(t) = (F(t)', z(t))' By Euler's
+#' theorem:\cr \code{ES.fm = sum(cES.fm) = sum(beta.star*mES.fm)} \cr
 #' 
 #' @param Data \code{B x (k+2)} matrix of historic or simulated data. The first
 #' column contains the fund returns, the second through \code{k+1}st columns
@@ -37,12 +36,14 @@
 #' \item{pcES.fm} (K+1) x 1 vector of factor percentage component contributions to ES.
 #' }
 #' @author Eric Zviot and Yi-An Chen.
-#' @references 1. Hallerback (2003), "Decomposing Portfolio Value-at-Risk: A
-#' General Analysis", \emph{The Journal of Risk} 5/2. \cr 2. Yamai and Yoshiba
-#' (2002). "Comparative Analyses of Expected Shortfall and Value-at-Risk: Their
-#' Estimation Error, Decomposition, and Optimization", Bank of Japan. \cr 3.
-#' Meucci (2007). "Risk Contributions from Generic User-Defined Factors,"
-#' \emph{Risk}.
+#' @references \enumerate{ 
+#' \item Hallerback (2003), "Decomposing Portfolio Value-at-Risk: A
+#' General Analysis", The Journal of Risk 5/2.
+#' \item Yamai and Yoshiba (2002)."Comparative Analyses of Expected Shortfall and Value-at-Risk: Their
+#' Estimation Error, Decomposition, and Optimization Bank of Japan.
+#' \item Meucci (2007). "Risk Contributions from Generic User-Defined Factors," Risk. 
+#' \item Epperlein and Smillie (2006) "Cracking VAR with Kernels," Risk.
+#' }
 #' @examples
 #' 
 #' data(managers.df)

Modified: pkg/FactorAnalytics/R/factorModelSdDecomposition.R
===================================================================
--- pkg/FactorAnalytics/R/factorModelSdDecomposition.R	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/factorModelSdDecomposition.R	2013-09-11 21:31:25 UTC (rev 3064)
@@ -3,7 +3,11 @@
 #' Compute the factor model factor standard deviation decomposition for an
 #' asset based on Euler's theorem given factor model parameters. 
 #' 
+#' The factor model has the form \cr \code{R(t) = beta'F(t) + e(t) = beta.star'F.star(t)}\cr
+#' where beta.star = (beta, sig.e)' and F.star(t) = [F(t)', z(t)]'. By Euler's
+#' theorem:\cr \code{Sd.fm = sum(cSd.fm) = sum(beta.star*mSd.fm)} \cr
 #' 
+#' 
 #' @param beta.vec k x 1 vector of factor betas with factor names in the
 #' rownames.
 #' @param factor.cov k x k factor excess return covariance matrix.
@@ -11,11 +15,19 @@
 #' @return an S3 object containing
 #' \itemize{
 #' \item{Sd.fm} Scalar, std dev based on factor model.
-#' \item{mSd.fm} (K+1) x 1 vector of factor marginal contributions to risk sd.
-#' \item{cSd.fm} (K+1) x 1 vector of factor component contributions to risk sd.
-#' \item{pcSd.fm} (K+1) x 1 vector of factor percentage component contributions to risk sd.
+#' \item{mSd.fm} (K+1) x 1 vector of factor marginal contributions to sd.
+#' \item{cSd.fm} (K+1) x 1 vector of factor component contributions to sd.
+#' \item{pcSd.fm} (K+1) x 1 vector of factor percentage component contributions to sd.
 #' }
 #' @author Eric Zivot and Yi-An Chen
+#' @references 
+#' \enumerate{ 
+#' \item Hallerback (2003), "Decomposing Portfolio Value-at-Risk: A
+#' General Analysis", The Journal of Risk 5/2.
+#' \item Yamai and Yoshiba (2002)."Comparative Analyses of Expected Shortfall and Value-at-Risk: Their
+#' Estimation Error, Decomposition, and Optimization Bank of Japan.
+#' \item Meucci (2007). "Risk Contributions from Generic User-Defined Factors," Risk. 
+#' }#' 
 #' @examples
 #' 
 #' # load data from the database

Modified: pkg/FactorAnalytics/R/factorModelVaRDecomposition.R
===================================================================
--- pkg/FactorAnalytics/R/factorModelVaRDecomposition.R	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/factorModelVaRDecomposition.R	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,4 +1,4 @@
-#' Compute factor model factor VaR decomposition
+#' Compute factor model VaR decomposition
 #' 
 #' Compute factor model factor VaR decomposition based on Euler's theorem given
 #' historic or simulated data and factor model parameters. The partial
@@ -7,9 +7,9 @@
 #' VaR is compute either as the sample quantile or as an estimated quantile
 #' using the Cornish-Fisher expansion.
 #' 
-#' The factor model has the form R(t) = beta'F(t) + e(t) = beta.star'F.star(t)
+#' The factor model has the form \cr \code{R(t) = beta'F(t) + e(t) = beta.star'F.star(t)}\cr
 #' where beta.star = (beta, sig.e)' and F.star(t) = (F(t)', z(t))' By Euler's
-#' theorem VaR.fm = sum(cVaR.fm) = sum(beta.star*mVaR.fm)
+#' theorem:\cr \code{VaR.fm = sum(cVaR.fm) = sum(beta.star*mVaR.fm)} \cr
 #' 
 #' @param 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
@@ -32,12 +32,14 @@
 #' \item{pcVaR.fm} (K+1) x 1 vector of factor percentage contributions to VaR.
 #' }
 #' @author Eric Zivot and Yi-An Chen
-#' @references 1. Hallerback (2003), "Decomposing Portfolio Value-at-Risk: A
-#' General Analysis", The Journal of Risk 5/2. 2. Yamai and Yoshiba (2002).
-#' "Comparative Analyses of Expected Shortfall and Value-at-Risk: Their
-#' Estimation Error, Decomposition, and Optimization Bank of Japan. 3. Meucci
-#' (2007). "Risk Contributions from Generic User-Defined Factors," Risk. 4.
-#' Epperlein and Smillie (2006) "Cracking VAR with Kernels," Risk.
+#' @references 
+#' \enumerate{ 
+#' \item Hallerback (2003), "Decomposing Portfolio Value-at-Risk: A
+#' General Analysis", The Journal of Risk 5/2.
+#' \item Yamai and Yoshiba (2002)."Comparative Analyses of Expected Shortfall and Value-at-Risk: Their
+#' Estimation Error, Decomposition, and Optimization Bank of Japan.
+#' \item Meucci (2007). "Risk Contributions from Generic User-Defined Factors," Risk. 
+#' }
 #' @examples
 #' 
 #' data(managers.df)

Modified: pkg/FactorAnalytics/R/fitFundamentalFactorModel.R
===================================================================
--- pkg/FactorAnalytics/R/fitFundamentalFactorModel.R	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/fitFundamentalFactorModel.R	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,28 +1,25 @@
 #' fit fundamental factor model by classic OLS or Robust regression technique
 #' 
-#' fit fundamental factor model or cross-sectional time series factor model by
-#' classic OLS or Robust regression technique.  Fundamental factor models use
+#' fit fundamental factor model or cross-sectional factor model by
+#' classic OLS or Robust regression.  Fundamental factor models use
 #' observable asset specific characteristics (fundamentals) like industry
 #' classification, market capitalization, style classification (value, growth)
-#' etc. to determine the common risk factors. The function creates the class
+#' etc. to calculate the common risk factors. The function creates the class
 #' "FundamentalFactorModel".
 #' 
 #' @details
 #' If style factor exposure is standardized to regression-weighted mean zero, this makes
-#' style factors orthogonal to the Word factor (intercept term), which in turn facilitted 
+#' style factors orthogonal to the world factor (intercept term), which in turn facilitted 
 #' interpretation of the style factor returns. See Menchero 2010.    
 #' 
 #' The original function was designed by Doug Martin and originally implemented
-#' in S-PLUS by a number of UW Ph.D. students:Christopher Green, Eric Aldrich,
-#' and Yindeng Jiang. Guy Yullen re-implemented the function in R and requires
-#' the following additional R libraries: zoo time series library, robust
-#' Insightful robust library ported to R and robustbase Basic robust statistics
-#' package for R. Yi-An Chen from UW economics deparment re-organize the codes and finalize this 
-#' function.  
+#' in S-PLUS by a number of UW Ph.D. students: Christopher Green, Eric Aldrich,
+#' and Yindeng Jiang. Guy Yullen re-implemented the function in R. Yi-An Chen from 
+#' University of Washington re-writes the codes and finalizes the function.  
 #'  
 #'
 #' @param data data.frame, data must have \emph{assetvar}, \emph{returnvar}, \emph{datevar}
-#' , and exposure.names. Generally, data is panel data setup, so it needs firm variabales 
+#' , and exposure.names. Generally, data has to look like panel data. It needs firm variabales 
 #' and time variables. Data has to be a balanced panel. 
 #' @param exposure.names a character vector of exposure names for the factor model
 #' @param wls logical flag, TRUE for weighted least squares, FALSE for ordinary
@@ -75,6 +72,7 @@
 #' \itemize{
 #' \item "The Characteristics of Factor Portfolios", Fall 2010, MENCHERO Jose, 
 #' Journal of Performance Measurement. 
+#' \item Grinold,R and Kahn R, \emph{Active Portfolio Management}.
 #' }
 #' 
 #' @export

Modified: pkg/FactorAnalytics/R/fitStatisticalFactorModel.R
===================================================================
--- pkg/FactorAnalytics/R/fitStatisticalFactorModel.R	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/fitStatisticalFactorModel.R	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,11 +1,12 @@
-#' Fit statistical factor model using principle components
+#' Fit statistical factor model using principle components analysis
 #' 
 #' Fit statistical factor model using principle components. This function is
-#' mainly adapted from S+FinMetric function mfactor.
+#' mainly adapted from S+FinMetric function \code{mfactor}.
 #' 
 #' 
 #' @param data a vector, matrix, data.frame, xts, timeSeries or zoo object with asset returns 
-#' and factors retunrs names
+#' and factors retunrs names. If data does not have xts class, rownames must provide 
+#' xts compatible time index.  
 #' @param k numbers of factors if it is scalar or method of choosing optimal
 #' number of factors. "bn" represents Bai and Ng (2002) method and "ck"
 #' represents Connor and korajczyk (1993) method. Default is k = 1.
@@ -20,23 +21,24 @@
 #' 
 #' @return
 #' \itemize{
-#' \item{factors}{T x K the estimated factors.}
-#' \item{loadings}{K x N the asset specific factor loadings beta_i.
+#' \item{factors}{ T x K the estimated factors.}
+#' \item{loadings}{ K x N the asset specific factor loadings beta_i.
 #' estimated from regress the asset returns on factors.}
-#' \item{alpha}{1 x N the estimated intercepts alpha_i}
-#' \item{ret.cov}{N x N asset returns sample variance covariance matrix.}
-#' \item{r2}{regression r square value from regress the asset returns on
+#' \item{alpha}{ 1 x N the estimated intercepts alpha_i}
+#' \item{ret.cov}{ N x N asset returns sample variance covariance matrix.}
+#' \item{r2}{ regression r square value from regress the asset returns on
 #' factors.}
-#' \item{k}{the number of the facotrs.}
-#' \item{eigen}{eigenvalues from the sample covariance matrix.}
-#' \item{residuals}{T x N matrix of residuals from regression.}
-#' \item{asset.ret}{asset returns}
-#' \item{asset.fit}{List of regression lm class of individual returns on
+#' \item{k}{ the number of the facotrs.}
+#' \item{eigen}{ eigenvalues from the sample covariance matrix.}
+#' \item{residuals}{ T x N matrix of residuals from regression.}
+#' \item{asset.ret}{ asset returns}
+#' \item{asset.fit}{ List of regression lm class of individual returns on
 #' factors.}
-#' \item{resid.variance}{vector of residual variances.}
-#' \item{mimic}{N x K matrix of factor mimicking portfolio returns.}
+#' \item{resid.variance}{ vector of residual variances.}
+#' \item{mimic}{ N x K matrix of factor mimicking portfolio returns.}
 #' }
 #' @author Eric Zivot and Yi-An Chen
+#' @references Zivot and Wang, (2006) "Modeling Financial Time Series with S-PLUS, 2nd edition"
 #' @examples
 #' 
 #' # load data for fitStatisticalFactorModel.r

Modified: pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R
===================================================================
--- pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/fitTimeSeriesFactorModel.R	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,9 +1,11 @@
 #' Fit time series factor model by time series regression techniques.
 #' 
-#' @description Fit time series factor model by time series regression techniques. It
-#' creates the class of "TimeSeriesFactorModel".
+#' @description Fit time series factor model by time series regression techniques for single 
+#' or multiple assets. Classic OLS, Robust regression can be chosen and several model selection methods
+#' can be applied. Class "TimeSeriesFactorModel" will be created too.
 #' 
-#' @details add.up.market.returns adds a max(0,Rm-Rf) term in the regression as suggested by 
+#' @details 
+#' \code{add.up.market.returns} adds a max(0,Rm-Rf) term in the regression as suggested by 
 #' Merton-Henriksson Model (1981) to measure market timing. The coefficient can be interpreted as 
 #' number of free put options.
 #' 

Modified: pkg/FactorAnalytics/R/plot.FM.attribution.r
===================================================================
--- pkg/FactorAnalytics/R/plot.FM.attribution.r	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/plot.FM.attribution.r	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,24 +1,26 @@
 #' plot FM.attribution class
 #' 
 #' Generic function of plot method for factorModelPerformanceAttribution.
-#' Either plot all fit models or choose a single asset to plot.
+#' Either plot all assets or choose a single asset to plot.
 #' 
 #' 
 #' @param fm.attr FM.attribution object created by
-#' factorModelPerformanceAttribution.
-#' @param which.plot integer indicating which plot to create: "none" will
-#' create a menu to choose. Defualt is none. 1 = attributed cumulative returns,
-#' 2 = attributed returns on date selected by user, 3 = time series of
-#' attributed returns
+#' \code{factorModelPerformanceAttribution}.
+#' @param which.plot Integer indicates which plot to create: "none" will
+#' create a menu to choose. Defualt is none.\cr
+#' 1 = attributed cumulative returns,\cr
+#' 2 = attributed returns on date selected by user,\cr
+#' 3 = time series of attributed returns
 #' @param max.show Maximum assets to plot. Default is 6.
-#' @param date date indicates for attributed returns, the date format should be
+#' @param date Indicates for attributed returns, the date format should be
 #' xts compatible.
 #' @param plot.single Plot a single asset of lm class. Defualt is FALSE.
 #' @param fundName Name of the portfolio to be plotted.
-#' @param which.plot.single integer indicating which plot to create: "none"
-#' will create a menu to choose. Defualt is none. 1 = attributed cumulative
-#' returns, 2 = attributed returns on date selected by user, 3 = time series of
-#' attributed returns
+#' @param which.plot.single Integer indicates which plot to create: "none"
+#' will create a menu to choose. Defualt is none.\cr
+#'  1 = attributed cumulative returns,\cr
+#'  2 = attributed returns on date selected by user, \cr
+#'  3 = time series of attributed returns
 #' @param ...  more arguements for \code{chart.TimeSeries} used for plotting
 #' time series
 #' @author Yi-An Chen.

Modified: pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/plot.FundamentalFactorModel.r	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,9 +1,3 @@
-# plot.FundamentalFactorModel.r
-# Yi-An Chen
-# 7/16/2012
-
-
-
 #' plot FundamentalFactorModel object.
 #' 
 #' Generic function of plot method for fitFundamentalFactorModel.
@@ -11,31 +5,31 @@
 #' 
 #' @param x fit object created by fitFundamentalFactorModel.
 #' @param which.plot integer indicating which plot to create: "none" will
-#' create a menu to choose. Defualt is none. 
-#' 1 = "Factor returns",
-#' 2 = "Residual plots",
-#' 3 = "Variance of Residuals",
-#' 4 = "Factor Model Correlation",
-#' 5 = "Factor Contributions to SD",
-#' 6 = "Factor Contributions to ES",
-#' 7 = "Factor Contributions to VaR"
+#' create a menu to choose. Defualt is none. \cr
+#' 1 = "Factor returns",\cr
+#' 2 = "Residual plots",\cr
+#' 3 = "Variance of Residuals",\cr
+#' 4 = "Factor Model Correlation",\cr
+#' 5 = "Factor Contributions to SD",\cr
+#' 6 = "Factor Contributions to ES",\cr
+#' 7 = "Factor Contributions to VaR"\cr
 #' @param max.show Maximum assets to plot. Default is 4.
-#' #' @param plot.single Plot a single asset of lm class. Defualt is FALSE.
+#' @param plot.single Plot a single asset of lm class. Defualt is FALSE.
 #' @param asset.name Name of the asset to be plotted.
 #' @param which.plot.single integer indicating which plot to create: "none"
-#' will create a menu to choose. Defualt is none. 
-#' 1 = time series plot of actual and fitted values,
-#' 2 = time series plot of residuals with standard error bands,
-#' 3 = time series plot of squared residuals,
-#' 4 = time series plot of absolute residuals,
-#' 5 = SACF and PACF of residuals,
-#' 6 = SACF and PACF of squared residuals,
-#' 7 = SACF and PACF of absolute residuals,
-#' 8 = histogram of residuals with normal curve overlayed,
-#' 9 = normal qq-plot of residuals.
+#' will create a menu to choose. Defualt is none.\cr 
+#' 1 = time series plot of actual and fitted values,\cr
+#' 2 = time series plot of residuals with standard error bands,\cr
+#' 3 = time series plot of squared residuals,\cr
+#' 4 = time series plot of absolute residuals,\cr
+#' 5 = SACF and PACF of residuals,\cr
+#' 6 = SACF and PACF of squared residuals,\cr
+#' 7 = SACF and PACF of absolute residuals,\cr
+#' 8 = histogram of residuals with normal curve overlayed,\cr
+#' 9 = normal qq-plot of residuals.\cr
 #' @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}
+#' @param VaR.method character, 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.

Modified: pkg/FactorAnalytics/R/plot.StatFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.StatFactorModel.r	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/plot.StatFactorModel.r	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,42 +1,51 @@
 #' plot StatFactorModel object.
 #' 
 #' Generic function of plot method for fitStatisticFactorModel. Either plot all
-#' fit models or choose a single asset to plot.
+#' assets or choose a single asset to plot.
 #' 
-#' PCA works well. APCA is underconstruction.
-#' 
-#' @param x fit object created by fitStatisticalFactorModel.
-#' @param variables Optional. an integer vector telling which variables are to
+#'  
+#' @param x fit object created by \code{fitStatisticalFactorModel}.
+#' @param variables Optional. An integer vector shows which variables are to
 #' be plotted. The default is to plot all the variables, or the number of
-#' variables explaining 90 percent of the variance, whichever is bigger.
-#' @param cumulative a logical flag: if TRUE, the cumulative fraction of the
+#' variables explaining 90 percent of the variance, whatever is bigger.
+#' @param cumulative Logical flag: if \code{TRUE}, the cumulative fraction of the
 #' variance is printed above each bar in the plot.
 #' @param style Charater. bar or lines can be chosen.
 #' @param which.plot integer indicating which plot to create: "none" will
-#' create a menu to choose. Defualt is none. 1 = "Screeplot of Eigenvalues", 2
-#' = "Factor returns", 3 = "FM Correlation", 4 = "R square", 5 = "Variance of
-#' Residuals", 6 = "Factor Contributions to SD", 7 = "Factor Contributions to
-#' ES", 8 = "Factor Contributions to VaR"
-#' @param hgrid Logic. Whether to plot horizontal grid or not. Defualt is
-#' FALSE.
-#' @param vgrid Logic. Whether to plot vertical grid or not. Defualt is FALSE.
-#' @param plot.single Plot a single asset of lm class. Defualt is FALSE.
+#' create a menu to choose. Defualt is none.\cr
+#' 1 = "Screeplot of Eigenvalues", \cr
+#' 2 = "Factor returns", \cr
+#' 3 = "FM Correlation", \cr
+#' 4 = "R square",\cr
+#' 5 = "Variance of Residuals", \cr
+#' 6 = "Factor Contributions to SD", \cr
+#' 7 = "Factor Contributions to ES", \cr
+#' 8 = "Factor Contributions to VaR" \cr
+#' @param hgrid Logic flag. Whether to plot horizontal grid or not. Defualt is
+#' \code{FALSE}.
+#' @param vgrid Logic flag. Whether to plot vertical grid or not. Defualt is \code{FALSE}.
+#' @param plot.single Plot a single asset of lm class. Defualt is \code{FALSE}.
 #' @param asset.name Name of the asset to be plotted.
 #' @param which.plot.single integer indicating which plot to create: "none"
-#' will create a menu to choose. Defualt is none. 1 = time series plot of
-#' actual and fitted values 2 = time series plot of residuals with standard
-#' error bands 3 = time series plot of squared residuals 4 = time series plot
-#' of absolute residuals 5 = SACF and PACF of residuals 6 = SACF and PACF of
-#' squared residuals 7 = SACF and PACF of absolute residuals 8 = histogram of
-#' residuals with normal curve overlayed 9 = normal qq-plot of residuals 10=
-#' 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
+#' will create a menu to choose. Defualt is none. \cr
+#' 1 = time series plot of actual and fitted values, \cr
+#' 2 = time series plot of residuals with standard error bands,\cr
+#' 3 = time series plot of squared residuals, \cr
+#' 4 = time series plot of absolute residuals, \cr
+#' 5 = SACF and PACF of residuals, \cr
+#' 6 = SACF and PACF of squared residuals, \cr
+#' 7 = SACF and PACF of absolute residuals, \cr
+#' 8 = histogram of residuals with normal curve overlayed, \cr
+#' 9 = normal qq-plot of residuals,\cr
+#' 10= CUSUM plot of recursive residuals,\cr
+#' 11= CUSUM plot of OLS residuals,\cr
+#' 12= CUSUM plot of recursive estimates relative to full sample estimates,\cr
+#' 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}
+#' @param VaR.method Character, method for computing VaR. Valid choices are
+#' either "modified","gaussian","historical", "kernel". computation is done with the \code{VaR}
 #' in the PerformanceAnalytics package. Default is "historical".
-#' @param ...  other variables for barplot method.
+#' @param ...  Other variables for barplot method.
 #' @author Eric Zivot and Yi-An Chen.
 #' @examples
 #' 

Modified: pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/R/plot.TimeSeriesFactorModel.r	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,32 +1,41 @@
-#' plot TimeSeriesfactorModel object.
+#' plot TimeSeriesFactorModel object.
 #' 
 #' Generic function of plot method for fitTimeSeriesFactorModel. Either plot
-#' all fit models or choose a single asset to plot.
+#' all assets or choose a single asset to plot.
 #' 
 #' 
-#' @param x fit object created by fitTimeSeriesFactorModel.
-#' @param colorset Defualt colorset is c(1:12).
-#' @param legend.loc plot legend or not. Defualt is \code{NULL}.
-#' @param which.plot integer indicating which plot to create: "none" will
-#' create a menu to choose. Defualt is none. 1 = "Fitted factor returns", 2 =
-#' "R square", 3 = "Variance of Residuals", 4 = "FM Correlation", 5 = "Factor
-#' Contributions to SD", 6 = "Factor Contributions to ES", 7 = "Factor
-#' Contributions to VaR"
+#' @param x fit object created by \code{fitTimeSeriesFactorModel}.
+#' @param colorset Defualt colorset the same as \code{barplot}.
+#' @param legend.loc Plot legend or not. Defualt is \code{NULL}.
+#' @param which.plot Integer indicates which plot to create: "none" will
+#' create a menu to choose. Defualt is none.\cr 
+#' 1 = "Fitted factor returns", \cr
+#' 2 = "R square", \cr
+#' 3 = "Variance of Residuals",\cr
+#' 4 = "FM Correlation",\cr
+#' 5 = "Factor Contributions to SD",\cr
+#' 6 = "Factor Contributions to ES",\cr
+#' 7 = "Factor Contributions to VaR"
 #' @param max.show Maximum assets to plot. Default is 6.
-#' @param plot.single Plot a single asset of lm class. Defualt is FALSE.
+#' @param plot.single Plot a single asset of lm class. Defualt is \code{FALSE}.
 #' @param asset.name Name of the asset to be plotted.
-#' @param which.plot.single integer indicating which plot to create: "none"
-#' will create a menu to choose. Defualt is none. 1 = time series plot of
-#' actual and fitted values 2 = time series plot of residuals with standard
-#' error bands 3 = time series plot of squared residuals 4 = time series plot
-#' of absolute residuals 5 = SACF and PACF of residuals 6 = SACF and PACF of
-#' squared residuals 7 = SACF and PACF of absolute residuals 8 = histogram of
-#' residuals with normal curve overlayed 9 = normal qq-plot of residuals 10=
-#' 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}
+#' @param which.plot.single Integer indicates which plot to create: "none"
+#' will create a menu to choose. Defualt is none.\cr
+#'  1 = time series plot of actual and fitted values,\cr
+#'  2 = time series plot of residuals with standard error bands, \cr
+#'  3 = time series plot of squared residuals, \cr
+#'  4 = time series plot of absolute residuals,\cr
+#'  5 = SACF and PACF of residuals,\cr
+#'  6 = SACF and PACF of squared residuals,\cr
+#'  7 = SACF and PACF of absolute residuals,\cr
+#'  8 = histogram of residuals with normal curve overlayed,\cr
+#'  9 = normal qq-plot of residuals,\cr
+#'  10= CUSUM plot of recursive residuals,\cr
+#'  11= CUSUM plot of OLS residuals,\cr
+#'  12= CUSUM plot of recursive estimates relative to full sample estimates,\cr
+#'  13= rolling estimates over 24 month window.
+#' @param VaR.method Character, method for computing VaR. Valid choices are
+#' either "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

Modified: pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/man/factorModelEsDecomposition.Rd	2013-09-11 21:31:25 UTC (rev 3064)
@@ -52,11 +52,11 @@
   simulated data.
 }
 \details{
-  The factor model has the form \cr \code{R(t) =
-  t(beta)*F(t) + e(t) = t(beta.star)*F.star(t)} \cr where
-  \code{beta.star = t(beta, sig.e)} and \code{F.star(t) =
-  (t(F(t)), t(z(t)))} By Euler's theorem \cr \code{ES.fm =
-  sum(cES.fm) = sum(beta.star*mcES.fm)} \cr
+  The factor model has the form \cr \code{R(t) = beta'F(t)
+  + e(t) = beta.star'F.star(t)}\cr where beta.star = (beta,
+  sig.e)' and F.star(t) = (F(t)', z(t))' By Euler's
+  theorem:\cr \code{ES.fm = sum(cES.fm) =
+  sum(beta.star*mES.fm)} \cr
 }
 \examples{
 data(managers.df)
@@ -93,12 +93,13 @@
   Eric Zviot and Yi-An Chen.
 }
 \references{
-  1. Hallerback (2003), "Decomposing Portfolio
-  Value-at-Risk: A General Analysis", \emph{The Journal of
-  Risk} 5/2. \cr 2. Yamai and Yoshiba (2002). "Comparative
+  \enumerate{ \item Hallerback (2003), "Decomposing
+  Portfolio Value-at-Risk: A General Analysis", The Journal
+  of Risk 5/2. \item Yamai and Yoshiba (2002)."Comparative
   Analyses of Expected Shortfall and Value-at-Risk: Their
-  Estimation Error, Decomposition, and Optimization", Bank
-  of Japan. \cr 3. Meucci (2007). "Risk Contributions from
-  Generic User-Defined Factors," \emph{Risk}.
+  Estimation Error, Decomposition, and Optimization Bank of
+  Japan. \item Meucci (2007). "Risk Contributions from
+  Generic User-Defined Factors," Risk. \item Epperlein and
+  Smillie (2006) "Cracking VAR with Kernels," Risk. }
 }
 

Modified: pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/man/factorModelSdDecomposition.Rd	2013-09-11 21:31:25 UTC (rev 3064)
@@ -17,17 +17,23 @@
 \value{
   an S3 object containing \itemize{ \item{Sd.fm} Scalar,
   std dev based on factor model. \item{mSd.fm} (K+1) x 1
-  vector of factor marginal contributions to risk sd.
+  vector of factor marginal contributions to sd.
   \item{cSd.fm} (K+1) x 1 vector of factor component
-  contributions to risk sd. \item{pcSd.fm} (K+1) x 1 vector
-  of factor percentage component contributions to risk sd.
-  }
+  contributions to sd. \item{pcSd.fm} (K+1) x 1 vector of
+  factor percentage component contributions to sd. }
 }
 \description{
   Compute the factor model factor standard deviation
   decomposition for an asset based on Euler's theorem given
   factor model parameters.
 }
+\details{
+  The factor model has the form \cr \code{R(t) = beta'F(t)
+  + e(t) = beta.star'F.star(t)}\cr where beta.star = (beta,
+  sig.e)' and F.star(t) = [F(t)', z(t)]'. By Euler's
+  theorem:\cr \code{Sd.fm = sum(cSd.fm) =
+  sum(beta.star*mSd.fm)} \cr
+}
 \examples{
 # load data from the database
 data("stat.fm.data")
@@ -44,4 +50,13 @@
 \author{
   Eric Zivot and Yi-An Chen
 }
+\references{
+  \enumerate{ \item Hallerback (2003), "Decomposing
+  Portfolio Value-at-Risk: A General Analysis", The Journal
+  of Risk 5/2. \item Yamai and Yoshiba (2002)."Comparative
+  Analyses of Expected Shortfall and Value-at-Risk: Their
+  Estimation Error, Decomposition, and Optimization Bank of
+  Japan. \item Meucci (2007). "Risk Contributions from
+  Generic User-Defined Factors," Risk. }#'
+}
 

Modified: pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd
===================================================================
--- pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd	2013-09-11 19:36:06 UTC (rev 3063)
+++ pkg/FactorAnalytics/man/factorModelVaRDecomposition.Rd	2013-09-11 21:31:25 UTC (rev 3064)
@@ -1,6 +1,6 @@
 \name{factorModelVaRDecomposition}
 \alias{factorModelVaRDecomposition}
-\title{Compute factor model factor VaR decomposition}
+\title{Compute factor model VaR decomposition}
 \usage{
   factorModelVaRDecomposition(Data, beta.vec, sig2.e,
     tail.prob = 0.01,
@@ -47,10 +47,11 @@
   Cornish-Fisher expansion.
 }
 \details{
-  The factor model has the form R(t) = beta'F(t) + e(t) =
-  beta.star'F.star(t) where beta.star = (beta, sig.e)' and
-  F.star(t) = (F(t)', z(t))' By Euler's theorem VaR.fm =
-  sum(cVaR.fm) = sum(beta.star*mVaR.fm)
+  The factor model has the form \cr \code{R(t) = beta'F(t)
+  + e(t) = beta.star'F.star(t)}\cr where beta.star = (beta,
+  sig.e)' and F.star(t) = (F(t)', z(t))' By Euler's
+  theorem:\cr \code{VaR.fm = sum(cVaR.fm) =
+  sum(beta.star*mVaR.fm)} \cr
 }
 \examples{
 data(managers.df)
@@ -70,13 +71,12 @@
   Eric Zivot and Yi-An Chen
 }
 \references{
-  1. Hallerback (2003), "Decomposing Portfolio
-  Value-at-Risk: A General Analysis", The Journal of Risk
-  5/2. 2. Yamai and Yoshiba (2002). "Comparative Analyses
-  of Expected Shortfall and Value-at-Risk: Their Estimation
-  Error, Decomposition, and Optimization Bank of Japan. 3.
-  Meucci (2007). "Risk Contributions from Generic
-  User-Defined Factors," Risk. 4. Epperlein and Smillie
-  (2006) "Cracking VAR with Kernels," Risk.
+  \enumerate{ \item Hallerback (2003), "Decomposing
+  Portfolio Value-at-Risk: A General Analysis", The Journal
+  of Risk 5/2. \item Yamai and Yoshiba (2002)."Comparative
+  Analyses of Expected Shortfall and Value-at-Risk: Their
+  Estimation Error, Decomposition, and Optimization Bank of
+  Japan. \item Meucci (2007). "Risk Contributions from
+  Generic User-Defined Factors," Risk. }
 }
 

[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/returnanalytics -r 3064


More information about the Returnanalytics-commits mailing list