predict.DNFOptim {SVDNF} | R Documentation |
Predict Method for DNFOptim
and SVDNF
Objects
Description
This function generates Monte Carlo predictions for DNFOptim
objects. The function does this by sampling volatilities from the discrete nonlinear filter's last filtering distribution. Then, using these volatilities as inital values for the modelSim
function, the predict method generates n_sim
path and estimates the means and confidence intervals for future volatility factor and return values.
Usage
## S3 method for class 'DNFOptim'
predict(object, n_ahead = 15, new_data = NULL, n_sim = 1000, confidence = 0.95, ...)
Arguments
object |
An object of class |
n_ahead |
Number of periods ahead to predict. |
new_data |
An optional data frame of new predictor values for models with factors (e.g., the CAPM-SV model) for which we want to forecast returns and volatility values. |
n_sim |
Number of simulated paths used to estimate the future volatility factor and return means and confidence intervals. |
confidence |
Confidence level for prediction intervals. Should be between 0 and 1. |
... |
Other parameters to be passed through to function. |
Details
This function uses Monte Carlo paths simulated from the MLE dynamics obtained via a DNFOptim
object to generate predictions for a specified number of periods ahead.
It returns predicted mean volatility and return values based on simulations with confidence intervals.
Value
A list containing the following components:
volatility_pred |
A list with mean volatility values and confidence intervals. Contains the following components:
|
ret_pred |
A list with mean return values and confidence intervals. Contains the following components:
(1) |
object |
The |
confidence |
The specified confidence level. |
See Also
Examples
set.seed(1)
# Generating return data
Taylor_mod <- dynamicsSVM(model = "Taylor", phi = 0.9,
theta = -7.36, sigma = 0.363)
Taylor_sim <- modelSim(t = 30, dynamics = Taylor_mod, init_vol = -7.36)
# Initial values and optimization bounds
init_par <- c( 0.7, -5, 0.3)
lower <- c(0.01, -20, 0.1); upper <- c(0.99, 0, 1)
# Running DNFOptim to get MLEs
optim_test <- DNFOptim(data = Taylor_sim$returns,
dynamics = Taylor_mod,
par = init_par, lower = lower, upper = upper, method = "L-BFGS-B")
# Parameter estimates
summary(optim_test)
# Predict 5 steps ahead
preds <- predict(optim_test, n_ahead = 5)
# Plot predictions with 95 percent confidence interval
plot(preds)