predict.TimeSeriesFactorModel: predict method for TimeSeriesModel object.

Description Usage Arguments Author(s) Examples

Description

Generic function of predict method for fitTimeSeriesFactorModel. It utilizes function predict.lm.

Usage

1
2
3
  ## S3 method for class 'TimeSeriesFactorModel'
 predict(object,
    newdata = NULL, ...)

Arguments

object

A fit object created by fitTimeSeiresFactorModel.

newdata

A vector, matrix, data.frame, xts, timeSeries or zoo object to be coerced.

...

Any other arguments used in predict.lm, such as newdata and fit.se.

Author(s)

Yi-An Chen.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# load data from the database
data(managers.df)
ret.assets = managers.df[,(1:6)]
# fit the factor model with OLS
fit <- fitTimeSeriesFactorModel(assets.names=colnames(managers.df[,(1:6)]),
                               factors.names=c("EDHEC.LS.EQ","SP500.TR"),
                               data=managers.df,fit.method="OLS")

pred.fit <- predict(fit)
newdata <- data.frame(EDHEC.LS.EQ = rnorm(n=120), SP500.TR = rnorm(n=120) )
rownames(newdata) <- rownames(fit$data)
pred.fit2 <- predict(fit,newdata,interval="confidence")

R-Finance/FactorAnalytics documentation built on May 8, 2019, 3:51 a.m.