marg_loglik {mixAR} | R Documentation |
Calculate marginal loglikelihood at high density points of a MAR model.
Description
The function implements the method by Chib (1995) and Chib and Jeliazkov (2001) for calculation of the marginal loglikelihood of a mixture autoregressive model. It automatically finds high density values for model parameters, and evaluates the likelihood at such points.
Usage
marg_loglik(y, model, tau, nsim, prob_mod)
Arguments
y |
a time series (currently a numeric vector). |
model |
object of formal class |
tau |
tuning parameter for Metropolis-Hasting move to update autoregressive parameters. |
nsim |
sample size on which to evaluate highest density values. |
prob_mod |
this is currently the output from |
Details
nsim
is the sample size on which to evaluate highest density
values for each set of parameters. For example, choosing
nsim=1000
results in 1000*(g+3)
(1000 iterations for
each autoregressive component, plus 1000 for mean and scale parameters
and mixing weights).
Value
A list containing the following elements:
marg_loglik |
value of the marginal loglikelihood. |
phi_hd |
set of highest density autoregressive parameters. |
prec_hd |
set of highest density precision parameters. |
mu_hd |
set of highest density mean parameters. |
weig_hd |
set of highest density mixing weights. |
Author(s)
Davide Ravagli
References
Chib S (1995). “Marginal likelihood from the Gibbs output.” J. A. Stat. Ass., 90(432), 1313-1321.
Chib S, Jeliazkov I (2001). “Marginal likelihood from the Metropolis-Hastings output.” J. A. Stat. Ass., 96(453), 270-281.
Examples
prob <- c(0.5, 0.5)
sigma <- c(1, 2)
arco <- list(-0.5, 1)
model <- new("MixARGaussian", prob = prob, scale = sigma, arcoef = arco)
set.seed(1234)
y <- mixAR_sim(model, 250, rep(0, max(model@order)), nskip = 100) # data
nsim <- 10 # 50
marg_loglik(y, model, tau = c(.15, .25), nsim = nsim, 0.5)