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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 27 21:15:04 CEST 2014


Author: pragnya
Date: 2014-06-27 21:15:04 +0200 (Fri, 27 Jun 2014)
New Revision: 3444

Added:
   pkg/FactorAnalytics/R/coef.sfm.r
   pkg/FactorAnalytics/R/coef.tsfm.R
   pkg/FactorAnalytics/R/fitted.sfm.r
   pkg/FactorAnalytics/R/fitted.tsfm.r
   pkg/FactorAnalytics/R/residuals.sfm.r
   pkg/FactorAnalytics/R/residuals.tsfm.r
   pkg/FactorAnalytics/man/coef.sfm.Rd
   pkg/FactorAnalytics/man/coef.tsfm.Rd
   pkg/FactorAnalytics/man/fitted.sfm.Rd
   pkg/FactorAnalytics/man/fitted.tsfm.Rd
   pkg/FactorAnalytics/man/plot.tsfm.Rd
   pkg/FactorAnalytics/man/residuals.sfm.Rd
   pkg/FactorAnalytics/man/residuals.tsfm.Rd
Modified:
   pkg/FactorAnalytics/NAMESPACE
   pkg/FactorAnalytics/R/fitTSFM.R
   pkg/FactorAnalytics/R/plot.tsfm.r
   pkg/FactorAnalytics/R/predict.tsfm.r
   pkg/FactorAnalytics/R/print.tsfm.r
   pkg/FactorAnalytics/R/summary.tsfm.r
   pkg/FactorAnalytics/man/predict.tsfm.Rd
   pkg/FactorAnalytics/man/print.tsfm.Rd
   pkg/FactorAnalytics/man/summary.tsfm.Rd
Log:
Added coef(), fitted() and residuals() methods for tsfm.

Modified: pkg/FactorAnalytics/NAMESPACE
===================================================================
--- pkg/FactorAnalytics/NAMESPACE	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/NAMESPACE	2014-06-27 19:15:04 UTC (rev 3444)
@@ -1,16 +1,25 @@
 # Generated by roxygen2 (4.0.1): do not edit by hand
 
+S3method(coef,sfm)
+S3method(coef,tsfm)
+S3method(fitted,tsfm)
 S3method(plot,FundamentalFactorModel)
 S3method(plot,StatFactorModel)
 S3method(plot,pafm)
+S3method(plot,tsfm)
 S3method(predict,FundamentalFactorModel)
 S3method(predict,StatFactorModel)
+S3method(predict,tsfm)
 S3method(print,FundamentalFactorModel)
 S3method(print,StatFactorModel)
 S3method(print,pafm)
+S3method(print,tsfm)
+S3method(residuals,sfm)
+S3method(residuals,tsfm)
 S3method(summary,FundamentalFactorModel)
 S3method(summary,StatFactorModel)
 S3method(summary,pafm)
+S3method(summary,tsfm)
 export(dCornishFisher)
 export(factorModelCovariance)
 export(factorModelEsDecomposition)
@@ -22,9 +31,5 @@
 export(fitTSFM)
 export(pCornishFisher)
 export(paFM)
-export(plot.tsfm)
-export(predict.tsfm)
-export(print.tsfm)
 export(qCornishFisher)
 export(rCornishFisher)
-export(summary.tsfm)

Added: pkg/FactorAnalytics/R/coef.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/coef.sfm.r	                        (rev 0)
+++ pkg/FactorAnalytics/R/coef.sfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,22 @@
+#' @title Extract coefficients from a fitted stochastic factor model
+#' 
+#' @description Method or helper function for fit object of class \code{sfm}. 
+#' 
+#' @param x an object of class \code{sfm} which is returned by 
+#' \code{\link{fitSFM}} 
+#' 
+#' @return
+#' \item{coef.mat}{an N x (K+1) matrix of all coefficients}
+#' where, N is the number of assets and K is the number of factors.
+#' 
+#' @author Eric Zivot and Sangeetha Srinivasan
+#' 
+#' @seealso \code{\link{fitTSFM}}
+#' 
+#' @method coef sfm
+#' @export
+
+coef.sfm <- function(x){
+  coef.mat <- t(sapply(x$asset.fit, coef))
+  return(coef.mat)
+}
\ No newline at end of file

