[Returnanalytics-commits] r2672 - in pkg/FactorAnalytics: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 29 19:59:33 CEST 2013
Author: chenyian
Date: 2013-07-29 19:59:32 +0200 (Mon, 29 Jul 2013)
New Revision: 2672
Modified:
pkg/FactorAnalytics/R/predict.StatFactorModel.r
pkg/FactorAnalytics/man/predict.StatFactorModel.Rd
pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd
Log:
add checkData
Modified: pkg/FactorAnalytics/R/predict.StatFactorModel.r
===================================================================
--- pkg/FactorAnalytics/R/predict.StatFactorModel.r 2013-07-29 17:53:18 UTC (rev 2671)
+++ pkg/FactorAnalytics/R/predict.StatFactorModel.r 2013-07-29 17:59:32 UTC (rev 2672)
@@ -3,7 +3,8 @@
#' Generic function of predict method for fitStatisticalFactorModel. It utilizes
#' function \code{predict.lm}.
#'
-#' @param fit "StatFactorModel" object created by fitStatisticalFactorModel.
+#' @param fit.stat "StatFactorModel" object created by fitStatisticalFactorModel.
+#' @param newdata a vector, matrix, data.frame, xts, timeSeries or zoo object to be coerced.
#' @param ... Any other arguments used in \code{predict.lm}. For example like newdata and fit.se.
#' @author Yi-An Chen.
#' '
@@ -17,6 +18,12 @@
#'
-predict.StatFactorModel <- function(fit,...){
- lapply(fit$asset.fit, predict,...)
+predict.StatFactorModel <- function(fit.stat,newdata = NULL,...){
+
+ if (missing(newdata) || is.null(newdata) ) {
+ lapply(fit.stat$asset.fit, predict,...)
+ } else {
+ newdata <- checkData(newdata,method = "data.frame")
+ lapply(fit.stat$asset.fit, predict ,newdata,... )
+ }
}
\ No newline at end of file
Modified: pkg/FactorAnalytics/man/predict.StatFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/predict.StatFactorModel.Rd 2013-07-29 17:53:18 UTC (rev 2671)
+++ pkg/FactorAnalytics/man/predict.StatFactorModel.Rd 2013-07-29 17:59:32 UTC (rev 2672)
@@ -2,12 +2,15 @@
\alias{predict.StatFactorModel}
\title{predict method for StatFactorModel object.}
\usage{
- predict.StatFactorModel(fit, ...)
+ predict.StatFactorModel(fit.stat, newdata = NULL, ...)
}
\arguments{
- \item{fit}{"StatFactorModel" object created by
+ \item{fit.stat}{"StatFactorModel" object created by
fitStatisticalFactorModel.}
+ \item{newdata}{a vector, matrix, data.frame, xts,
+ timeSeries or zoo object to be coerced.}
+
\item{...}{Any other arguments used in \code{predict.lm}.
For example like newdata and fit.se.}
}
Modified: pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd
===================================================================
--- pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd 2013-07-29 17:53:18 UTC (rev 2671)
+++ pkg/FactorAnalytics/man/predict.TimeSeriesFactorModel.Rd 2013-07-29 17:59:32 UTC (rev 2672)
@@ -2,12 +2,16 @@
\alias{predict.TimeSeriesFactorModel}
\title{predict method for TimeSeriesModel object.}
\usage{
- predict.TimeSeriesFactorModel(fit.macro, ...)
+ predict.TimeSeriesFactorModel(fit.macro, newdata = NULL,
+ ...)
}
\arguments{
\item{fit}{"TimeSeriesFactorModel" object created by
fitTimeSeiresFactorModel.}
+ \item{newdata}{a vector, matrix, data.frame, xts,
+ timeSeries or zoo object to be coerced.}
+
\item{...}{Any other arguments used in \code{predict.lm}.
for example newdata and se.fit.}
}
More information about the Returnanalytics-commits
mailing list