Simulates draws from the predictive density of the returns and the latent log-volatility process. The same mean model is used for prediction as was used for fitting, which is either a) no mean parameter, b) constant mean, c) AR(k) structure, or d) general Bayesian regression. In the last case, new regressors need to be provided for prediction.
## S3 method for class 'svdraws'predict(object, steps =1L, newdata =NULL,...)
Arguments
object: svdraws or svldraws object.
steps: optional single number, coercible to integer. Denotes the number of steps to forecast.
newdata: only in case d) of the description corresponds to input parameter designmatrix in svsample. A matrix of regressors with number of rows equal to parameter steps.
...: currently ignored.
Returns
Returns an object of class svpredict, a list containing three elements: - vol: mcmc.list object of simulations from the predictive density of the standard deviations sd_(n+1),...,sd_(n+steps)
h: mcmc.list object of simulations from the predictive density of h_(n+1),...,h_(n+steps)
y: mcmc.list object of simulations from the predictive density of y_(n+1),...,y_(n+steps)
Note
You can use the resulting object within plot.svdraws (see example below), or use the list items in the usual coda methods for mcmc objects to print, plot, or summarize the predictions.
Examples
# Example 1## Simulate a short and highly persistent SV process sim <- svsim(100, mu =-10, phi =0.99, sigma =0.2)## Obtain 5000 draws from the sampler (that's not a lot)draws <- svsample(sim$y, draws =5000, burnin =100, priormu = c(-10,1), priorphi = c(20,1.5), priorsigma =0.2)## Predict 10 days aheadfore <- predict(draws,10)## Check out the resultssummary(predlatent(fore))summary(predy(fore))plot(draws, forecast = fore)# Example 2## Simulate now an SV process with an AR(1) mean structurelen <-109Lsimar <- svsim(len, phi =0.93, sigma =0.15, mu =-9)for(i in2:len){ simar$y[i]<-0.1-0.7* simar$y[i-1]+ simar$vol[i]* rnorm(1)}## Obtain 7000 drawsdrawsar <- svsample(simar$y, draws =7000, burnin =300, designmatrix ="ar1", priormu = c(-10,1), priorphi = c(20,1.5), priorsigma =0.2)## Predict 7 days ahead (using AR(1) mean for the returns)forear <- predict(drawsar,7)## Check out the resultsplot(forear)plot(drawsar, forecast = forear)## Not run:# Example 3## Simulate now an SV process with leverage and with non-zero meanlen <-96Lregressors <- cbind(rep_len(1, len), rgamma(len,0.5,0.25))betas <- rbind(-1.1,2)simreg <- svsim(len, rho =-0.42)simreg$y <- simreg$y + as.numeric(regressors %*% betas)## Obtain 12000 drawsdrawsreg <- svsample(simreg$y, draws =12000, burnin =3000, designmatrix = regressors, priormu = c(-10,1), priorphi = c(20,1.5), priorsigma =0.2, priorrho = c(4,4))## Predict 5 days ahead using new regressorspredlen <-5Lpredregressors <- cbind(rep_len(1, predlen), rgamma(predlen,0.5,0.25))forereg <- predict(drawsreg, predlen, predregressors)## Check out the resultssummary(predlatent(forereg))summary(predy(forereg))plot(forereg)plot(drawsreg, forecast = forereg)## End(Not run)