[Returnanalytics-commits] r3566 - in pkg/FactorAnalytics: . R man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Dec 4 08:46:15 CET 2014
Author: pragnya
Date: 2014-12-04 08:46:15 +0100 (Thu, 04 Dec 2014)
New Revision: 3566
Modified:
pkg/FactorAnalytics/DESCRIPTION
pkg/FactorAnalytics/R/plot.tsfm.r
pkg/FactorAnalytics/man/plot.tsfm.Rd
pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw
pkg/FactorAnalytics/vignettes/fitTsfm_vignette.pdf
Log:
Edits to description and examples in plot.fitTsfm
Modified: pkg/FactorAnalytics/DESCRIPTION
===================================================================
--- pkg/FactorAnalytics/DESCRIPTION 2014-12-02 07:30:59 UTC (rev 3565)
+++ pkg/FactorAnalytics/DESCRIPTION 2014-12-04 07:46:15 UTC (rev 3566)
@@ -1,8 +1,8 @@
Package: factorAnalytics
Type: Package
Title: Factor Analytics
-Version: 2.0.3
-Date: 2014-12-01
+Version: 2.0.4
+Date: 2014-12-03
Author: Eric Zivot, Sangeetha Srinivasan and Yi-An Chen
Maintainer: Sangeetha Srinivasan <sangee at uw.edu>
Description: An R package for the estimation and risk analysis of linear factor
Modified: pkg/FactorAnalytics/R/plot.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/plot.tsfm.r 2014-12-02 07:30:59 UTC (rev 3565)
+++ pkg/FactorAnalytics/R/plot.tsfm.r 2014-12-04 07:46:15 UTC (rev 3566)
@@ -37,12 +37,11 @@
#' 9 = Factor Contribution to ES,\cr
#' 10 = Factor Contribution to VaR
#' @param max.show maximum number of assets in a given plot. Default is 6.
-#' @param plot.single a logical value. \code{TRUE} plots the characteristics of
-#' an individual asset's factor model. The type of plot is given by
+#' @param plot.single logical; If \code{TRUE} plots the characteristics of an
+#' individual asset's factor model. The type of plot is given by
#' \code{which.plot.single}. Default is \code{FALSE}.
#' @param asset.name name of the individual asset to be plotted. Is necessary
-#' if multiple assets factor model fits exist in \code{x} and
-#' \code{plot.single=TRUE}.
+#' if \code{x} contains multiple asset fits and \code{plot.single=TRUE}.
#' @param which.plot.single a number to indicate the type of group plot for an
#' individual asset. If \code{NULL} (default), the following menu appears: \cr
#' 1 = Time series plot of actual and fitted asset returns,\cr
@@ -101,9 +100,15 @@
#' fit.macro <- fitTsfm(asset.names=colnames(managers[,(1:6)]),
#' factor.names=colnames(managers[,(7:8)]),
#' rf.name="US 3m TR", data=managers)
-#'
-#' # plot the factor betas of 1st 4 assets fitted above.
+#'
+#' # group plot(default); select type from menu prompt
+#' # menu is auto-looped to get multiple types of plots based on the same fit
+#' # plot(fit.macro)
+#'
+#' # plot the factor betas of 1st 4 assets fitted above
+#' # loop disabled to get one type of plot without interative menu
#' plot(fit.macro, max.show=4, which.plot.group=2, loop=FALSE)
+#'
#' # plot factor model return correlation; angular order of the eigenvectors
#' plot(fit.macro, which.plot.group=7, loop=FALSE,
#' order="AOE", method="ellipse", tl.pos = "d")
@@ -112,9 +117,6 @@
#' plot(fit.macro, plot.single=TRUE, asset.name="HAM1", which.plot.single=8,
#' loop=FALSE)
#'
-#' # group plot; type selected from menu prompt; auto-looped for multiple plots
-#' # plot(fit.macro)
-#'
#' @importFrom PerformanceAnalytics chart.TimeSeries chart.ACFplus
#' chart.Histogram chart.QQPlot
#' @importFrom lattice barchart panel.barchart panel.grid
@@ -134,7 +136,7 @@
if (missing(asset.name) && length(x$asset.names)>1) {
stop("Missing input: 'asset.name' is required if plot.single is TRUE and
- multiple assets factor model fits exist in 'x'.")
+ the factor model fits multiple assets.")
} else if (length(x$asset.names)==1) {
i <- x$asset.names[1]
} else {
@@ -326,8 +328,7 @@
## Factor model coefficients: Betas
k <- ncol(coef(x))-1
if (k > max.show) {
- cat(paste("Displaying only the first", max.show,"factor betas,
- as the number of factors > 'max.show' =", max.show))
+ cat(paste("Displaying only the first", max.show,"factor betas, as the number of factors > 'max.show' =", max.show))
k <- max.show
}
par(mfrow=c(ceiling(k/2),2))
@@ -343,8 +344,7 @@
## Actual and Fitted asset returns
n <- length(x$asset.names)
if (n > max.show) {
- cat(paste("Displaying only the first", max.show,
- "assets, since the number of assets > 'max.show'"))
+ cat(paste("Displaying only the first", max.show, "assets, since the number of assets > 'max.show'"))
n <- max.show
}
par(mfrow=c(ceiling(n/2),2))
Modified: pkg/FactorAnalytics/man/plot.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.tsfm.Rd 2014-12-02 07:30:59 UTC (rev 3565)
+++ pkg/FactorAnalytics/man/plot.tsfm.Rd 2014-12-04 07:46:15 UTC (rev 3566)
@@ -26,13 +26,12 @@
\item{max.show}{maximum number of assets in a given plot. Default is 6.}
-\item{plot.single}{a logical value. \code{TRUE} plots the characteristics of
-an individual asset's factor model. The type of plot is given by
+\item{plot.single}{logical; If \code{TRUE} plots the characteristics of an
+individual asset's factor model. The type of plot is given by
\code{which.plot.single}. Default is \code{FALSE}.}
\item{asset.name}{name of the individual asset to be plotted. Is necessary
-if multiple assets factor model fits exist in \code{x} and
-\code{plot.single=TRUE}.}
+if \code{x} contains multiple asset fits and \code{plot.single=TRUE}.}
\item{which.plot.single}{a number to indicate the type of group plot for an
individual asset. If \code{NULL} (default), the following menu appears: \cr
@@ -103,8 +102,14 @@
factor.names=colnames(managers[,(7:8)]),
rf.name="US 3m TR", data=managers)
-# plot the factor betas of 1st 4 assets fitted above.
+# group plot(default); select type from menu prompt
+# menu is auto-looped to get multiple types of plots based on the same fit
+# plot(fit.macro)
+
+# plot the factor betas of 1st 4 assets fitted above
+# loop disabled to get one type of plot without interative menu
plot(fit.macro, max.show=4, which.plot.group=2, loop=FALSE)
+
# plot factor model return correlation; angular order of the eigenvectors
plot(fit.macro, which.plot.group=7, loop=FALSE,
order="AOE", method="ellipse", tl.pos = "d")
@@ -112,9 +117,6 @@
# histogram of residuals from an individual asset's factor model fit
plot(fit.macro, plot.single=TRUE, asset.name="HAM1", which.plot.single=8,
loop=FALSE)
-
-# group plot; type selected from menu prompt; auto-looped for multiple plots
-# plot(fit.macro)
}
\author{
Eric Zivot, Sangeetha Srinivasan and Yi-An Chen
Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw
===================================================================
--- pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw 2014-12-02 07:30:59 UTC (rev 3565)
+++ pkg/FactorAnalytics/vignettes/fitTsfm_vignette.Rnw 2014-12-04 07:46:15 UTC (rev 3566)
@@ -265,7 +265,7 @@
\end{itemize}
\newpage
-\subsection{Summary, Predict, Coefficients, Fitted values and Residuals}
+\subsection{S3 generic methods}
<<>>=
methods(class="tsfm")
@@ -278,6 +278,8 @@
Note: Standard errors are currently not available for the "lars" variable selection method, as there seems to be no consensus on a statistically valid method of calculating standard errors for the lasso predictions.
+Factor model covariance and risk decomposition functions are explained in section 3 and \code{plot()} method is discussed separately in Section 4.
+
Here are some examples using the time series factor models fitted earlier.
<<>>=
# all estimated coefficients from the OLS fit using all 3 factors
Modified: pkg/FactorAnalytics/vignettes/fitTsfm_vignette.pdf
===================================================================
(Binary files differ)
More information about the Returnanalytics-commits
mailing list