stochvol_ocsn2007 {bvartools} | R Documentation |
Stochastic Volatility
Description
Produces a draw of log-volatilities based on Omori, Chib, Shephard and Nakajima (2007).
Usage
stochvol_ocsn2007(y, h, sigma, h_init, constant)
Arguments
y |
a |
h |
a |
sigma |
a |
h_init |
a |
constant |
a |
Details
For each column in y
the function produces a posterior
draw of the log-volatility h
for the model
y_{t} = e^{\frac{1}{2}h_t} \epsilon_{t},
where \epsilon_t \sim N(0, 1)
and h_t
is assumed to evolve according to a random walk
h_t = h_{t - 1} + u_t,
with u_t \sim N(0, \sigma^2)
.
The implementation follows the algorithm of Omori, Chib, Shephard and Nakajima (2007) and performs the following steps:
Perform the transformation
y_t^* = ln(y_t^2 + constant)
.Obtain a sample from the ten-component normal mixture for approximating the log-
\chi_1^2
distribution.Obtain a draw of log-volatilities.
The implementation is an adaption of the code provided on the website to the textbook by Chan, Koop, Poirier, and Tobias (2019).
Value
A vector of log-volatility draws.
References
Chan, J., Koop, G., Poirier, D. J., & Tobias J. L. (2019). Bayesian econometric methods (2nd ed.). Cambridge: Cambridge University Press.
Omori, Y., Chib, S., Shephard, N., & Nakajima, J. (2007). Stochastic volatiltiy with leverage. Fast and efficient likelihood inference. Journal of Econometrics 140(2), 425–449. doi:10.1016/j.jeconom.2006.07.008
Examples
data("us_macrodata")
y <- matrix(us_macrodata[, "r"])
# Initialise log-volatilites
h_init <- matrix(log(var(y)))
h <- matrix(rep(h_init, length(y)))
# Obtain draw
stochvol_ocsn2007(y - mean(y), h, matrix(.05), h_init, matrix(0.0001))