combine_preds: Combine Multiple Prediction Results

View source: R/combine_preds.R

combine_predsR Documentation

Combine Multiple Prediction Results

Description

Combines multiple prediction results (e.g., from grey prediction, time series, or machine learning models) into a single prediction using a similarity-based weighting approach, improving prediction accuracy.

Usage

combine_preds(x)

Arguments

x

Numeric vector, prediction results to be combined (length >= 2).

Details

The function combines prediction results by constructing a similarity matrix based on cosine transformation of pairwise differences. Weights are derived from the principal eigenvector of the similarity matrix, ensuring predictions closer to each other have higher influence. For two predictions, equal weights (0.5, 0.5) are used. If all predictions are identical, equal weights are assigned. Compatible with the mathmodels package for enhancing prediction models, including grey prediction, time series, or ensemble machine learning.

Value

A list with two elements:

  • a: Numeric, the combined prediction value.

  • w: Numeric vector, weights for each prediction in x, summing to 1.

Examples

# Example: Combine three prediction results
preds = c(100, 102, 98)  # E.g., from grey prediction, ARIMA, or ML models
combine_preds(preds)

zhjx19/mathmodels documentation built on June 2, 2025, 12:18 a.m.