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 T \times K matrix containing the time series.

h

a T \times K vector of the current draw of log-volatilities.

sigma

a K \times 1 vector of variances of log-volatilities, where the ith element corresponds to the ith column in y.

h_init

a K \times 1 vector of the initial states of log-volatilities, where the ith element corresponds to the ith column in y.

constant

a K \times 1 vector of constants that should be added to y^2 before taking the natural logarithm. The ith element corresponds to the ith column in y. See 'Details'.

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:

  1. Perform the transformation y_t^* = ln(y_t^2 + constant).

  2. Obtain a sample from the seven-component normal mixture for approximating the log-\chi_1^2 distribution.

  3. 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))


[Package bvartools version 0.2.4 Index]