Package: neuralsbi 0.6.83

neuralsbi: Neural Simulation-Based Inference

A native R implementation of neural simulation-based inference (SBI) methods. Given a prior over parameters and a simulator, 'neuralsbi' trains a conditional neural density estimator for likelihood-free Bayesian inference: Neural Posterior Estimation approximates the posterior directly and samples it in a forward pass, Neural Likelihood Estimation learns a surrogate likelihood that is sampled with MCMC, handles repeated independent observations, and can be exported as 'Stan' code for use inside a larger model, and Neural Ratio Estimation trains a classifier for the likelihood-to-evidence ratio instead of either density. Neural estimators run on the 'torch' back end. This package is developed for applied researchers who want an R-native approachable SBI interface with sensible defaults and built-in posterior diagnostics.

Authors:Pedro Nascimento de Lima [aut, cre]

neuralsbi_0.6.83.tar.gz
neuralsbi_0.6.83.zip(r-4.7-any)neuralsbi_0.6.83.zip(r-4.6-any)neuralsbi_0.6.83.zip(r-4.5-any)
neuralsbi_0.6.83.tgz(r-4.6-any)neuralsbi_0.6.83.tgz(r-4.5-any)
neuralsbi_0.6.83.tar.gz(r-4.7-any)neuralsbi_0.6.83.tar.gz(r-4.6-any)
neuralsbi_0.6.83.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
neuralsbi/json (API)

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

Bug tracker:https://github.com/pedroliman/neuralsbi/issues

Pkgdown/docs site:https://neuralsbi.pedrodelima.com

On CRAN:

Conda:

5.11 score 1 stars 199 downloads 52 exports 0 dependencies

Last updated from:48817e3e98. Checks:6 OK, 3 ERROR. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK407
source / vignettesOK227
linux-releaseOK283
macos-releaseOK239
macos-oldrelOK303
windows-develERROR392
windows-releaseERROR456
windows-oldrelERROR442
wasm-releaseOK142

Exports:c2stembedding_mlpexpected_coveragelikelihood_fnload_nleload_npeload_nrelog_liklog_problog_ratiomap_estimatenlenpenpe_sequentialnrepairplotplot_coverageplot_posterior_predictiveplot_sbcplot_tarpposteriorposterior_predictiveprior_betaprior_cauchyprior_customprior_exponentialprior_gammaprior_half_cauchyprior_half_normalprior_independentprior_lognormalprior_normalprior_student_tprior_truncatedprior_uniformsamplesample_posteriorsample_priorsave_nlesave_npesave_nresbcsimulate_for_sbistan_codestan_datatarptask_gaussian_lineartask_sirtask_slcptask_two_moonswithin_supportwrite_stan_model

Dependencies:

Guide to neural SBI methods
Key papers | Neural posterior estimation (NPE) | Sequential neural posterior estimation | Neural likelihood estimation (NLE) | Neural likelihood-ratio estimation (NRE) | Density estimators | Mixture density network (MDN) | Masked autoregressive flow (MAF) | Neural spline flow (NSF) | Diagnostics | Simulation-based calibration (SBC) | Expected coverage | TARP | Classifier two-sample test (C2ST) | References

Last update: 2026-08-22
Started: 2026-08-21

Getting started with neuralsbi
Inputs to neural posterior estimation: A simulator and a prior distribution | Define your simulator | Train your neural posterior estimator | Condition on your data to get a posterior | Amortized Posterior Inference

Last update: 2026-08-21
Started: 2026-07-20

Readme and manuals

Help Manual

Help pageTopics
Classifier two-sample test (C2ST)c2st
Conditional density estimatorsdensity_estimator
Posterior diagnosticsdiagnostics
Embedding (summary) networks for structured observationsembedding_mlp
Expected coverage of central credible intervalsexpected_coverage
A surrogate likelihood as a plain R functionlikelihood_fn
Evaluate a surrogate likelihoodlog_lik log_lik.nsbi_nle
Posterior log-densitylog_prob log_prob.nsbi_mcmc_posterior log_prob.nsbi_posterior
Evaluate a learned likelihood-to-evidence ratiolog_ratio log_ratio.nsbi_nre
Maximum a posteriori (MAP) estimatemap_estimate
Neural Likelihood Estimation (NLE)nle
Neural Posterior Estimation (NPE)npe
Sequential NPE with truncated-prior proposals (TSNPE)npe_sequential
Neural Ratio Estimation (NRE)nre
MCMC over a learned likelihoodnsbi_mcmc
Running the simulator in parallelnsbi_parallel
Progress reportingnsbi_progress
The simulator contractnsbi_simulator
Visualize posterior samplespairplot
Plot nominal vs. empirical credible-interval coverageplot_coverage
Plot posterior predictive checksplot_posterior_predictive
Plot an SBC rank histogramplot_sbc
Plot TARP expected coverageplot_tarp
Posterior objectsposterior posterior.default posterior.nsbi_npe
Posterior predictive drawsposterior_predictive
Posterior from a neural likelihoodposterior.nsbi_nle
Posterior from a neural ratioposterior.nsbi_nre
Build a prior from arbitrary sampling / density functionsprior_custom
Named prior familiesprior_beta prior_cauchy prior_exponential prior_families prior_gamma prior_half_cauchy prior_half_normal prior_lognormal prior_student_t
Combine independent priors into one joint priorprior_independent
Independent normal priorprior_normal
Truncate a prior to a boxprior_truncated
Box-uniform (independent uniform) priorprior_uniform
Priors for neural simulation-based inferencepriors
Draw samples (S3 generic)sample sample.default
Sample from a posterior (non-generic alias)sample_posterior
Draw samples from a priorsample_prior
Sample an MCMC posteriorsample.nsbi_mcmc_posterior
Sample from a posteriorsample.nsbi_posterior
Save and reload a fitted modelload_nle load_npe load_nre save_nle save_npe save_nre
Simulation-Based Calibration (SBC)sbc
Run a simulator over prior drawssimulate_for_sbi
Export a learned likelihood to Stanstan_code stan_data stan_export write_stan_model
Summaries and tidy accessorsas.data.frame.nsbi_samples summaries summary.nsbi_nle summary.nsbi_npe summary.nsbi_nre summary.nsbi_posterior summary.nsbi_samples
TARP expected coveragetarp
Benchmark taskstasks task_gaussian_linear task_sir task_slcp task_two_moons
Test whether parameters lie within the prior supportwithin_support