Fit an ARIMA(p,d,q) model with a Bayesian MCMC analysis. Wraps the shared C++ ARIMAAnalysis.
Usage
arima_analysis(
data,
order_p = 1L,
order_d = 0L,
order_q = 1L,
include_intercept = TRUE,
training_time_steps = NULL,
forecasting_time_steps = 0L,
sampler = "DEMCz",
iterations = 3000L,
output_length = 10000L,
credible_level = 0.9,
seed = 12345L,
thinning_interval = -1L
)Arguments
- data
numeric vector of the observed time series (in sequence order).
- order_p
autoregressive order (default
1).- order_d
differencing order (default
0).- order_q
moving-average order (default
1).- include_intercept
logical; include an intercept term (default
TRUE).- training_time_steps
number of leading steps used for calibration; when
NULLthe model default (max(30, floor(0.8 * n))) is used, which is invalid for short series – set it explicitly (e.g.15) whennis small.- forecasting_time_steps
number of steps to forecast past the observed series (default
0).- sampler
MCMC sampler:
"DEMCz"(default),"DEMCzs","ARWMH", or"NUTS".- iterations
number of post-warmup MCMC iterations.
- output_length
number of posterior samples used to build the credible band.
- credible_level
credible-interval width (e.g.
0.90for a 90% band).- seed
PRNG seed for the sampler (fixed for reproducibility).
- thinning_interval
MCMC thinning interval;
-1(default) keeps the sampler's own default.
Value
A named list with the same shape as ar_analysis().
Examples
x <- c(10.2, 11.5, 9.8, 12.1, 13.4, 11.9, 10.6, 12.8, 14.0, 13.1, 11.7, 12.5, 13.9, 15.2,
14.1, 12.9, 13.6, 15.0, 16.2, 14.8)
fit <- arima_analysis(x, order_p = 1, order_d = 1, order_q = 1, training_time_steps = 15,
forecasting_time_steps = 3, iterations = 100, output_length = 200,
seed = 12345, thinning_interval = 1)
fit$aic
#> [1] 61.73414