stoch_vol: Stochastic Volatility

View source: R/RcppExports.R

stoch_volR Documentation

Stochastic Volatility

Description

Produces a draw of log-volatilities.

Usage

stoch_vol(y, h, sigma, h_init, constant)

Arguments

y

a T \times 1 vector containing the time series.

h

a T \times 1 vector of log-volatilities.

sigma

a numeric of the variance of the log-volatilites.

h_init

a numeric of the initial state of log-volatilities.

constant

a numeric of the constant that should be added to y^2 before taking the natural logarithm.

Details

The function is a wrapper for function stochvol_ksc1998.

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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/1467-937X.00050")}

Examples

data("us_macrodata")
y <- us_macrodata[, "r"]

# Initialise log-volatilites
h_init <- log(var(y))
h <- rep(h_init, length(y))

# Obtain draw
stoch_vol(y - mean(y), h, .05, h_init, 0.0001)


bvartools documentation built on Aug. 31, 2023, 1:09 a.m.