% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/auto_modal_arima.R
\name{auto.modal.arima}
\alias{auto.modal.arima}
\title{Automatic selection of Parametric Modal ARIMA model}
\usage{
auto.modal.arima(
  y,
  d = NA,
  max.p = 5,
  max.q = 5,
  ic = c("aic", "bic"),
  dist = c("normal", "t", "laplace")
)
}
\arguments{
\item{y}{numeric vector or time series of observations}

\item{d}{Integer, degree of differencing. If NA, it's determined automatically.}

\item{max.p}{Maximum AR order}

\item{max.q}{Maximum MA order}

\item{ic}{Information criterion to be used in model selection ("aic", "bic")}

\item{dist}{Character string specifying the error distribution.
\code{"normal"} (default) for Skew-Normal, \code{"t"} for Skewed Student-t,
\code{"laplace"} for Skewed Laplace.}
}
\value{
An object of class \code{modal_arima}.
}
\description{
Automatic selection of Parametric Modal ARIMA model
}
\details{
This function performs a grid search over AR and MA orders to find the
optimal Modal ARIMA model based on the selected information criterion (AIC or BIC).
}
\note{
GitHub repository: \url{https://github.com/chedgala/ModalForecast}
}
\examples{
library(forecast)

# 1. Load Empirical Data (Lynx)
data(lynx)
y <- log10(lynx)

# 2. Find the best SKD Error Distribution (Normal vs T vs Laplace) 
fit_n <- fit_modal_arima(y, order = c(2, 0, 0), dist = "normal")
fit_t <- fit_modal_arima(y, order = c(2, 0, 0), dist = "t")
fit_l <- fit_modal_arima(y, order = c(2, 0, 0), dist = "laplace")
c(Normal = AIC(fit_n), Student = AIC(fit_t), Laplace = AIC(fit_l))

# 3. Auto Model Selection globally on the winning distribution (Skew-Normal)
fit_auto <- auto.modal.arima(y, d=0, max.p=2, max.q=2, dist="normal")

# 4. Summary & Inferences
summary(fit_auto)

# 5. Run residual diagnostics and Envelopes
diagnostics(fit_auto)
envelope(fit_auto, B=10)

# 6. Produce forecasts with multiple prediction bands (alphas)
pred <- forecast(fit_auto, h=5, level = c(80, 95))

# 7. Native integration with 'forecast' ecosystem
autoplot(pred)    
accuracy(pred)
}
\references{
Galarza, C. E., Lachos, V. H., Cabral, C. R. B., and Castro, L. M. (2017).
Robust quantile regression using a generalized class of skewed distributions.
Stat, 6(1), 113-130.
}
\seealso{
\code{\link{fit_modal_arima}}
}
