sample_ARMA_coef: Sample ARMA coef

View source: R/sample_ARMA_coef.R

sample_ARMA_coefR Documentation

Sample ARMA coef

Description

This function randomly samples the ARMA coefficients of a specified ARMA model. The coefficients are sampled so that the resulting ARMA model is both causal and invertible.

Usage

sample_ARMA_coef(
  order = c(0L, 0L),
  seasonal = list(order = c(0L, 0L), period = NA),
  n = 1,
  Mod_bounds = c(0.05, 0.95),
  min_inv_root_dist = 0
)

Arguments

order

A specification of the non-seasonal part of the ARIMA model: this is different than the order input of stats::arima(), because the degree of differencing is not included. Thus order is a vector of length two of the form (p, q).

seasonal

A specification of the seasonal part of the ARIMA model. Can be either a vector of length 2, or a list with an order component; if a list, a period can be included, but it does not affect the function output.

n

An integer indicating how many sets of ARMA coefficients should be sampled.

Mod_bounds

Bounds on the magnitude of the roots.

min_inv_root_dist

This parameter is included so as to help avoid ARMA models that contain parameter redundancy, if desired. Specifically, this parameter ensures that the minimum distance between any of the inverted roots in the AR and MA polynomials is greater than min_inv_root_dist. Inverted roots that are near each other leads to canceling or nearly canceling roots, effectively reducing the size of the ARMA model.

Details

For an ARMA model to be causal and invertible, the roots of the AR and MA polynomials must lie outside the the complex unit circle. The AR and MA polynomials are defined as:

\phi(z) = 1 - \phi_1 z - \phi_2 z^2 - \ldots - \phi_p z^p

\theta(z) = 1 + \theta_1 z + \theta_2 z^2 + \ldots + \theta_q z^q

where z is a complex number, \phi_1, \ldots, \phi_p are the p AR coefficients of the ARMA model, and \theta_1, \ldots, \theta_p are the q MA coefficients of the ARMA model.

ARMA coefficients are sampled by sampling inverse roots to be inside the complex unit circle, and then calculating the resulting polynomial. To ensure that the resulting polynomial coefficients are real, we only sample half of the needed number of complex roots, and set the remaining half to be the complex conjugate of the sampled points. In the case where the number of coefficients is odd, the remaining root is sampled uniformly, satisfying the Mod_bounds parameter.

Value

a vector of randomly sampled ARMA coefficients.

Examples

{
sample_ARMA_coef(
   order = c(2, 1),
   seasonal = list(order = c(1, 0), period = 2),
   n = 100
)
}

arima2 documentation built on Sept. 11, 2024, 7:49 p.m.