Package 'organik'

Title: Multi-Horizon Probabilistic Ensemble with Copulas for Time Series Forecasting
Description: Trains per-horizon probabilistic ensembles from a univariate time series. It supports 'rpart', 'glmnet', and 'kNN' engines with flexible residual distributions and heteroscedastic scale models, weighting variants by calibration-aware scores. A Gaussian/t copula couples the marginals to simulate joint forecast paths, returning quantiles, means, and step increments across horizons.
Authors: Giancarlo Vercellino [aut, cre, cph]
Maintainer: Giancarlo Vercellino <[email protected]>
License: GPL-3
Version: 1.0.1
Built: 2026-05-25 07:53:38 UTC
Source: https://github.com/cran/organik

Help Index


Multi-Horizon Probabilistic Ensemble with Copulas for Time Series Forecasting

Description

Trains per-horizon probabilistic ensembles from a univariate time series. It supports 'rpart', 'glmnet', and 'kNN' engines with flexible residual distributions and heteroscedastic scale models, weighting variants by calibration-aware scores. A Gaussian/t copula couples the marginals to simulate joint forecast paths, returning quantiles, means, and step increments across horizons.

Usage

organik(
  ts,
  horizon,
  n_variants = 10,
  engines = c("rpart", "glmnet", "knn"),
  dists = c("gaussian", "laplace", "student", "logistic", "asymmetric_laplace",
    "skew_normal", "skew_t"),
  h_options = c("tree", "ridge"),
  alpha = 1,
  beta = 1,
  temperature = 1,
  dates = NULL,
  ci = 0.95,
  n_testing = 30,
  seed = 42
)

Arguments

ts

Numeric vector (time series levels).

horizon

Integer, number of steps ahead.

n_variants

Integer, number of model variants per horizon (ensemble size).

engines

Character vector of supported mean-model engines ('rpart', 'glmnet', 'knn').

dists

Character vector of supported residual distributions (gaussian, laplace, student, logistic, asymmetric_laplace, skew_normal, skew_t.

h_options

Character vector for supported heteroscedastic scale models (tree, ridge).

alpha, beta

Numeric weights combining CRPS and calibration error.

temperature

Softmax temperature for ensemble weighting (>0).

dates

Vector for date formats. Default: NULL.

ci

Numeric scalar, confidence interval for plot. Default: 0.9.

n_testing

Backtest spacing used inside components.

seed

Optional integer seed for reproducibility.

Value

A list of class 'c("organik","list")' with elements:

  • 'model_list': list of horizon-wise ensemble models.

  • 'growth_pred_funs': list of marginal predictors for growth.

  • 'level_pred_funs': list of marginal predictors for level.

  • 'cor_mat': horizon-by-horizon correlation (after cleaning / nearPD).

  • 'path_prediction(n_paths, probs, copula=c("gaussian","t"), df, return_increments, seed)': function that simulates joint paths and returns summaries (means, quantiles, cumulative growth paths, level paths, and incremental returns if requested).

  • 'plot': plot with prediction in the confidence interval.

Author(s)

Maintainer: Giancarlo Vercellino [email protected] [copyright holder]

See Also

Useful links:

Examples

set.seed(1)
y <- cumsum(rnorm(200, sd = 0.5)) + 10
obj <- organik(y, horizon = 4,
  n_variants = 3,
  engines = "knn",
  dists = c("gaussian","laplace"),
  h_options = "tree",
  n_testing = 3, seed = 123)
# joint path simulation for next 4 steps:
path <- obj$path_prediction(n_paths = 100)
str(path$level_quants)