% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pmm2_ts_main.R
\name{sar_pmm2}
\alias{sar_pmm2}
\title{Fit Seasonal AR model using PMM2 method}
\usage{
sar_pmm2(
  x,
  order = c(0, 1),
  season = list(period = 12),
  method = "pmm2",
  pmm2_variant = c("unified_global", "unified_iterative", "linearized"),
  include.mean = TRUE,
  multiplicative = FALSE,
  max_iter = 50,
  tol = 1e-06,
  regularize = TRUE,
  reg_lambda = 1e-08,
  verbose = FALSE
)
}
\arguments{
\item{x}{Numeric vector of time series data}

\item{order}{Vector of length 2: c(p, P) where:
\itemize{
\item p: Non-seasonal AR order
\item P: Seasonal AR order
}}

\item{season}{List with seasonal specification: list(period = s)
where s is the seasonal period (e.g., 12 for monthly data with annual seasonality)}

\item{method}{Estimation method: "pmm2" (default), "ols", "css"}

\item{pmm2_variant}{Character string specifying PMM2 implementation variant.
Options: \code{"unified_global"} (default, one-step correction from MLE/CSS),
\code{"unified_iterative"} (full Newton-Raphson), or
\code{"linearized"} (not recommended for SAR models).}

\item{include.mean}{Logical, include intercept/mean term (default TRUE)}

\item{multiplicative}{Logical, use multiplicative form with cross-terms (default FALSE)}

\item{max_iter}{Maximum iterations for PMM2 algorithm (default 50)}

\item{tol}{Convergence tolerance (default 1e-6)}

\item{regularize}{Logical, use regularization for numerical stability (default TRUE)}

\item{reg_lambda}{Regularization parameter (default 1e-8)}

\item{verbose}{Logical, print progress information (default FALSE)}
}
\value{
S4 object of class SARPMM2 containing:
\itemize{
\item coefficients: Estimated AR and SAR parameters
\item residuals: Model residuals/innovations (padded with zeros to match original length)
\item m2, m3, m4: Central moments of residuals
\item convergence: Convergence status
\item iterations: Number of iterations performed
}
}
\description{
Fits a Seasonal Autoregressive (SAR) model using the Polynomial Maximization
Method (PMM2). The model can include both non-seasonal and seasonal AR components.
}
\details{
The SAR model has the form
\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} + \mu + \epsilon_t.}

Where:
\itemize{
\item p is the non-seasonal AR order
\item P is the seasonal AR order
\item s is the seasonal period
\item epsilon_t are innovations (errors)
}

The PMM2 method provides more efficient parameter estimates than OLS when
the innovation distribution is asymmetric (non-Gaussian). The expected
variance reduction is given by g = 1 - c3^2 / (2 + c4), where c3 and c4
are the skewness and excess kurtosis coefficients.

\strong{Variant Recommendations for SAR:}
\itemize{
\item \code{"unified_global"} (default): Fast one-step correction, suitable for most SAR models
\item \code{"unified_iterative"}: Best accuracy for complex seasonal patterns
\item \code{"linearized"}: Not recommended for SAR (designed for MA/SMA)
}
}
\examples{
\donttest{
# Generate synthetic seasonal data
n <- 120
y <- arima.sim(n = n, list(ar = 0.7, seasonal = list(sar = 0.5, period = 12)))

# Fit SAR(1,1)_12 model with PMM2
fit <- sar_pmm2(y, order = c(1, 1), season = list(period = 12))
summary(fit)

# Simple seasonal model (no non-seasonal component)
fit_pure_sar <- sar_pmm2(y, order = c(0, 1), season = list(period = 12))

# Compare with OLS
fit_ols <- sar_pmm2(y, order = c(1, 1), season = list(period = 12), method = "ols")
}

}
\seealso{
\code{\link{ar_pmm2}}, \code{\link{ts_pmm2}}, \code{\link{compare_sar_methods}}
}
