predict.ffm: Predicts asset returns based on a fitted fundamental factor...

View source: R/predict.ffm.R

predict.ffmR Documentation

Predicts asset returns based on a fitted fundamental factor model

Description

S3 predict method for object of class ffm.

Usage

## S3 method for class 'ffm'
predict(object, newdata = NULL, pred.date = NULL, ...)

Arguments

object

an object of class ffm produced by fitFfm.

newdata

data.frame containing the variables asset.var, date.var and the same exact exposure.vars used in the fitted ffm object. If omitted, the predictions are based on the data used for the fit.

pred.date

character; unique date used to base the predictions. Should be coercible to class Date and match one of the dates in the data used in the fiited object.

...

optional arguments passed to predict.lm or predict.lmrob.

Details

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.

Value

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.

Author(s)

Sangeetha Srinivasan

See Also

fitFfm, summary.ffm, predict.lm, predict.lmrob

Examples


# 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)


braverock/factorAnalytics documentation built on Dec. 16, 2024, 1:05 p.m.