Skip to contents

Fit an ARIMAX model (ARIMA with a deterministic trend and optional exogenous covariates) with a Bayesian MCMC analysis. Wraps the shared C++ ARIMAXAnalysis. Covariate forecasting past the observed range is not exposed; run fit-only (forecasting_time_steps = 0) with covariates.

Usage

arimax_analysis(
  data,
  order_p = 1L,
  order_d = 0L,
  order_q = 0L,
  order_b = 0L,
  trend = "None",
  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 0).

order_b

exogenous-covariate lag order (default 0).

trend

deterministic trend: "None" (default), "Linear", "Quadratic", or "Cubic".

include_intercept

logical; include an intercept term (default TRUE).

training_time_steps

number of leading steps used for calibration; when NULL the model default (max(30, floor(0.8 * n))) is used, which is invalid for short series – set it explicitly (e.g. 15) when n is 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.90 for 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 <- arimax_analysis(x, trend = "Linear", training_time_steps = 15,
                       forecasting_time_steps = 0, iterations = 100, output_length = 200,
                       seed = 12345, thinning_interval = 1)
fit$bic
#> [1] 79.15216