[Returnanalytics-commits] r3604 - in pkg/FactorAnalytics: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Feb 24 01:03:47 CET 2015
Author: chenyian
Date: 2015-02-24 01:03:47 +0100 (Tue, 24 Feb 2015)
New Revision: 3604
Added:
pkg/FactorAnalytics/R/predict.tsfmUpDn.r
pkg/FactorAnalytics/man/predict.tsfmUpDn.Rd
Log:
Add predict.tsfmUpDn.r and predict.tsfmUpDn.Rd
Added: pkg/FactorAnalytics/R/predict.tsfmUpDn.r
===================================================================
--- pkg/FactorAnalytics/R/predict.tsfmUpDn.r (rev 0)
+++ pkg/FactorAnalytics/R/predict.tsfmUpDn.r 2015-02-24 00:03:47 UTC (rev 3604)
@@ -0,0 +1,38 @@
+#' @title Predicts asset returns based on a fitted up and down market time series factor model
+#'
+#' @description S3 \code{predict} method for object of class \code{tsfmUpDn}. It
+#' calls the \code{predict.tsfm} method for a list object of \code{Up} and \code{Dn}
+#'
+#' @param object an object of class \code{tsfmUpDn} produced by \code{fitTsfmUpDn}.
+#' @param ... optional arguments passed to \code{predict.lm} or
+#' \code{\link[robust]{predict.lmRob}}, such as \code{se.fit}, or, to
+#' \code{\link[lars]{predict.lars}} such as \code{mode}.
+#'
+#' @return
+#' \code{predict.tsfmUpDm} produces a list of \code{Up} and \code{Dn}. Both \code{Up} and \code{Dn} contain a
+#' vector or a matrix of predictions.
+#'
+#' @author Yi-An Chen and Sangeetha Srinivasan
+#'
+#' @seealso \code{\link{predict.tsfm}},\code{\link{fitTsfmUpDn}}, \code{\link{summary.tsfmUpDn}}
+#'
+#' @examples
+#' # load data from the database
+#' data(managers)
+#' # fit the factor model with OLS
+# example: Up and down market factor model with OLS fit
+#' fitUpDn <- fitTsfmUpDn(asset.names=colnames(managers[,(1:6)]),mkt.name="SP500.TR",
+#' data=managers, fit.method="OLS",control=NULL)
+#'
+#' predict(fitUpDn)
+#'
+#' @importFrom PerformanceAnalytics checkData
+#'
+#' @method predict tsfmUpDn
+#' @export
+#'
+
+predict.tsfmUpDn <- function(object,...) {
+ uD.list <- lapply(object,predict,...)
+ return(uD.list)
+}
\ No newline at end of file
Added: pkg/FactorAnalytics/man/predict.tsfmUpDn.Rd
===================================================================
--- pkg/FactorAnalytics/man/predict.tsfmUpDn.Rd (rev 0)
+++ pkg/FactorAnalytics/man/predict.tsfmUpDn.Rd 2015-02-24 00:03:47 UTC (rev 3604)
@@ -0,0 +1,39 @@
+% Generated by roxygen2 (4.1.0): do not edit by hand
+% Please edit documentation in R/predict.tsfmUpDn.r
+\name{predict.tsfmUpDn}
+\alias{predict.tsfmUpDn}
+\title{Predicts asset returns based on a fitted up and down market time series factor model}
+\usage{
+\method{predict}{tsfmUpDn}(object, ...)
+}
+\arguments{
+\item{object}{an object of class \code{tsfmUpDn} produced by \code{fitTsfmUpDn}.}
+
+\item{...}{optional arguments passed to \code{predict.lm} or
+\code{\link[robust]{predict.lmRob}}, such as \code{se.fit}, or, to
+\code{\link[lars]{predict.lars}} such as \code{mode}.}
+}
+\value{
+\code{predict.tsfmUpDm} produces a list of \code{Up} and \code{Dn}. Both \code{Up} and \code{Dn} contain a
+vector or a matrix of predictions.
+}
+\description{
+S3 \code{predict} method for object of class \code{tsfmUpDn}. It
+calls the \code{predict.tsfm} method for a list object of \code{Up} and \code{Dn}
+}
+\examples{
+# load data from the database
+data(managers)
+# fit the factor model with OLS
+fitUpDn <- fitTsfmUpDn(asset.names=colnames(managers[,(1:6)]),mkt.name="SP500.TR",
+ data=managers, fit.method="OLS",control=NULL)
+
+predict(fitUpDn)
+}
+\author{
+Yi-An Chen and Sangeetha Srinivasan
+}
+\seealso{
+\code{\link{predict.tsfm}},\code{\link{fitTsfmUpDn}}, \code{\link{summary.tsfmUpDn}}
+}
+
More information about the Returnanalytics-commits
mailing list