% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pmm2_ts_design.R
\name{create_sarma_matrix}
\alias{create_sarma_matrix}
\title{Create design matrix for seasonal ARMA model}
\usage{
create_sarma_matrix(
  x,
  residuals,
  p = 0,
  P = 0,
  q = 0,
  Q = 0,
  s = 12,
  multiplicative = FALSE
)
}
\arguments{
\item{x}{Numeric vector (centered time series)}

\item{residuals}{Numeric vector (initial residuals/innovations)}

\item{p}{Non-seasonal AR order (default 0)}

\item{P}{Seasonal AR order (default 0)}

\item{q}{Non-seasonal MA order (default 0)}

\item{Q}{Seasonal MA order (default 0)}

\item{s}{Seasonal period (e.g., 12 for monthly data)}

\item{multiplicative}{Logical, include multiplicative cross-terms (default FALSE)}
}
\value{
Design matrix with lagged values. Columns are ordered as:
\itemize{
\item First p columns: non-seasonal AR lags \eqn{(y_{t-1}, \dots, y_{t-p})}
\item Next P columns: seasonal AR lags \eqn{(y_{t-s}, \dots, y_{t-Ps})}
\item Next q columns: non-seasonal MA lags \eqn{(\epsilon_{t-1}, \dots, \epsilon_{t-q})}
\item Next Q columns: seasonal MA lags \eqn{(\epsilon_{t-s}, \dots, \epsilon_{t-Qs})}
\item If multiplicative=TRUE: AR cross-terms then MA cross-terms
}
}
\description{
Constructs a design matrix for Seasonal ARMA (SARMA) models,
combining non-seasonal and seasonal AR and MA components.
}
\details{
For a SARMA(p,q) x (P,Q)_s model:
\deqn{y_t = \phi_1 y_{t-1} + \dots + \phi_p y_{t-p} +
            \Phi_1 y_{t-s} + \dots + \Phi_P y_{t-Ps} +
            \theta_1 \epsilon_{t-1} + \dots + \theta_q \epsilon_{t-q} +
            \Theta_1 \epsilon_{t-s} + \dots + \Theta_Q \epsilon_{t-Qs} + \epsilon_t.}

Where:
\itemize{
\item p, P are non-seasonal and seasonal AR orders
\item q, Q are non-seasonal and seasonal MA orders
\item s is the seasonal period
}
}
\examples{
\donttest{
# Simple SARMA(1,0) x (1,0)_12 model (AR+SAR, no MA)
x <- rnorm(120)
residuals <- rnorm(120)
X <- create_sarma_matrix(x, residuals, p = 1, P = 1, q = 0, Q = 0, s = 12)

# Full SARMA(1,1) x (1,1)_12 model
X <- create_sarma_matrix(x, residuals, p = 1, P = 1, q = 1, Q = 1, s = 12)
}
}
