Package: SBC 0.3.0.9000

Angie.H Moon

SBC: Simulation Based Calibration for rstan/cmdstanr models

SBC helps perform Simulation Based Calibration on Bayesian models. SBC lets you check for bugs in your model code and/or algorithm that fits the model. SBC focuses on models built with 'Stan' <https://mc-stan.org>, but can support other modelling languages as well.

Authors:Shinyoung Kim [aut], Angie.H Moon [aut, cre], Martin Modrák [aut], Teemu Säilynoja [aut], Luna Fazio [ctb]

SBC_0.3.0.9000.tar.gz
SBC_0.3.0.9000.zip(r-4.5)SBC_0.3.0.9000.zip(r-4.4)SBC_0.3.0.9000.zip(r-4.3)
SBC_0.3.0.9000.tgz(r-4.4-any)SBC_0.3.0.9000.tgz(r-4.3-any)
SBC_0.3.0.9000.tar.gz(r-4.5-noble)SBC_0.3.0.9000.tar.gz(r-4.4-noble)
SBC_0.3.0.9000.tgz(r-4.4-emscripten)SBC_0.3.0.9000.tgz(r-4.3-emscripten)
|SBC.html
SBC/json (API)

# Install 'SBC' in R:
install.packages('SBC', repos = c('https://test.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/hyunjimoon/sbc/issues

On CRAN:

diagnosticssimulation-based-inference

5.46 score 54 stars 72 scripts 68 exports 54 dependencies

Last updated 9 months agofrom:9ddc803105 (on v0.3.0). Checks:ERROR: 1 WARNING: 6. Indexed: no.

TargetResultDate
Doc / VignettesFAILNov 05 2024
R-4.5-winWARNINGNov 05 2024
R-4.5-linuxWARNINGNov 05 2024
R-4.4-winWARNINGNov 05 2024
R-4.4-macWARNINGNov 05 2024
R-4.3-winWARNINGNov 05 2024
R-4.3-macWARNINGNov 05 2024

Exports:bind_datasetsbind_derived_quantitiesbind_generated_quantitiesbind_resultscalculate_prior_sdcalculate_ranks_draws_matrixcalculate_sds_draws_matrixcheck_all_SBC_diagnosticscjs_distcombine_all_variablescombine_array_elementscompute_dquantscompute_gen_quantscompute_resultscompute_SBCdata_for_ecdf_plotsdefault_chunk_sizedefault_cores_per_fitderived_quantitiesdraws_rvars_to_standatadraws_rvars_to_standata_singleempirical_coveragegenerate_datasetsgenerated_quantitiesget_diagnostic_messagesmax_diffplot_contractionplot_coverageplot_coverage_diffplot_ecdfplot_ecdf_diffplot_rank_histplot_sim_estimatedrank2unifrecompute_SBC_statisticsrecompute_statisticsSBC_backend_brmsSBC_backend_brms_from_generatorSBC_backend_cmdstan_sampleSBC_backend_cmdstan_variationalSBC_backend_default_thin_ranksSBC_backend_hash_for_cacheSBC_backend_iid_drawsSBC_backend_mockSBC_backend_mock_rngSBC_backend_rjagsSBC_backend_rstan_optimizingSBC_backend_rstan_sampleSBC_datasetsSBC_diagnostic_messagesSBC_example_backendSBC_example_generatorSBC_example_resultsSBC_fitSBC_fit_to_diagnosticsSBC_fit_to_draws_matrixSBC_generator_brmsSBC_generator_customSBC_generator_functionSBC_print_example_modelSBC_resultsSBC_statistics_from_single_fitset2setvalidate_derived_quantitiesvalidate_generated_quantitiesvalidate_SBC_datasetsvalidate_SBC_resultswasserstein

Dependencies:abindbackportscachemcheckmateclicodetoolscolorspacecpp11digestdistributionaldplyrfansifarverfastmapfuturefuture.applygenericsggplot2globalsgluegtableisobandlabelinglatticelifecyclelistenvmagrittrMASSMatrixmatrixStatsmemoisemgcvmunsellnlmenumDerivparallellypillarpkgconfigposteriorpurrrR6RColorBrewerrlangscalesstringistringrtensorAtibbletidyrtidyselectutf8vctrsviridisLitewithr

Readme and manuals

Help Manual

Help pageTopics
Subset an 'SBC_datasets' object.[.SBC_datasets
Subset the results.[.SBC_results
Combine multiple datasets together.bind_datasets
Combine two lists of derived quantitiesbind_derived_quantities
Combine two sets globals for use in derived quantities or backendbind_globals
Combine multiple SBC results together.bind_results
Calculate prior standard deviation of a datasetcalculate_prior_sd
Calculate ranks given variable values within a posterior distribution.calculate_ranks_draws_matrix
Check diagnostics and issue warnings when those fail.check_all_SBC_diagnostics check_all_SBC_diagnostics.default check_all_SBC_diagnostics.SBC_results
Cumulative Jensen-Shannon divergencecjs_dist
Helper functions to be passed to ECDF-plots to combine variables in a single panel.combine_all_variables combine_array_elements
Combine two named lists and overwrite elements with the same name using the value from args2combine_args
Compute derived quantities based on given data and posterior draws.compute_dquants
Fit datasets and evaluate diagnostics and SBC metrics.compute_SBC
Maybe not export in the end? Useful for debuggingdata_for_ecdf_plots
Determines the default chunk size.default_chunk_size
Determines the default cores per single fit.default_cores_per_fit
Create a definition of derived quantities evaluated in R.derived_quantities
Compute observed coverage of posterior credible intervals.empirical_coverage
Generate datasets.generate_datasets
Get diagnostic messages for 'SBC_results' or other objects.get_diagnostic_messages
Guess the number of bins for 'plot_rank_hist()'.guess_rank_hist_bins
Max difference between binned samples with the same lengthmax_diff
Prior/posterior contraction plot.plot_contraction
Plot the observed coverage and its uncertainty.plot_coverage plot_coverage_diff
Plot the ECDF-based plots.plot_ecdf plot_ecdf_diff
Plot rank histogram of an SBC results.plot_rank_hist
Plot the simulated "true" values versus posterior estimatesplot_sim_estimated
Distance between binned draws (rank for SBC) and discrete uniformrank2unif
Recompute SBC statistics without refitting models.recompute_SBC_statistics
Build a backend based on the 'brms' package.SBC_backend_brms
Build a brms backend, reusing the compiled model from a previously created 'SBC_generator_brms' object.SBC_backend_brms_from_generator
Backend based on sampling via 'cmdstanr'.SBC_backend_cmdstan_sample
Backend based on variational approximation via 'cmdstanr'.SBC_backend_cmdstan_variational
S3 generic to get backend-specific default thinning for rank computation.SBC_backend_default_thin_ranks SBC_backend_default_thin_ranks.default
Get hash used to identify cached results.SBC_backend_hash_for_cache
S3 generic to let backends signal that they produced independent draws.SBC_backend_iid_draws SBC_backend_iid_draws.default
A mock backend.SBC_backend_mock
Create a JAGS backend using 'rjags'SBC_backend_rjags
SBC backend using the 'optimizing' method from 'rstan'.SBC_backend_rstan_optimizing
SBC backend using the 'sampling' method from 'rstan'.SBC_backend_rstan_sample
Create new 'SBC_datasets' object.SBC_datasets
Construct a backend to be used in the examples.SBC_example_backend
Construct a generator used in the examples.SBC_example_generator
Combine an example backend with an example generator to provide full results that can be used to test other functions in the package.SBC_example_results
S3 generic using backend to fit a model to data.SBC_fit
S3 generic to get backend-specific diagnostics.SBC_fit_to_diagnostics
S3 generic converting a fitted model to a 'draws_matrix' object.SBC_fit_to_draws_matrix SBC_fit_to_draws_matrix.default
Create a brms generator.SBC_generator_brms
Wrap a function the creates a complete dataset.SBC_generator_custom
Generate datasets via a function that creates a single dataset.SBC_generator_function
Print the Stan code of a model used in the examples.SBC_print_example_model
Create an 'SBC_results' objectSBC_results
Recompute SBC statistics given a single fit.SBC_statistics_from_single_fit
Summarize relational property of overall prior and posterior drawsset2set
Validate a definition of derived quantities evaluated in R.validate_derived_quantities
wasserstein distance between binned sampleswasserstein