Datasets

Generating datasets ready for use with SBC and working with them.

bind_datasets()

Combine multiple datasets together.

generate_datasets()

Generate datasets.

SBC_datasets()

Create new SBC_datasets object.

`[`(<SBC_datasets>)

Subset an SBC_datasets object.

SBC_generator_brms()

Create a brms generator.

SBC_generator_custom()

Wrap a function the creates a complete dataset.

SBC_generator_function()

Generate datasets via a function that creates a single dataset.

calculate_prior_sd()

Calculate prior standard deviation of a dataset

Backends

Represent various inference engines you can use with SBC.

SBC_backend_brms()

Build a backend based on the brms package.

SBC_backend_brms_from_generator()

Build a brms backend, reusing the compiled model from a previously created SBC_generator_brms object.

SBC_backend_cmdstan_sample()

Backend based on sampling via cmdstanr.

SBC_backend_cmdstan_variational()

Backend based on variational approximation via cmdstanr.

SBC_backend_default_thin_ranks()

S3 generic to get backend-specific default thinning for rank computation.

SBC_backend_hash_for_cache()

Get hash used to identify cached results.

SBC_backend_iid_draws()

S3 generic to let backends signal that they produced independent draws.

SBC_backend_mock()

A mock backend.

SBC_backend_rstan_optimizing()

SBC backend using the optimizing method from rstan.

SBC_backend_rstan_sample()

SBC backend using the sampling method from rstan.

SBC_fit()

Use backend to fit a model to data.

SBC_fit_to_diagnostics()

S3 generic to get backend-specific diagnostics.

Computation & results

Functions related to running the SBC computation and handling the results.

compute_SBC()

Fit datasets and evaluate diagnostics and SBC metrics.

generated_quantities()

Create a definition of generated quantities evaluated in R.

statistics_from_single_fit()

Recompute SBC statistics given a single fit.

recompute_SBC_statistics()

Recompute SBC statistics without refitting models.

bind_results()

Combine multiple SBC results together.

check_all_SBC_diagnostics()

Check diagnostics and issue warnings when those fail.

plot_coverage()

Plot the observed coverage and its uncertainty

SBC_example_results()

Combine an example backend with an example generator to provide full results that can be used to test other functions in the package.

SBC_results()

SBC_results objects.

`[`(<SBC_results>)

Subset the results.

calculate_ranks_draws_matrix()

Calculate ranks given variable values within a posterior distribution.

get_diagnostic_messages()

Get diagnostic messages for SBC_results or other objects.

SBC_fit_to_diagnostics()

S3 generic to get backend-specific diagnostics.

default_chunk_size()

Determines the default chunk size.

default_cores_per_fit()

Determines the default cores per single fit.

Plotting & Summarising

Plotting and summarising results

data_for_ecdf_plots()

Maybe not export in the end? Useful for debugging

plot_ecdf() plot_ecdf_diff()

Plot the ECDF-based plots.

plot_contraction()

Prior/posterior contraction plot.

plot_coverage()

Plot the observed coverage and its uncertainty

plot_rank_hist()

Plot rank histogram of an SBC results.

plot_sim_estimated()

Plot the simulated "true" values versus posterior estimates

guess_rank_hist_bins()

Guess the number of bins for plot_rank_hist().

empirical_coverage()

Compute observed coverage of posterior credible intervals.

Miscellaneous

wasserstein()

wasserstein distance between binned samples

cjs_dist()

Cumulative Jensen-Shannon divergence

combine_args()

Combine two named lists and overwrite elements with the same name using the value from args2

max_diff()

Max difference between binned samples with the same length

rank2unif()

Distance between binned draws (rank for SBC) and discrete uniform

set2set()

Summarize relational property of overall prior and posterior draws