Added: pkg/FactorAnalytics/R/coef.tsfm.R
===================================================================
--- pkg/FactorAnalytics/R/coef.tsfm.R	                        (rev 0)
+++ pkg/FactorAnalytics/R/coef.tsfm.R	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,33 @@
+#' @title Extract coefficients from a fitted time series factor model
+#' 
+#' @description Method or helper function for fit object of class \code{tsfm}. 
+#' 
+#' @param x an object of class \code{tsfm} which is returned by 
+#' \code{\link{fitTSFM}} 
+#' 
+#' @return 
+#' \item{coef.mat}{an N x (K+1) matrix of all coefficients}
+#' where, N is the number of assets and K is the number of factors.
+#' 
+#' @author Eric Zivot and Sangeetha Srinivasan
+#' 
+#' @seealso \code{\link{fitTSFM}}
+#' 
+#' @examples
+#' \dontrun{
+#' data(managers.df)
+#' fit <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+#'                factor.names=colnames(managers.df[,7:9]), 
+#'                market.name="SP500.TR",
+#'                data=data, fit.method="OLS", variable.selection="none", 
+#'                add.up.market=TRUE, add.market.sqd=TRUE)
+#' coef(fit)
+#' }
+#' 
+#' @method coef tsfm
+#' @export
+
+coef.tsfm <- function(x){
+  coef.mat <- t(sapply(x$asset.fit, coef))
+  return(coef.mat)
+}

Modified: pkg/FactorAnalytics/R/fitTSFM.R
===================================================================
--- pkg/FactorAnalytics/R/fitTSFM.R	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/R/fitTSFM.R	2014-06-27 19:15:04 UTC (rev 3444)
@@ -208,8 +208,9 @@
   
   # extract the fitted factor models, coefficients, r2 values and residual vol 
   # from returned factor model fits above
-  alpha <- sapply(reg.list, function(x) coef(x)[1], USE.NAMES = FALSE)
-  beta <- sapply(reg.list, function(x) coef(x)[-1], USE.NAMES = FALSE)
+  coef.mat <- t(sapply(reg.list, coef))
+  alpha <- coef.mat[, 1]
+  beta <- coef.mat[, -1]
   r2 <- sapply(reg.list, function(x) summary(x)$r.squared)
   resid.sd <- sapply(reg.list, function(x) summary(x)$sigma)
   # create list of return values.

Added: pkg/FactorAnalytics/R/fitted.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/fitted.sfm.r	                        (rev 0)
+++ pkg/FactorAnalytics/R/fitted.sfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,27 @@
+#' @title Get fitted values from a stochastic factor model
+#' 
+#' @description Method or helper function for fit object of class \code{sfm}. 
+#' 
+#' @param x an object of class \code{sfm} which is returned by 
+#' \code{\link{fitSFM}} 
+#' 
+#' @return 
+#' \item{fitted.xts}{an N x T data object of fitted values}
+#' where, N is the number of assets and T is the number of time periods.
+#' 
+#' @author Eric Zivot and Sangeetha Srinivasan
+#' 
+#' @seealso \code{\link{fitSFM}}
+#' 
+#' @method fitted tsfm
+#' @export
+
+fitted.sfm <- function(x){
+  # get fitted values from each linear factor model fit 
+  # and convert them into xts/zoo objects
+  fitted.list = sapply(x$asset.fit, function(x) checkData(fitted(x)))
+  # this is a list of xts objects, indexed by the asset name
+  # merge the objects in the list into one xts object
+  fitted.xts <- do.call(merge, fitted.list)
+  return(fitted.xts)
+}

Added: pkg/FactorAnalytics/R/fitted.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/fitted.tsfm.r	                        (rev 0)
+++ pkg/FactorAnalytics/R/fitted.tsfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,38 @@
+#' @title Get fitted values from a time series factor model
+#' 
+#' @description Method or helper function for fit object of class \code{tsfm}. 
+#' 
+#' @param x an object of class \code{tsfm} which is returned by 
+#' \code{\link{fitTSFM}} 
+#' 
+#' @return 
+#' \item{fitted.xts}{an N x T data object of fitted values}
+#' where, N is the number of assets and T is the number of time periods.
+#' 
+#' @author Eric Zivot and Sangeetha Srinivasan
+#' 
+#' @seealso \code{\link{fitTSFM}}
+#' 
+#' @examples
+#' \dontrun{
+#' data(managers.df)
+#' fit <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+#'                factor.names=colnames(managers.df[,7:9]), 
+#'                market.name="SP500.TR",
+#'                data=data, fit.method="OLS", variable.selection="none", 
+#'                add.up.market=TRUE, add.market.sqd=TRUE)
+#' fitted(fit)
+#' }
+#' 
+#' @method fitted tsfm
+#' @export
+
+fitted.tsfm <- function(x){
+  # get fitted values from each linear factor model fit 
+  # and convert them into xts/zoo objects
+  fitted.list = sapply(x$asset.fit, function(x) checkData(fitted(x)))
+  # this is a list of xts objects, indexed by the asset name
+  # merge the objects in the list into one xts object
+  fitted.xts <- do.call(merge, fitted.list)
+  return(fitted.xts)
+}

