stochvol_ksc1998 {bvartools} | R Documentation |
Stochastic Volatility
Description
Produces a draw of log-volatilities.
Usage
stochvol_ksc1998(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 is based on the algorithm of Kim, Shephard and Chip (1998) and performs the following steps:
Perform the transformation
y_t^* = ln(y_t^2 + constant)
.Obtain a sample from the seven-component normal mixture for approximating the log-
\chi_1^2
distribution.Obtain a draw of log-volatilities.
The implementation follows 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.
Kim, S., Shephard, N., & Chib, S. (1998). Stochastic volatility. Likelihood inference and comparison with ARCH models. Review of Economic Studies 65(3), 361–393. doi:10.1111/1467-937X.00050
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_ksc1998(y - mean(y), h, matrix(.05), h_init, matrix(0.0001))