bayes_mixAR | R Documentation |
Samples parameters of a mixture autoregressive model from respective posterior distributions.
bayes_mixAR(y, model, fix_shift = FALSE, a = .2, c = 2, tau, nsim, burnin)
y |
a time series (currently a numeric vector). |
model |
an object of class |
fix_shift |
should |
a , c |
numeric hyperparameters, default values are from \insertCiteRichardsonGreen1997;textualmixAR. |
tau |
|
nsim |
|
burnin |
|
For details see \insertCiteravagli2020bayesian;textualmixAR.
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. |
Davide Ravagli
RichardsonGreen1997mixAR
\insertRefravagli2020bayesianmixAR
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.