Learn R Programming

rethinking (version 2.13)

ensemble: Simulate an ensemble of posterior predictions

Description

Uses link and sim for a list of map or map2stan model fits to construct Akaike weighted ensemble of predictions.

Usage

ensemble( ... , data , n=1e3 , func=WAIC , weights , WAIC=TRUE , refresh=0 , 
          replace=list() , do_link=TRUE , do_sim=TRUE )

Arguments

...

map or map2stan models

data

Optional data to compute predictions over, as in link and sim

n

Number of samples to draw from posterior for each model

func

Function to use in computing criterion for model weights

weights

Optional vector of weights to use. If present, func is ignored.

WAIC

Deprecated: If TRUE, use func to compute weights. Otherwise tries to use DIC.

refresh

Progress update refresh interval. 0 suppresses output.

replace

Optional named list with replacement posterior samples. Used for maginalizing over random effects, for example. See example in link.

do_link

If TRUE, compute and return link results

do_sim

If TRUE, compute and return sim results

Value

Details

This function calls link and sim for each fit model given as input. The results are then combined into ensemble link and simulation output, where samples from each model are represented in proportion to the Akaike weights. Akaike weights are calculated by compare, using func, unless an explicit vector weights is provided. The values in weights will be normalized to sum to one, if they do not already.

Note that no averaging is done by this function. Parameters are not averaged, and predictions are not averaged.

See Also

link, sim, compare