% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/models.R
\name{arma}
\alias{arma}
\title{ngme ARMA(p, q) model specification}
\usage{
arma(
  mesh = NULL,
  ar_order = 1,
  ma_order = 1,
  ar = NULL,
  ma = NULL,
  fix_ar = FALSE,
  fix_ma = FALSE
)
}
\arguments{
\item{mesh}{Integer vector or `inla.mesh.1d` object.}

\item{ar_order}{Integer p (0, 1, or 2).}

\item{ma_order}{Integer q (0, 1, or 2).}

\item{ar}{Numeric length-p vector of AR coefficients in (-1, 1). Defaults to zeros.}

\item{ma}{Numeric length-q vector of MA coefficients in (-1, 1). Defaults to zeros.}

\item{fix_ar}{Logical or length-p logical vector to fix AR coefficients.}

\item{fix_ma}{Logical or length-q logical vector to fix MA coefficients.}
}
\value{
An `ngme_operator` describing the ARMA(p, q) latent model.
}
\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.
}
\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.
}
\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))

}