Modified: pkg/FactorAnalytics/R/plot.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/plot.tsfm.r	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/R/plot.tsfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -66,6 +66,7 @@
 #' plot(fit.macro, plot.single=TRUE, asset.name="HAM1")
 #' }
 #' 
+#' @method plot tsfm
 #' @export
 
 plot.tsfm <- 

Modified: pkg/FactorAnalytics/R/predict.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/predict.tsfm.r	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/R/predict.tsfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -12,6 +12,9 @@
 #' \code{\link[robust]{predict.lmRob}}, such as \code{se.fit}, or, to 
 #' \code{\link[lars]{predict.lars}} such as \code{mode}.
 #' 
+#' @return 
+#' \code{predict.tsfm} produces a vector or a matrix of predictions.
+#' 
 #' @author Yi-An Chen and Sangeetha Srinivasan
 #' 
 #' @seealso \code{\link{fitTSFM}}, \code{\link{summary.tsfm}}, 
@@ -31,9 +34,7 @@
 #' rownames(newdata) <- rownames(fit$data)
 #' pred.fit2 <- predict(fit, newdata, interval="confidence")
 #' 
-#' @return 
-#' \code{predict.tsfm} produces a vector or a matrix of predictions.
-#' 
+#' @method predict tsfm
 #' @export
 #' 
 

Modified: pkg/FactorAnalytics/R/print.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/print.tsfm.r	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/R/print.tsfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -11,8 +11,7 @@
 #'    
 #' @author Yi-An Chen and Sangeetha Srinivasan
 #' 
-#' @seealso \code{\link{fitTSFM}}, \code{\link{summary.tsfm}}, 
-#' \code{\link{tsfm}}
+#' @seealso \code{\link{fitTSFM}}, \code{\link{summary.tsfm}}
 #' 
 #' @examples
 #' data(managers.df)
@@ -23,6 +22,7 @@
 #'                add.up.market=TRUE, add.market.sqd=TRUE)
 #' print(fit)
 #' 
+#' @method print tsfm
 #' @export
 #' 
 
@@ -31,12 +31,12 @@
     cat("\nCall:\n")
     dput(cl)
   }
-  cat("\nFactor Model dimensions:\n")
+  cat("\nModel dimensions:\n")
   tmp <- c(dim(t(x$beta)), nrow(x$data))
-  names(tmp) <- c("#Factors", "#Assets", "#Periods")
+  names(tmp) <- c("Factors", "Assets", "Periods")
   print(tmp)
   cat("\nRegression Alphas:\n")
-  print(x$alpha , digits = digits, ...)
+  print(x$alpha, digits = digits, ...)
   cat("\nFactor Betas:\n")
   print(t(x$beta), digits = digits, ...)
   cat("\nRegression R-squared values:\n")

Added: pkg/FactorAnalytics/R/residuals.sfm.r
===================================================================
--- pkg/FactorAnalytics/R/residuals.sfm.r	                        (rev 0)
+++ pkg/FactorAnalytics/R/residuals.sfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,27 @@
+#' @title Get residuals from a fitted stochastic factor model
+#' 
+#' @description Method or helper function for fit object of class \code{sfm}. 
+#' 
+#' @param x an object of class \code{sfm} which is returned by 
+#' \code{\link{fitSFM}} 
+#' 
+#' @return 
+#' \item{residuals.xts}{an N x T data object of residuals}
+#' where, N is the number of assets and T is the number of time periods.
+#' 
+#' @author Eric Zivot and Sangeetha Srinivasan
+#' 
+#' @seealso \code{\link{fitSFM}}
+#' 
+#' @method residuals sfm
+#' @export
+
+residuals.sfm <- function(x) {
+  # get residuals from each linear factor model fit 
+  # and convert them into xts/zoo objects
+  residuals.list = sapply(x$asset.fit, function(x) checkData(residuals(x)))
+  # this is a list of xts objects, indexed by the asset name
+  # merge the objects in the list into one xts object
+  residuals.xts <- do.call(merge, residuals.list)
+  return(residuals.xts)
+}

