predict.ffm | R Documentation |
S3 predict
method for object of class ffm
.
## S3 method for class 'ffm'
predict(object, newdata = NULL, pred.date = NULL, ...)
object |
an object of class |
newdata |
data.frame containing the variables |
pred.date |
character; unique date used to base the predictions. Should
be coercible to class |
... |
optional arguments passed to |
The estimated factor returns and potentially new factor exposures
are used to predict the asset returns during all dates from the fitted
ffm
object. For predictions based on estimated factor returns from a
specific period use the pred.date
argument.
predict.ffm
produces a N x T matrix of predicted asset returns, where
T is the number of time periods and N is the number of assets. T=1 if
pred.date
is specified.
Sangeetha Srinivasan
fitFfm
, summary.ffm
,
predict.lm
, predict.lmrob
# Load fundamental and return data
data("factorDataSetDjia5Yrs")
# fit a fundamental factor model
fit <- fitFfm(data = factorDataSetDjia5Yrs,
asset.var = "TICKER",
ret.var = "RETURN",
date.var = "DATE",
exposure.vars = c("P2B", "MKTCAP"))
# generate random data
newdata <- as.data.frame(unique(factorDataSetDjia5Yrs$TICKER))
newdata$P2B <- rnorm(nrow(newdata))
newdata$MKTCAP <- rnorm(nrow(newdata))
pred.fund <- predict(fit, newdata)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.