Extracts posterior predicted values from a list of class bayesnecfit or bayesmanecfit model fits and compares these across a vector of fitted values.

compare_fitted(x, resolution = 50, x_range = NA, make_newdata = TRUE, ...)

Arguments

x

A named list of objects of class bayesnecfit or bayesmanecfit returned by bnec.

resolution

The number of unique x values over which to find ECx – large values will make the ECx estimate more precise.

x_range

A range of x values over which to consider extracting ECx.

make_newdata

Should the user allow the package to create newdata for predictions? If so, arguments resolution and x_range will be used. Defaults to TRUE. See details.

...

Further arguments that control posterior predictions via posterior_epred.

Value

A named list containing bootstrapped differences in posterior predictions of the bayesnecfit or bayesmanecfit model fits contained in x. See Details.

Details

The argument make_newdata is relevant to those who want the package to create a data.frame from which to make predictions. This is done via bnec_newdata and uses arguments resolution and x_range. If make_newdata = FALSE and no additional newdata argument is provided (via ...), then the predictions are made for the raw data. Else, to generate predictions for a specific user-specific data.frame, set make_newdata = FALSE and provide an additional data.frame via the newdata argument. For guidance on how to structure newdata, see for example posterior_epred.

See also

Examples

if (FALSE) { # \dontrun{
library(bayesnec)
data(manec_example)
nec4param <- pull_out(manec_example, model = "nec4param")
ecx4param <- pull_out(manec_example, model = "ecx4param")
compare_fitted(list("nec" = ecx4param, "ecx" = nec4param))
} # }