Added: pkg/FactorAnalytics/R/residuals.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/residuals.tsfm.r	                        (rev 0)
+++ pkg/FactorAnalytics/R/residuals.tsfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,38 @@
+#' @title Get residuals from a fitted time series factor model
+#' 
+#' @description Method or helper function for fit object of class \code{tsfm}. 
+#' 
+#' @param x an object of class \code{tsfm} which is returned by 
+#' \code{\link{fitTSFM}} 
+#' 
+#' @return 
+#' \item{residuals.xts}{an N x T data object of residuals}
+#' where, N is the number of assets and T is the number of time periods.
+#' 
+#' @author Eric Zivot and Sangeetha Srinivasan
+#' 
+#' @seealso \code{\link{fitTSFM}}
+#' 
+#' @examples
+#' \dontrun{
+#' data(managers.df)
+#' fit <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+#'                factor.names=colnames(managers.df[,7:9]), 
+#'                market.name="SP500.TR",
+#'                data=data, fit.method="OLS", variable.selection="none", 
+#'                add.up.market=TRUE, add.market.sqd=TRUE)
+#' residuals(fit)
+#' }
+#' 
+#' @method residuals tsfm
+#' @export
+
+residuals.tsfm <- function(x) {
+  # get residuals from each linear factor model fit 
+  # and convert them into xts/zoo objects
+  residuals.list = sapply(x$asset.fit, function(x) checkData(residuals(x)))
+  # this is a list of xts objects, indexed by the asset name
+  # merge the objects in the list into one xts object
+  residuals.xts <- do.call(merge, residuals.list)
+  return(residuals.xts)
+}

Modified: pkg/FactorAnalytics/R/summary.tsfm.r
===================================================================
--- pkg/FactorAnalytics/R/summary.tsfm.r	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/R/summary.tsfm.r	2014-06-27 19:15:04 UTC (rev 3444)
@@ -12,7 +12,7 @@
 #' 
 #' @author Yi-An Chen & Sangeetha Srinivasan.
 #' 
-#' @seealso \code{\link{fitTSFM}}, \code{\link{tsfm}}
+#' @seealso \code{\link{fitTSFM}}
 #' 
 #' @examples
 #' data(managers.df)
@@ -23,8 +23,8 @@
 #'                add.up.market=TRUE, add.market.sqd=TRUE)
 #' summary(fit)
 #' 
+#' @method summary tsfm
 #' @export
-#' 
 
 summary.tsfm <- function(object, digits=3, ...){
   if(!is.null(cl <- object$call)) {

Added: pkg/FactorAnalytics/man/coef.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/coef.sfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/coef.sfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,25 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{coef.sfm}
+\alias{coef.sfm}
+\title{Extract coefficients from a fitted stochastic factor model}
+\usage{
+\method{coef}{sfm}(x)
+}
+\arguments{
+\item{x}{an object of class \code{sfm} which is returned by
+\code{\link{fitSFM}}}
+}
+\value{
+\item{coef.mat}{an N x (K+1) matrix of all coefficients}
+where, N is the number of assets and K is the number of factors.
+}
+\description{
+Method or helper function for fit object of class \code{sfm}.
+}
+\author{
+Eric Zivot and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitTSFM}}
+}
+

Added: pkg/FactorAnalytics/man/coef.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/coef.tsfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/coef.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,36 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{coef.tsfm}
+\alias{coef.tsfm}
+\title{Extract coefficients from a fitted time series factor model}
+\usage{
+\method{coef}{tsfm}(x)
+}
+\arguments{
+\item{x}{an object of class \code{tsfm} which is returned by
+\code{\link{fitTSFM}}}
+}
+\value{
+\item{coef.mat}{an N x (K+1) matrix of all coefficients}
+where, N is the number of assets and K is the number of factors.
+}
+\description{
+Method or helper function for fit object of class \code{tsfm}.
+}
+\examples{
+\dontrun{
+data(managers.df)
+fit <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+               factor.names=colnames(managers.df[,7:9]),
+               market.name="SP500.TR",
+               data=data, fit.method="OLS", variable.selection="none",
+               add.up.market=TRUE, add.market.sqd=TRUE)
+coef(fit)
+}
+}
+\author{
+Eric Zivot and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitTSFM}}
+}
+

