# Filtering out AR(1) effects before using stochastic volatility model

I wonder if I first filter out AR(1) (autoregressive model with lag 1) effects from univariate time series and then fit stochastic volatility model does above procedure introduce any bias at first or second step (first step - fitting AR(1), second step - fitting SV model) ? I'm especially interested in potential bias in fitting AR(1) model. This question have came to my mind after using 'stochvol' R package, where I can't add autoregressive part to stochastic volatility model.

## 1 Answer

Even though it's a straightforward extension, it took me a while (a year? yikes!); but now you can easily incorporate Bayesian ar(1) (or more generally, Bayesian regression) in joint estimation by using designmatrix = "ar(1)" as an argument to svsample. It's not well documented yet (except in the help files), but I nevertheless hope easy to use.

From the help file of svsample:

## Another example, this time with an AR(1) structure for the mean
## 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 = i
}

## End(Not run)


Please let me know if you find any glitches!

• Hi Gregor Kastner, welcome to Quant.SE! Thank you for your contribution :) Oct 14 '15 at 8:30