Skip to contents

Simulation i of the result is simulation i of model k, with k drawn with probability weights[k] from stream i of seed. Rows stay whole, so sums across components remain coherent. Use weights from stacking_weights() or pseudo_bma_weights().

Usage

blend_predictive(models, weights, seed)

Arguments

models

A list of predictive_distributions with the same keys and number of simulations.

weights

Non-negative weights, one per model, or a matrix with one row per component; normalized.

seed

Seed, a whole number.

Details

With a matrix of weights (one row per component, one column per model, as hierarchical_stacking() gives them) each component draws its model from the simulation's common uniform against its own weights, so components with equal weights take the same model.

Examples

a <- predictive_distribution(matrix(0, 1000, 1), data.frame(lob = "x"))
b <- predictive_distribution(matrix(1, 1000, 1), data.frame(lob = "x"))
mean(blend_predictive(list(a, b), c(0.25, 0.75), seed = 7))
#> [1] 0.765