predict.sfm: Predicts asset returns based on a fitted statistical factor...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/predict.sfm.r

Description

S3 predict method for object of class sfm. It calls the predict method for fitted objects of class lm.

Usage

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

Arguments

object

an object of class sfm produced by fitSfm.

newdata

a vector, matrix, data.frame, xts, timeSeries or zoo object containing the variables with which to predict.

...

optional arguments passed to predict.lm.

Value

predict.sfm produces a vector or a matrix of predictions.

Author(s)

Yi-An Chen and Sangeetha Srinivasan

See Also

fitSfm, summary.sfm

Examples

1
2
3
4
5
6
7
8
9
# load data from the database
data(StockReturns)
# fit the factor model with PCA
fit <- fitSfm(r.M, k=2)

pred.fit <- predict(fit)
newdata <- data.frame("CITCRP"=rnorm(n=120), "CONED"=rnorm(n=120))
rownames(newdata) <- rownames(fit$data)
pred.fit2 <- predict(fit, newdata, interval="confidence")

sangeeuw/factorAnalytics documentation built on May 28, 2019, 3:40 p.m.