Learn R Programming

ASV (version 1.1.4)

sv_mcmc: MCMC estimation for stochastic volatility models without leverage

Description

This function estimates model parameters and latent log volatilities for stochastic volatility models without leverage (symmetric stochastic volatility models):

y(t) = eps(t)*exp(h(t)/2), h(t+1) = mu + phi*(h(t)-mu) + eta(t)

eps(t)~i.i.d. N(0,1), eta(t)~i.i.d. N(0,sigma_eta^2)

where we assume the correlation between eps(t) and eta(t) equals to zero. Prior distributions are

mu~N(mu_0,sigma_0^2), (phi+1)/2~Beta(a_0,b_0), sigma_eta^2~IG(n_0/2,S_0/2)

where N, Beta and IG denote normal, beta and inverse gaussian distributions respectively. Note that the probability density function of x ~ IG(a,b) is proportional to (1/x)^(a+1)*exp(-b/x).

The highly efficient Markov chain Monte Carlo algorithm is based on the mixture sampler by Omori, Chib, Shephard and Nakajima (2007), but it further corrects the approximation error within the sampling algorithm. See Takahashi, Omori and Watanabe (2022+) for more details.

Usage

sv_mcmc(return_vector, nSim = NULL, nBurn = NULL, vHyper = NULL)

Value

A list with components:

vmu

nSim x 1 vector of MCMC samples of mu

vphi

nSim x 1 vector of MCMC samples of phi

vsigma_eta

nSim x 1 vector of MCMC samples of sigma_eta

vmh

nSim x T matrix of latent log volatilities (h(1),...,h(T)). For example, the first column is a vector of MCMC samples for h(1).

Further, the acceptance rates of MH algorithms will be shown for h and (mu,phi,sigma_eta).

Arguments

return_vector

T x 1 vector (y(1),...,y(T))' of returns where T is a sample size.

nSim

Number of iterations for the MCMC estimation. Default value is 5000.

nBurn

Number of iterations for the burn-in period. Default value is the maximum integer less than or equal to 2*sqrt(nSim)+1.

vHyper

6 x 1 vector of hyperparameters. (mu_0,sigma_0^2,a_0,b_0,n_0,S_0). Default values are (0,1000, 1,1,0.01,0.01).

Author

Yasuhiro Omori, Ryuji Hashimoto

References

Omori, Y., Chib, S., Shephard, N., and J. Nakajima (2007), "Stochastic volatility model with leverage: fast and efficient likelihood inference," Journal of Econometrics, 140-2, 425-449.

Takahashi, M., Omori, Y. and T. Watanabe (2022+), Stochastic volatility and realized stochastic volatility models. JSS Research Series in Statistics, in press. Springer, Singapore.

See Also

See also ReportMCMC, sv_pf

Examples

Run this code
set.seed(111)
nobs = 80; # n is often larger than 1000 in practice.
mu = 0; phi = 0.97; sigma_eta = 0.3;
h  = 0;   Y = c();
for(i in 1:nobs){
  eps = rnorm(1, 0, 1)
  eta = rnorm(1, 0, sigma_eta)
  y   = eps * exp(0.5*h)
  h   = mu + phi * (h-mu) + eta
  Y   = append(Y, y)
}

# This is a toy example. Increase nsim and nburn
# until the convergence of MCMC in practice.

nsim = 500; nburn = 100;
vhyper = c(0.0,1000,1.0,1.0,0.01,0.01)
out  = sv_mcmc(Y, nsim, nburn, vhyper)
vmu = out[[1]]; vphi = out[[2]]; vsigma_eta = out[[3]]; mh  = out[[4]];

Run the code above in your browser using DataLab