bnecfit objects into one single bayesmanecfit object containing Bayesian model averaging statistics.R/bnecfit-methods.R
c.bnecfit.RdConcatenate multiple bnecfit objects into one single
bayesmanecfit object containing Bayesian model averaging
statistics.
# S3 method for class 'bnecfit'
c(x, ...)An object of class bayesnecfit or
bayesmanecfit.
Further ordinary fits or model sets fitted to the same data.
On a bayesnecfit or bayesmanecfit, a
bayesnecfit where one distinct equation remains, or a
bayesmanecfit otherwise. The abstract bnecfit method
raises an error naming any other class.
The combined set is weighted by the method the objects being
combined were weighted by, where every input that records one names the same
method. Where none records a method — combining two
bayesnecfit objects, for instance — the bayesnec
default of "pseudobma" is used. Where two inputs name different methods the
default is used and a message reports the disagreement.
c takes no loo_controls argument; use
amend to set the weighting method explicitly.
The estimates of the combined set are computed with the x_range,
resolution and sig_val the objects were fitted with, and with
the arguments of their loo_controls other than the method, where
every object that records an argument records the same value. Where two objects record
different values of an argument, the bnec default is used and a
message names the argument. An object fitted by an earlier version of
bayesnec records none of them.
Component models may retain different numbers of posterior draws. The model average draws from each fit in proportion to its model weight, with its total draw count set by the fit with the fewest draws.
Each equation keeps the record of the installation of bayesnec that
fitted it, and a message reports a combined set whose equations were fitted
by different installations. See bnec_version.
The records of what bnec did to each request, and of the
equations that failed to fit, are joined; see bnec_record and
failed_models.
if (FALSE) { # \dontrun{
library(bayesnec)
nec4param <- pull_out(manec_example, model = "nec4param")
ecx4param <- pull_out(manec_example, model = "ecx4param")
# Go from two bayesnecfit objects to a bayesmanecfit object.
# In this example case it is redundant because it recovers the original
# `manec_example`.
c(nec4param, ecx4param)
# Add a bayesnecfit object to an existing bayesmanecfit object
nechorme4 <- nec_data |>
dplyr::mutate(y = qlogis(y)) |>
(\(.)bnec(formula = y ~ crf(x, model = "nechorme4"),
data = ., iter = 200, warmup = 150, chains = 2,
stan_model_args = list(save_dso = FALSE)))()
c(nechorme4, manec_example)
} # }