% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/reconciliation.R
\name{icomb}
\alias{icomb}
\title{Information combination reconciliation}
\usage{
icomb(
  models,
  train_size,
  alpha = 1,
  standardize = FALSE,
  standardize_response = FALSE,
  intercept = TRUE,
  lambda = NULL,
  lambda_min_ratio = "expand",
  nlambda = 100,
  maxit = 1e+07,
  thresh = 1e-07,
  exact = TRUE
)
}
\arguments{
\item{models}{A column of models in a mable.}

\item{train_size}{The size of the initial training window.}

\item{alpha}{The elasticnet mixing parameter, with \eqn{0 \leq \alpha \leq 1}. The penalty is defined as
\deqn{(1 - \alpha)/2\|B\|_2^2 + \alpha\|B\|_2}
\code{alpha = 1} is the group lasso penalty, and \code{alpha = 0} is the ridge penalty.}

\item{standardize}{Logical flag for \code{x} variable standardization, prior to fitting the model sequence.
The coefficients are always returned on the original scale. Default is \code{standardize = FALSE}.}

\item{standardize_response}{This allows the user to standardize the response variables.
Default is \code{standardize_response = FALSE}.}

\item{intercept}{Should intercepts be fitted (default = TRUE) or set to zero (FALSE).}

\item{lambda}{A user supplied \code{lambda} sequence. Typical usage is to have the program compute its own
\code{lambda} sequence based on \code{nlambda} and \code{lambda_min_ratio}. Supplying a value of \code{lambda} overrides this. Supply a decreasing
sequence of \code{lambda} values.}

\item{lambda_min_ratio}{The smallest value for \code{lambda}, as a fraction of \code{lambda_max}
(the data derived value for which all coefficients are zero). \code{lambda_min_ratio = "expand"} (default) sets the ratio as
\eqn{10^{-\lfloor \log_{10}(\lambda_{max})\rfloor-2}} whereas \code{lambda_min_ratio = "glmnet"} sets the ratio to the value used in the \code{glmnet} package.
If \code{nobs < nvars}, the default is \code{0.01}, otherwise \code{1e-04}.}

\item{nlambda}{The number of lambda values. Default is 100.}

\item{maxit}{Maximum number of passes over the data for all lambda values. Default is \eqn{10^7}.}

\item{thresh}{Convergence threshold for coordinate descent. Each inner coordinate-descent loop continues until the maximum change
in the objective after any coefficient update is less than thresh times the null deviance. Defaults value is 1e-07.}

\item{exact}{A logical flag indicating whether to use a sequence of lambda values (from \code{lambda_max} to \code{lambda_best})
when fitting the final model on the entire dataset.
The functions in the \code{glmnet} package are designed for efficiency by computing the entire regularization path
(a sequence of lambda values) using "warm starts", which is often faster than computing a single fit. The default is \code{TRUE}.}
}
\value{
A 'global' model which is icomb coherent
}
\description{
Implements the Information Combination (IComb) method for forecast reconciliation,
combining information from multiple base forecasts through a regression-based framework
that can be estimated using penalized regression techniques. The penalty parameter is estimated
using the rolling forecast origin cross-validation.
}
\note{
Missing values are removed prior to applying the information combination method.

The default value of \code{lambda_min_ratio} may result in very small values of \eqn{\lambda}, which can increase computation time. It is
therefore recommended to choose this parameter according to the specific requirements of your application.
}
\section{Parallel computing}{


The model fitting and icomb cross-validation procedure can be parallelized using the \href{https://cran.r-project.org/package=future}{future} package.
By specifying a \code{\link[future:plan]{future::plan()}} prior to model estimation or the reconciliation step,
the computations will be carried out according to the chosen future strategy.
}

\section{Progress}{


Progress on the cross-validation procedure can be obtained by wrapping the code with \code{progressr::with_progress()}.
Further customization on how progress is reported can be controlled using the \code{progressr} package.
}

\examples{

library(fable)
library(fabletools)
library(tsibble)
library(dplyr)
library(lubridate)
library(ggtime)

tourism_hts <- tourism |>
  aggregate_key(State,
                Trips = sum(Trips))

fit <- tourism_hts |>
  model(base = ETS(Trips)) |>
  reconcile(ols = min_trace(base, method = "ols"),
            icomb = icomb(base, train_size = 75))

fit |>
  forecast(h = "3 years")

# extracting results from icomb cross-validation
fit |>
  pull(icomb) |>
  attr("icombfit")

\donttest{
# Extracting probabilistic forecasts
fit |>
  forecast(h = "3 years", bootstrap = TRUE, times = 1000) |>
  filter(State == "Victoria") |>
  autoplot(filter(tourism_hts,
                  State == "Victoria", year(Quarter) > 2010))

# grouped structure
tourism_gts <- tourism |>
  aggregate_key(State * Purpose,
                Trips = sum(Trips))

fit <- tourism_gts |>
  model(base = ETS(Trips)) |>
  reconcile(ols = min_trace(base, method = "ols"),
            icomb = icomb(base, train_size = 75))

# Parallelizing cross-validation
library(future)
plan(multisession, workers = 2)

tourism_gts |>
  model(base = ETS(Trips)) |>
  reconcile(ols = min_trace(base, method = "ols"),
            icomb = icomb(base, train_size = 75)) |>
  forecast(h = "3 years")
plan(sequential)

fit <- tourism_gts |>
  model(base = ETS(Trips))

# progress
progressr::with_progress(
fit |>
  reconcile(ols = min_trace(base, method = "ols"),
            icomb = icomb(base, train_size = 35))
  )
}

}
\references{
Nguyen, M., Vahid, F., & Wickramasuriya, S. L. (2025).
Hierarchical Forecasting: The Role of Information Combination (Working Paper No. 11/25).
Department of Econometrics and Business Statistics, Monash University.
}
\seealso{
\code{\link[fabletools:reconcile]{fabletools::reconcile()}}, \code{\link[fabletools:aggregate_key]{fabletools::aggregate_key()}}
}
\author{
Shanika L Wickramasuriya
}
