marg_loglik | R Documentation |
The function implements the method by \insertCiteChib1995;textualmixAR and \insertCiteChibJeliazkov2001;textualmixAR 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.
marg_loglik(y, model, tau, nsim, prob_mod)
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 |
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).
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. |
Davide Ravagli
Chib1995mixAR
\insertRefChibJeliazkov2001mixAR
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.