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

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

\item{season}{List with seasonal specification: list(period = s)}

\item{method}{Estimation method: "pmm2" or "css"}

\item{pmm2_variant}{Character string specifying PMM2 implementation variant.
Options: \code{"unified_global"} (default, one-step correction),
\code{"unified_iterative"} (full Newton-Raphson), or
\code{"linearized"} (specialized for MA/SMA models, \strong{recommended for SMA}).}

\item{max_iter}{Maximum iterations for PMM2 algorithm}

\item{tol}{Convergence tolerance}

\item{include.mean}{Include intercept in the model}

\item{na.action}{Function to handle missing values}

\item{regularize}{Add regularization to Jacobian matrix}

\item{reg_lambda}{Regularization parameter}

\item{verbose}{Print diagnostic information}
}
\value{
An S4 object of class \code{SMAPMM2} containing:
\itemize{
\item coefficients: Seasonal MA coefficients (Theta_1, Theta_2, ..., Theta_Q)
\item innovations: Estimated innovations (residuals)
\item m2, m3, m4: Central moments of innovations
\item convergence: Convergence status
\item iterations: Number of iterations performed
\item intercept: Model intercept
\item original_series: Original time series
\item order: Model order list(Q, s)
}
}
\description{
Fits a Seasonal Moving Average (SMA) model using the Polynomial Maximization
Method (PMM2). This is particularly effective when the innovations have
asymmetric or non-Gaussian distributions.
}
\details{
The SMA(Q)_s model has the form
\deqn{y_t = \mu + \epsilon_t + \Theta_1 \epsilon_{t-s} +
            \Theta_2 \epsilon_{t-2s} + \dots + \Theta_Q \epsilon_{t-Qs}.}

Where:
\itemize{
\item Q is the seasonal MA order
\item s is the seasonal period (12 for monthly, 4 for quarterly)
\item epsilon_t are innovations (errors)
}

The PMM2 method provides more efficient parameter estimates than ML/CSS 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 SMA:}
\itemize{
\item \code{"linearized"} (recommended): Fastest and most stable for SMA models,
avoids complex Jacobian computation while maintaining accuracy
\item \code{"unified_global"} (default): Good balance of speed and accuracy
\item \code{"unified_iterative"}: Best accuracy but slower, use for complex SMA patterns
}
}
\examples{
\donttest{
# Generate synthetic seasonal data
set.seed(123)
n <- 120
s <- 12
theta <- 0.6

# Gamma innovations (asymmetric)
innov <- rgamma(n, shape = 2, scale = 1) - 2
y <- numeric(n)
for (t in 1:n) {
  ma_term <- if (t > s) theta * innov[t - s] else 0
  y[t] <- innov[t] + ma_term
}

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

# Compare with CSS
fit_css <- sma_pmm2(y, order = 1, season = list(period = 12), method = "css")
}

}
\seealso{
\code{\link{ma_pmm2}}, \code{\link{sar_pmm2}}, \code{\link{arima_pmm2}}
}
