arma: ngme ARMA(p, q) model specification

View source: R/models.R

armaR Documentation

ngme ARMA(p, q) model specification

Description

General ARMA(p, q) latent operator under AZW: K W = Z eps, where K encodes the AR part and Z encodes the MA part.

Usage

arma(
  mesh = NULL,
  ar_order = 1,
  ma_order = 1,
  ar = NULL,
  ma = NULL,
  fix_ar = FALSE,
  fix_ma = FALSE
)

Arguments

mesh

Integer vector or 'inla.mesh.1d' object.

ar_order

Integer p (0, 1, or 2).

ma_order

Integer q (0, 1, or 2).

ar

Numeric length-p vector of AR coefficients in (-1, 1). Defaults to zeros.

ma

Numeric length-q vector of MA coefficients in (-1, 1). Defaults to zeros.

fix_ar

Logical or length-p logical vector to fix AR coefficients.

fix_ma

Logical or length-q logical vector to fix MA coefficients.

Details

- Supports p, q <= 2. The user provides standard AR/MA coefficients (ar, ma). For estimation, these are transformed in R into an unbounded parameter vector 'theta_K' via PACF-style mappings so optimizers (e.g., Adam/SGD) operate on unconstrained variables while K and Z remain valid: - AR(1): phi1 = tanh(raw1/2). AR(2): pi1=tanh(raw1/2), pi2=tanh(raw2/2), phi2 = pi2, phi1 = pi1 * (1 - pi2). - MA(1): theta1 = tanh(raw1/2). MA(2): psi1=tanh(raw1/2), psi2=tanh(raw2/2), theta2 = psi2, theta1 = psi1 * (1 - psi2). - The returned operator includes both K (AR part) and Z (MA part). During estimation the backend updates Z synchronously every time 'theta_K' changes.

Value

An 'ngme_operator' describing the ARMA(p, q) latent model.

Examples

mesh <- 1:10
op <- arma(mesh, ar_order = 2, ma_order = 2, ar = c(0.5, 0.3), ma = c(0.6, 0.4))


ngme2 documentation built on May 20, 2026, 9:10 a.m.