Learn R Programming

narfima (version 0.1.0)

auto_nbsts: Fitting a NBSTS Model

Description

This function fits Neural Bayesian Structural Time Series (NBSTS) model to a univariate time series. It follows the same architecture as narfima, but replaces the ARFIMA component with a BSTS framework. By default, the state specification includes a semilocal linear trend component and a seasonal component with 12 periods. The model is estimated using MCMC sampling with 1000 iterations by default. This function is intended for ablation studies to benchmark the performance of narfima against alternatives.

Usage

auto_nbsts(
  y,
  er,
  ss,
  xreg = NULL,
  p,
  q,
  P = 1,
  size,
  skip,
  niter = 1000,
  repeats = 1000,
  lambda = 0.5,
  lambdae = 0.5,
  scale.inputs = TRUE,
  ...
)

Value

Returns an object of class "narfima" with the same structure as narfima, but using BSTS residuals instead of ARFIMA residuals.

Arguments

y

A numeric vector or time series of class ts.

er

A numeric vector or time series object representing the series of residuals. If missing, it will be calculated from a BSTS model.

ss

A BSTS state specification list. By default, a semilocal linear trend and seasonal components are added using y.

xreg

An optional numeric matrix of exogenous variables to be included in the model (default is NULL).

p

Integer indicating the number of lags of the input series y.

q

Integer indicating the number of lags of the errors er.

P

Integer indicating the number of seasonal lags of the input series y (default is 1).

size

Integer specifying the number of nodes of the feed-forward neural networks with a single hidden layer.

skip

Logical value indicating whether to use the direct connections in the neural network (default is TRUE).

niter

Integer specifying the number of MCMC iterations for fitting the BSTS model (default is 1000).

repeats

Integer specifying the number of times to fit the neural network model (default is 1000).

lambda

Numeric value for the Box-Cox transformation parameter of y (default is 0.5).

lambdae

Numeric value for the Box-Cox transformation parameter of er (default is 0.5).

scale.inputs

Logical value indicating whether to standardize the inputs before fitting the model (default is TRUE).

...

Additional arguments passed to auto_nbsts.