Skip to contents

Bayesian estimation via adaptive MCMC (RAM or ARWMH).

Usage

caviar(
  y,
  q_alpha = 0.05,
  model = 5,
  nsim = 1e+05,
  n_chains = 1,
  method = "ram",
  burn_in = 0.5,
  theta_seed = NULL
)

Arguments

y

Numeric vector of returns

q_alpha

Quantile level (default 0.05)

model

Integer 1-5: SAV, AS, GARCH, Adaptive, T-CAViaR (default 5)

nsim

MCMC iterations (default 1e5)

n_chains

Number of sequential chains (default 1)

method

"ram" or "amcmc" (default "ram")

burn_in

Fraction in (0,1) (default 0.5)

theta_seed

Starting values (default NULL)

Value

List: theta_hat, chain, method, model, q_alpha, batch_theta_hat

Details

VaR estimates are negative for lower quantiles following standard financial convention where VaR represents potential loss.

The MCMC sampler includes bounds checking. Parameters leading to non-finite log-likelihoods are automatically rejected. GARCH variance estimates falling outside valid ranges reset to the empirical quantile.

References

Engle & Manganelli (2004) JBES 22(4):367-381 Vihola (2012) Stat Comput 22(5):997-1008 Atchadé & Rosenthal (2005) Bernoulli 11(5):815-828

Examples

# \donttest{
data(gerlach)
fit <- caviar(gerlach[, "USD"], nsim = 1000)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
# }