Returns the models that bnec or amend attempted
and could not fit, together with the priors and initial values that were
used in the attempt.
failed_models(object, ...)An object of class bayesnecfit,
bayesmanecfit, bayesnechurdlefit or
bayesnecgroupfit, as returned by bnec,
bnec_hurdle or bnec_group.
Unused.
An object of class bnecfailures: a named
list, empty if every model fitted. For a
bayesnechurdlefit, a list of two such
objects, one per component. For a bayesnecgroupfit, a
list of such objects named by level, since each level
is fitted by its own call to bnec.
In a model set fitted with many equations, one or two can fail to
fit, and the error scrolls past in the middle of a long run. Diagnosing a failure needs
the prior and the starting values the model was given, which
bnec constructs rather than the user, so both are kept on the
returned object.
Each element is named for the model and holds model, the error
message, the prior (an object of class
brmsprior) and the init used. init is a
list with one element per chain, or the string
"random" where bayesnec's search could not find starting values
inside the range of the response and left initialisation to Stan.
prior and init are NULL where the model failed before
they were built – a formula or data problem rather than a sampling one.
pull_out carries the record across unchanged, since it subsets
a set that has already been fitted rather than refitting it.
c and + keep the failures of every object they
combine, except for an equation that another of those objects fitted and
the combined set therefore holds.
amend instead records only the models that call attempted:
a model that failed before may have been dropped now, or is being retried
there with different priors.
A returned prior is directly usable, so the usual next step is to fit the
failed model on its own with an adjusted version of it, naming the equation
in crf():
f <- failed_models(fit)$nechormepwr
f$message
f$prior
bnec(y ~ crf(x, "nechormepwr"), data = data, prior = f$prior)