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

\item{order}{Model order specification:
- For AR models: a single integer (AR order)
- For MA models: a single integer (MA order)
- For ARMA models: vector c(p, q) (AR and MA orders)
- For ARIMA models: vector c(p, d, q) (AR, differencing, and MA orders)}

\item{method}{String: estimation method, one of "pmm2" (default), "css", "ml", "yw", "ols"}

\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).}

\item{max_iter}{Integer: maximum number of iterations for the algorithm}

\item{tol}{Numeric: tolerance for convergence}

\item{include.mean}{Logical: whether to include a mean (intercept) term}

\item{initial}{List or vector of initial parameter estimates (optional)}

\item{na.action}{Function for handling missing values, default is na.fail}

\item{regularize}{Logical, add small values to diagonal for numerical stability}

\item{reg_lambda}{Regularization parameter (if regularize=TRUE)}

\item{verbose}{Logical: whether to print progress information}
}
\value{
An S4 object of class \code{ARMAPMM2} containing fitted AR and MA
coefficients, residuals, central moments, model specification, intercept,
original series, and convergence diagnostics.
}
\description{
Estimates autoregressive moving-average model parameters using PMM2.
ARMA models combine AR and MA components, capturing both direct past value
dependencies and innovation structure. PMM2 leverages higher moments to
improve parameter estimation accuracy.
}
\details{
\strong{PMM2 Variants:}
\itemize{
\item \code{"unified_global"} (default): One-step correction from MLE/CSS estimates.
Balances speed and accuracy for ARMA models. Recommended for most use cases.
\item \code{"unified_iterative"}: Full Newton-Raphson optimization. Best for
models with complex dynamics or strong non-Gaussian features.
\item \code{"linearized"}: First-order approximation. Generally not recommended
for ARMA; better suited for pure MA/SMA models.
}

\strong{Variant Selection Guidelines:}
\itemize{
\item For ARMA(p,q) with p,q <= 2: Use \code{"unified_global"} (default)
\item For higher-order ARMA or ill-conditioned models: Try \code{"unified_iterative"}
\item For quick exploration: Start with \code{"unified_global"}
}

\strong{ARMA Estimation Challenges:}
ARMA models have more parameters than pure AR or MA models, making estimation
more sensitive to initialization and numerical stability. PMM2 benefits from
robust moment-based constraints that help regularize the parameter space.
}
\examples{
\donttest{
# Fit ARMA(2,1) model
x <- arima.sim(n = 250, list(ar = c(0.7, -0.3), ma = 0.5))
fit1 <- arma_pmm2(x, order = c(2, 1))
coef(fit1)

# Try iterative variant for better accuracy
fit2 <- arma_pmm2(x, order = c(2, 1), pmm2_variant = "unified_iterative")

# Higher-order ARMA
x2 <- arima.sim(n = 300, list(ar = c(0.6, -0.2), ma = c(0.4, 0.3)))
fit3 <- arma_pmm2(x2, order = c(2, 2), pmm2_variant = "unified_global")
}
  
}
\seealso{
\code{\link{ar_pmm2}}, \code{\link{ma_pmm2}}, \code{\link{arima_pmm2}}
}
