bayesnechurdlefitR/bayesnechurdlefit-class.R
crossed_weights.RdReturns weights over every combination of the growth and survival model sets.
crossed_weights(object)An object of class bayesnechurdlefit.
A matrix of weights, growth models in rows and
survival models in columns.
Because the hurdle likelihood factorises, the expected log
predictive density of a crossed model is the sum of its components'
(elpd(a, b) = elpd_growth(a) + elpd_survival(b)). Under pseudo-BMA,
w_ab is proportional to exp(elpd_a + elpd_b), so the crossed
weights are exactly the outer product of the two components' weights. All
n_growth * n_survival combinations are therefore available from the
two fits alone.
Note this identity is specific to pseudo-BMA. Stacking optimises a different objective whose solution is not generally an outer product; obtaining stacked crossed weights requires building the full pointwise matrix and is not done here.
if (FALSE) { # \dontrun{
library(bayesnec)
data(nec_data)
# code a few individuals as having died
nec_data$y[nec_data$x > 2.5] <- 0
fit <- bnec_hurdle(y ~ crf(x, c("nec3param", "ecx4param")), data = nec_data)
crossed_weights(fit)
} # }