bayes_mixAR {mixAR} | R Documentation |
Bayesian sampling of mixture autoregressive models
Description
Samples parameters of a mixture autoregressive model from respective posterior distributions.
Usage
bayes_mixAR(y, model, fix_shift = FALSE, a = .2, c = 2, tau, nsim, burnin)
Arguments
y |
a time series (currently a numeric vector). |
model |
an object of class |
fix_shift |
should |
a , c |
numeric hyperparameters, default values are from Richardson and Green (1997). |
tau |
|
nsim |
|
burnin |
|
Details
For details see Ravagli and Boshnakov (2020).
Value
a list with following elements:
mix_weights |
a |
scale |
a |
precision |
a |
shift |
a |
mu |
a |
ARcoeff |
a list which elements are matrices, one for each AR component in the mixture. |
acc_rate |
|
n_samp |
the sample size, calculated as |
LatentZ |
the latest Z variables drawn (for utility only). |
n_comp |
the number of components in the mixture. |
fix_shift |
same as input, whether the shift parameter was kept fixed or not. |
Author(s)
Davide Ravagli
References
Richardson S, Green PJ (1997). “On Bayesian Analysis of Mixtures with an Unknown Number of Components.” J. R. Stat. Soc., Ser. B, Stat. Methodol. , 59(4), 731-792.
Ravagli D, Boshnakov GN (2020). “Bayesian analysis of mixture autoregressive models covering the complete parameter space.” 2006.11041, https://arxiv.org/abs/2006.11041.
Examples
prob <- c(0.5, 0.5)
sigma <- c(1, 2)
ar <- list(-0.5, 1)
model <- new("MixARGaussian", prob = prob, scale = sigma, arcoef = ar)
## MAR(1,1) model
y <- mixAR_sim(model, 300, rep(0, max(model@order)))
bayes_mixAR(y, model, fix_shift = FALSE, tau = c(.15,.25), nsim = 20, burnin = 10)