Added: pkg/FactorAnalytics/man/fitted.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitted.sfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/fitted.sfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,25 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{fitted.sfm}
+\alias{fitted.sfm}
+\title{Get fitted values from a stochastic factor model}
+\usage{
+\method{fitted}{tsfm}(x)
+}
+\arguments{
+\item{x}{an object of class \code{sfm} which is returned by
+\code{\link{fitSFM}}}
+}
+\value{
+\item{fitted.xts}{an N x T data object of fitted values}
+where, N is the number of assets and T is the number of time periods.
+}
+\description{
+Method or helper function for fit object of class \code{sfm}.
+}
+\author{
+Eric Zivot and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitSFM}}
+}
+

Added: pkg/FactorAnalytics/man/fitted.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/fitted.tsfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/fitted.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,36 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{fitted.tsfm}
+\alias{fitted.tsfm}
+\title{Get fitted values from a time series factor model}
+\usage{
+\method{fitted}{tsfm}(x)
+}
+\arguments{
+\item{x}{an object of class \code{tsfm} which is returned by
+\code{\link{fitTSFM}}}
+}
+\value{
+\item{fitted.xts}{an N x T data object of fitted values}
+where, N is the number of assets and T is the number of time periods.
+}
+\description{
+Method or helper function for fit object of class \code{tsfm}.
+}
+\examples{
+\dontrun{
+data(managers.df)
+fit <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+               factor.names=colnames(managers.df[,7:9]),
+               market.name="SP500.TR",
+               data=data, fit.method="OLS", variable.selection="none",
+               add.up.market=TRUE, add.market.sqd=TRUE)
+fitted(fit)
+}
+}
+\author{
+Eric Zivot and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitTSFM}}
+}
+

Added: pkg/FactorAnalytics/man/plot.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/plot.tsfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/plot.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,90 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{plot.tsfm}
+\alias{plot.tsfm}
+\title{Plots from a fitted time series factor model}
+\usage{
+\method{plot}{tsfm}(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"), VaR.method = "historical", ...)
+}
+\arguments{
+\item{x}{an object of class \code{tsfm} produced by \code{fitTSFM}.}
+
+\item{colorset}{a vector of colors for the bars or bar components. Argument
+is used by \code{\link[graphics]{barplot}}. Default is c(1:12).}
+
+\item{legend.loc}{places a legend into one of nine locations on the chart:
+bottomright, bottom, bottomleft, left, topleft, top, topright, right, or
+center. Argument is used by
+\code{\link[PerformanceAnalytics]{chart.TimeSeries}}. Default is \code{NULL}.}
+
+\item{which.plot}{a number or "none" to indicate which type of group plot to
+create for multiple assets. Default is "none"; which brings up the following
+menu to select a type. \cr
+1 = "Fitted asset returns", \cr
+2 = "R-squared", \cr
+3 = "Residual Volatility",\cr
+4 = "FM Correlation",\cr
+5 = "Factors' Contribution to SD",\cr
+6 = "Factors' Contribution to ES",\cr
+7 = "Factors' Contribution to VaR"}
+
+\item{max.show}{maximum number of assets in a plot. Default is 6.}
+
+\item{plot.single}{a logical value. If \code{TRUE}, plots an individual
+asset's linear factor model trait selected by \code{which.plot.single}.
+Default is \code{FALSE}.}
+
+\item{asset.name}{name of the individual asset to be plotted. Is necessary
+if \code{plot.single=TRUE}}
+
+\item{which.plot.single}{a number or "none" to indicate which type of group
+plot to create for multiple assets. Default is "none"; which brings up the
+following menu to select a type.\cr
+ 1 = time series plot of actual and fitted factor returns,\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 an observation window of length 24.}
+
+\item{VaR.method}{a method for computing VaR; one of "modified", "gaussian",
+"historical" or "kernel". VaR is computed using
+\code{\link[PerformanceAnalytics]{VaR}}. Default is "historical".}
+
+\item{...}{further arguments passed to or from other methods.}
+}
+\description{
+S3 \code{plot} method for object of class \code{tsfm}. Plots
+selected characteristics for one or more assets.
+}
+\examples{
+\dontrun{
+# load data from the database
+data(managers.df)
+fit.macro <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+                     factor.names=c("EDHEC.LS.EQ","SP500.TR"),
+                     data=managers.df,fit.method="OLS")
+# plot all assets and show only the first 4 assets.
+plot(fit.macro,max.show=4)
+# plot of an individual asset, "HAM1"
+plot(fit.macro, plot.single=TRUE, asset.name="HAM1")
+}
+}
+\author{
+Eric Zivot, Yi-An Chen and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitTSFM}}, \code{\link{summary.tsfm}},
+\code{\link{tsfm}}
+}
+

