Learn R Programming

stochvol (version 1.3.3)

arpredict: Dynamic prediction for the AR-SV model

Description

Simulates draws from the posterior predictive density of a fitted AR-SV model.

Usage

arpredict(object, volpred)

Arguments

object

svdraws object as returned from svsample.

volpred

svpredict object as returned from predict.svdraws.

Value

Returns an object of class c("distpredict", "mcmc") containing simulations from the posterior predictive density of y_(n+1),...,y_(n+steps).

See Also

predict.svdraws.

Examples

Run this code
# NOT RUN {
data(exrates)
y <- exrates$USD

## Fit AR(1)-SV model to EUR-USD exchange rates
res <- svsample(y, designmatrix = "ar1")

## Use predict.svdraws to obtain predictive volatilities
ahead <- 100
predvol <- predict(res, steps = ahead)

## Use arpredict to obtain draws from the posterior predictive
preddraws <- arpredict(res, predvol)

## Calculate predictive quantiles
predquants <- apply(preddraws, 2, quantile, c(.1, .5, .9))

## Visualize
ts.plot(y, xlim = c(length(y) - ahead, length(y) + ahead),
	ylim = range(predquants))
for (i in 1:3) {
 lines((length(y) + 1):(length(y) + ahead), predquants[i,],
       col = 3, lty = c(2, 1, 2)[i])
}
# }

Run the code above in your browser using DataLab