bayesGARCH {bayesGARCH} | R Documentation |
Performs the Bayesian estimation of the GARCH(1,1) model with Student-t innovations.
bayesGARCH(y, mu.alpha = c(0,0), Sigma.alpha = 1000 * diag(1,2), mu.beta = 0, Sigma.beta = 1000, lambda = 0.01, delta = 2, control = list())
y |
vector of observations of size T. NA values are not allowed. |
mu.alpha |
hyperparameter mu_alpha (prior mean) for the truncated Normal prior on parameter alpha:=(alpha0 alpha1)'. Default: a 2x1 vector of zeros. |
Sigma.alpha |
hyperparameter Sigma_alpha (prior covariance matrix) for the truncated Normal prior on parameter alpha. Default: a 2x2 diagonal matrix whose variances are set to 1'000, i.e., a diffuse prior. Note that the matrix must be symmetric positive definite. |
mu.beta |
hyperparameter mu_beta (prior mean) for the truncated Normal prior on parameter beta. Default: zero. |
Sigma.beta |
hyperparameter Sigma_beta>0 (prior variance) for the truncated Normal prior on paramter beta. Default: 1'000, i.e., a diffuse prior. |
lambda |
hyperparameter lambda>0 for the translated Exponential distribution on parameter nu. Default: 0.01. |
delta |
hyperparameter delta>=2 for the translated Exponential distribution on parameter nu. Default: 2 (to ensure the existence of the conditional variance). |
control |
list of control parameters (See *Details*). |
The function bayesGARCH
performs the Bayesian estimation of the
GARCH(1,1) model with Student-t innovations. The underlying algorithm is based on Nakatsuma
(1998, 2000) for generating the parameters of the GARCH(1,1) scedastic
function alpha:=(alpha0 alpha1)' and beta and on
Geweke (1993) and Deschamps (2006) for the generating the degrees of freedom
parameter nu. Further details and examples can be found in Ardia (2008).
The control
argument is a list that can supply any of
the following components:
description{
n.chain
n.chain=1
.l.chain
l.chain=10000
.start.val
start.val=c(0.01,0.1,0.7,20)
. A matrix of
size nx4
containing starting values in rows can also be provided. This will generate n chains starting at the
different row values.refresh
refresh=10
iterations.digits
digits=4
.
A list of class mcmc.list
(R package coda).
The GARCH(1,1) model with Student-t innovations may be written as follows:
y(t) = e(t)*(varrho * h(t))^(1/2)
for t=1,...,T, where the conditional variance equation is defined as:
h(t) := alpha0 + alpha1 * y(t-1)^2 + beta * h(t-1)
where alpha0>0,alpha1,beta>=0 to ensure a positive conditional variance. We set the initial variance to h(0):=0 for convenience. The parameter varrho:=(nu-2)/nu is a scaling factor which ensures the conditional variance of y(t) to be h(t). Finally, e(t) follows a Student-t distribution with nu degrees of freedom.
The prior distributions on alpha is a bivariate truncated Normal distribution:
p(alpha) prop N2(alpha | mu_alpha, Sigma_alpha) I[alpha>0]
where mu_alpha is the prior mean vector, Sigma_alpha is the prior covariance matrix and I[alpha>0] is the indicator function.
The prior distribution on beta is a univariate truncated Normal distribution:
p(theta) prop N(beta | mu_beta, Sigma_beta) I[beta>0]
where mu_beta is the prior mean and Sigma_beta is the prior variance.
The prior distribution on nu is a translated Exponential distribution:
p(nu) = lambda * exp(-lambda(nu-delta)) I[nu>delta]
where lambda>0 and delta>=2. The prior mean for nu is delta + 1/lambda.
The joint prior on parameter psi:=(alpha,beta,nu) is obtained by assuming prior independance:
p(psi) = p(alpha) * p(beta) * p(nu).
The default hyperparameters mu_alpha, Sigma_alpha, mu_beta, Sigma_beta and lambda define a rather vague prior. The hyperparameter delta>=2 ensures the existence of the conditional variance. The kth conditional moment for e(t) is guaranteed by setting delta>=k.
The Bayesian estimation of the GARCH(1,1) model with Normal
innovations is obtained as a special case by setting lambda=100
and delta=500
. In
this case, the generated values for
nu are centered around 500 which ensure approximate Normality
for the innovations.
!!! WARNING !!!
For some time series, the sampler can get stuck to a given
value so that the chain doesn't move anymore. In this case, run the sampler again with a
different seed or a different starting value. Good starting values can
be obtained using the function garchFit
(R package fGarch).
Please cite the package in publications. Use citation("bayesGARCH")
.
David Ardia <david.ardia@unifr.ch>
Ardia, D. (2008) `Financial Risk Management with Bayesian Estimation of GARCH Models', Springer (LNEMS 612), ISBN: 978-3-540-78656-6, e-ISBN: 978-3-540-78657-3, DOI: 10.1007/978-3-540-78657-3, URL~http://www.springer.com/economics/econometrics/book/978-3-540-78656-6
Ardia, D. (2008) `Bayesian Estimation of the GARCH(1,1) Model with Student-t Innovations in R. The package bayesGARCH', Working paper, Departement of Quantitative Economics, University of Fribourg, Switzerland.
Ardia, D. (2006) `Bayesian Estimation of the GARCH(1,1) Model with Normal Innovations', Student 5(3–4), 283–298.
Deschamps, P. J. (2006) `A Flexible Prior Distribution for Markov Switching Autoregressions with Student-t Errors', Journal of Econometrics 133, 153–190.
Geweke, J. F. (1993) `Bayesian Treatment of the Independent Student-t Linear Model', Journal of Applied Econometrics 8, S19–S40.
Nakatsuma, T. (1998) `A Markov-Chain Sampling Algorithm for GARCH Models', Studies in Nonlinear Dynamics and Econometrics 3(2), 107–117.
Nakatsuma, T. (2000) `Bayesian Analysis of ARMA-GARCH Models: A Markov Chain Sampling Approach', Journal of Econometrics 95(1), 57–69.
addPriorConditions
to integrate additional prior
conditions on the model parameters in the sampler;
garchFit
(R package fGarch) for the classical
Maximum Likelihood estimation of GARCH models.
## LOAD DATA data(dem2gbp) y <- dem2gbp[1:750] ## RUN THE SAMPLER (2 chains) MCMC <- bayesGARCH(y, control = list(n.chain = 2, l.chain = 2000)) ## MCMC ANALYSIS (using coda) plot(MCMC) autocorr.diag(MCMC) gelman.diag(MCMC) 1-rejectionRate(MCMC) ## FORM THE POSTERIOR SAMPLE smpl <- formSmpl(MCMC, l.bi = 500) ## POSTERIOR STATISTICS summary(smpl) smpl <- as.matrix(smpl) pairs(smpl) ## GARCH(1,1) WITH NORMAL INNOVATIONS MCMC <- bayesGARCH(y, lambda = 100, delta = 500, control = list(n.chain = 2, l.chain = 2000))