Modified: pkg/FactorAnalytics/man/predict.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/predict.tsfm.Rd	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/man/predict.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -3,7 +3,7 @@
 \alias{predict.tsfm}
 \title{Predicts asset returns based on a fitted time series factor model}
 \usage{
-predict.tsfm(object, newdata = NULL, ...)
+\method{predict}{tsfm}(object, newdata = NULL, ...)
 }
 \arguments{
 \item{object}{an object of class \code{\link[stats]{tsfm}} produced by

Modified: pkg/FactorAnalytics/man/print.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/print.tsfm.Rd	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/man/print.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -3,7 +3,7 @@
 \alias{print.tsfm}
 \title{Prints out a fitted time series factor model object}
 \usage{
-print.tsfm(x, digits = max(3, .Options$digits - 3), ...)
+\method{print}{tsfm}(x, digits = max(3, .Options$digits - 3), ...)
 }
 \arguments{
 \item{x}{an object of class \code{tsfm} produced by \code{fitTSFM}.}
@@ -31,7 +31,6 @@
 Yi-An Chen and Sangeetha Srinivasan
 }
 \seealso{
-\code{\link{fitTSFM}}, \code{\link{summary.tsfm}},
-\code{\link{tsfm}}
+\code{\link{fitTSFM}}, \code{\link{summary.tsfm}}
 }
 

Added: pkg/FactorAnalytics/man/residuals.sfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/residuals.sfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/residuals.sfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,25 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{residuals.sfm}
+\alias{residuals.sfm}
+\title{Get residuals from a fitted stochastic factor model}
+\usage{
+\method{residuals}{sfm}(x)
+}
+\arguments{
+\item{x}{an object of class \code{sfm} which is returned by
+\code{\link{fitSFM}}}
+}
+\value{
+\item{residuals.xts}{an N x T data object of residuals}
+where, N is the number of assets and T is the number of time periods.
+}
+\description{
+Method or helper function for fit object of class \code{sfm}.
+}
+\author{
+Eric Zivot and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitSFM}}
+}
+

Added: pkg/FactorAnalytics/man/residuals.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/residuals.tsfm.Rd	                        (rev 0)
+++ pkg/FactorAnalytics/man/residuals.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -0,0 +1,36 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{residuals.tsfm}
+\alias{residuals.tsfm}
+\title{Get residuals from a fitted time series factor model}
+\usage{
+\method{residuals}{tsfm}(x)
+}
+\arguments{
+\item{x}{an object of class \code{tsfm} which is returned by
+\code{\link{fitTSFM}}}
+}
+\value{
+\item{residuals.xts}{an N x T data object of residuals}
+where, N is the number of assets and T is the number of time periods.
+}
+\description{
+Method or helper function for fit object of class \code{tsfm}.
+}
+\examples{
+\dontrun{
+data(managers.df)
+fit <- fitTSFM(asset.names=colnames(managers.df[,(1:6)]),
+               factor.names=colnames(managers.df[,7:9]),
+               market.name="SP500.TR",
+               data=data, fit.method="OLS", variable.selection="none",
+               add.up.market=TRUE, add.market.sqd=TRUE)
+residuals(fit)
+}
+}
+\author{
+Eric Zivot and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{fitTSFM}}
+}
+

Modified: pkg/FactorAnalytics/man/summary.tsfm.Rd
===================================================================
--- pkg/FactorAnalytics/man/summary.tsfm.Rd	2014-06-27 03:57:26 UTC (rev 3443)
+++ pkg/FactorAnalytics/man/summary.tsfm.Rd	2014-06-27 19:15:04 UTC (rev 3444)
@@ -3,7 +3,7 @@
 \alias{summary.tsfm}
 \title{Summarizing a fitted time series factor model}
 \usage{
-summary.tsfm(object, digits = 3, ...)
+\method{summary}{tsfm}(object, digits = 3, ...)
 }
 \arguments{
 \item{object}{an object of class \code{tsfm} produced by \code{fitTSFM}.}
@@ -33,6 +33,6 @@
 Yi-An Chen & Sangeetha Srinivasan.
 }
 \seealso{
-\code{\link{fitTSFM}}, \code{\link{tsfm}}
+\code{\link{fitTSFM}}
 }
 



More information about the Returnanalytics-commits mailing list