stoch_vol | R Documentation |
Produces a draw of log-volatilities.
stoch_vol(y, h, sigma, h_init, constant)
y |
a |
h |
a |
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 |
The function is a wrapper for function stochvol_ksc1998
.
A vector of log-volatility draws.
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")}
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.