Returns the candidate holding the most model weight in an object of class bayesmanecfit, as an object of class bayesnecfit. An object that is already a bayesnecfit is returned unchanged, so the caller does not have to test the class first.

pull_best(object, ...)

Arguments

object

An object of class bayesnecfit, bayesmanecfit or bayesnechurdlefit as returned by bnec, or of class bayesnecjointfit as returned by bnec_joint, or of class bayesnecgroupfit as returned by bnec_group.

...

Refused except for level on a grouped fit.

Value

For a bayesmanecfit, an object of class bayesnecfit. For a bayesnecfit, object unchanged. For a bayesnechurdlefit, an object of the same class with each component reduced to its own highest-weighted model. For a bayesnecjointfit, object unchanged, because each level already has a single equation, the one its own model weights favoured when bnec_joint chose it. For a bayesnecgroupfit, a named list of selected bayesnecfit objects by level, or one such fit when level names a level.

Details

The highest-weighted candidate contributes most to the model-averaged estimate, so its fit is the one normally inspected with pp_check and check_fit.

The weight selected on is reported with the number of candidates it was selected from: the highest weight of a flat set of ten candidates is little more than the equal share of 0.1. No threshold is applied; summary prints the whole weights table. Where two or more candidates hold exactly the same highest weight, the first in the order of the set is returned and the tie is reported.

On an ordinary, hurdle or joint fit, any other argument is refused. To rebuild a fit at a different x_range, resolution, sig_val or loo_controls, use pull_out with a model name, or amend. The selected equation is reported for a bayesnecfit as well; suppressMessages silences it.

A bayesnechurdlefit is handled one component at a time and rewrapped, as screen_models and amend already do for that class. The two components may select different equations: the survival component is 0-1 bounded and the growth component need not be, so they do not hold the same candidates, let alone weight them alike.

Examples

if (FALSE) { # \dontrun{
library(bayesnec)
data(manec_example)
best <- pull_best(manec_example)
check_fit(best)
# a bayesnecfit is returned unchanged, so this is safe on either class
pull_best(best)
} # }