predict.tsfm | R Documentation |
S3 predict
method for object of class tsfm
. It
calls the predict
method for fitted objects of class lm
,
lmRob
or lars
as appropriate.
## S3 method for class 'tsfm'
predict(object, newdata = NULL, ...)
object |
an object of class |
newdata |
a vector, matrix, data.frame, xts, timeSeries or zoo object containing the variables with which to predict. |
... |
optional arguments passed to |
predict.tsfm
produces a matrix of return predictions, if all assets
have equal history. If not, a list of predicted return vectors of unequal
length is produced.
Yi-An Chen and Sangeetha Srinivasan
fitTsfm
, summary.tsfm
# load data from the database
data(managers, package = 'PerformanceAnalytics')
# fit the factor model with LS
fit <- fitTsfm(asset.names = colnames(managers[,(1:6)]),
factor.names = c("EDHEC LS EQ","SP500 TR"),
data = managers)
predict_fit <- predict(fit)
newdata <- data.frame(rnorm(n=NROW(fit$data)), rnorm(n=NROW(fit$data)))
colnames(newdata) <- c("EDHEC LS EQ", "SP500 TR")
rownames(newdata) <- zoo::index(fit$data)
predict_fit_2 <- predict(fit, newdata, interval = "confidence")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.