Package: posterior 1.6.0

Paul-Christian Bürkner

posterior: Tools for Working with Posterior Distributions

Provides useful tools for both users and developers of packages for fitting Bayesian models or working with output from Bayesian models. The primary goals of the package are to: (a) Efficiently convert between many different useful formats of draws (samples) from posterior or prior distributions. (b) Provide consistent methods for operations commonly performed on draws, for example, subsetting, binding, or mutating draws. (c) Provide various summaries of draws in convenient formats. (d) Provide lightweight implementations of state of the art posterior inference diagnostics. References: Vehtari et al. (2021) <doi:10.1214/20-BA1221>.

Authors:Paul-Christian Bürkner [aut, cre], Jonah Gabry [aut], Matthew Kay [aut], Aki Vehtari [aut], Måns Magnusson [ctb], Rok Češnovar [ctb], Ben Lambert [ctb], Ozan Adıgüzel [ctb], Jacob Socolar [ctb], Noa Kallioinen [ctb]

posterior_1.6.0.tar.gz
posterior_1.6.0.zip(r-4.5)posterior_1.6.0.zip(r-4.4)posterior_1.6.0.zip(r-4.3)
posterior_1.6.0.tgz(r-4.4-any)posterior_1.6.0.tgz(r-4.3-any)
posterior_1.6.0.tar.gz(r-4.5-noble)posterior_1.6.0.tar.gz(r-4.4-noble)
posterior_1.6.0.tgz(r-4.4-emscripten)posterior_1.6.0.tgz(r-4.3-emscripten)
posterior.pdf |posterior.html
posterior/json (API)
NEWS

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

Peer review:

Bug tracker:https://github.com/stan-dev/posterior/issues

On CRAN:

bayesbayesianmcmc

16.05 score 167 stars 319 packages 3.6k scripts 48k downloads 131 exports 19 dependencies

Last updated 8 days agofrom:d0f8b762b5. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 11 2024
R-4.5-winOKNov 11 2024
R-4.5-linuxOKNov 11 2024
R-4.4-winOKNov 11 2024
R-4.4-macOKNov 11 2024
R-4.3-winOKNov 11 2024
R-4.3-macOKNov 11 2024

Exports:%**%%in%as_drawsas_draws_arrayas_draws_dfas_draws_listas_draws_matrixas_draws_rvarsas_rvaras_rvar_factoras_rvar_integeras_rvar_logicalas_rvar_numericas_rvar_orderedautocorrelationautocovariancebind_drawscdfchain_idsdefault_convergence_measuresdefault_mcse_measuresdefault_summary_measuresdiagdissentdraw_idsdraws_arraydraws_dfdraws_listdraws_matrixdraws_ofdraws_of<-draws_rvarsdropEentropyess_basicess_bulkess_meaness_medianess_quantileess_sdess_tailexample_drawsextract_variableextract_variable_arrayextract_variable_matrixfor_each_drawis_drawsis_draws_arrayis_draws_dfis_draws_listis_draws_matrixis_draws_rvarsis_rvaris_rvar_factoris_rvar_orderediteration_idsmadmatchmcse_meanmcse_medianmcse_quantilemcse_sdmerge_chainsmodal_categorymutate_variablesnchainsndrawsniterationsnvariablesorder_drawspareto_convergence_ratepareto_diagspareto_khatpareto_khat_thresholdpareto_min_sspareto_smoothPrps_convergence_rateps_khat_thresholdps_min_ssps_tail_lengthquantile2r_scalerdorename_variablesrepair_drawsresample_drawsreserved_variablesrfunrhatrhat_basicrhat_nestedrstarrvarrvar_allrvar_anyrvar_applyrvar_factorrvar_ifelservar_is_finitervar_is_infinitervar_is_narvar_is_nanrvar_madrvar_maxrvar_meanrvar_medianrvar_minrvar_orderedrvar_prodrvar_quantilervar_rangervar_rngrvar_sdrvar_sumrvar_varsdset_variablessplit_chainssubset_drawssummarise_drawssummarize_drawsthin_drawsu_scalevarvariablesvariables<-varianceweight_drawsz_scale

Dependencies:abindbackportscheckmateclidistributionalfansigenericsgluelifecyclemagrittrmatrixStatsnumDerivpillarpkgconfigrlangtensorAtibbleutf8vctrs

Pareto-khat diagnostics

Rendered frompareto_diagnostics.Rmdusingknitr::rmarkdownon Nov 11 2024.

Last update: 2024-06-28
Started: 2024-06-28

rvar: The Random Variable Datatype

Rendered fromrvar.Rmdusingknitr::rmarkdownon Nov 11 2024.

Last update: 2023-11-19
Started: 2021-03-25

The posterior R package

Rendered fromposterior.Rmdusingknitr::rmarkdownon Nov 11 2024.

Last update: 2024-06-28
Started: 2021-05-22

Readme and manuals

Help Manual

Help pageTopics
Tools for working with posterior (and prior) distributionsposterior-package posterior
Coerce to a random variableas_rvar as_rvar_integer as_rvar_logical as_rvar_numeric
Coerce to a factor random variableas_rvar_factor as_rvar_ordered
Bind 'draws' objects togetherbind_draws bind_draws.draws_array bind_draws.draws_df bind_draws.draws_list bind_draws.draws_matrix bind_draws.draws_rvars
Cholesky decomposition of random matrixchol.rvar
Matrix diagonals (including for random variables)diag,rvar-method
List of available convergence diagnosticsconvergence diagnostics
Dissentiondissent dissent.default dissent.rvar
Transform to 'draws' objectsas_draws draws is_draws
The 'draws_array' formatas_draws_array as_draws_array.default as_draws_array.draws_array as_draws_array.draws_df as_draws_array.draws_list as_draws_array.draws_matrix as_draws_array.draws_rvars as_draws_array.mcmc as_draws_array.mcmc.list draws_array is_draws_array
The 'draws_df' formatas_draws_df as_draws_df.data.frame as_draws_df.default as_draws_df.draws_array as_draws_df.draws_df as_draws_df.draws_list as_draws_df.draws_matrix as_draws_df.draws_rvars as_draws_df.mcmc as_draws_df.mcmc.list draws_df is_draws_df
The 'draws_list' formatas_draws_list as_draws_list.default as_draws_list.draws_array as_draws_list.draws_df as_draws_list.draws_list as_draws_list.draws_matrix as_draws_list.draws_rvars as_draws_list.mcmc as_draws_list.mcmc.list draws_list is_draws_list
The 'draws_matrix' formatas_draws_matrix as_draws_matrix.default as_draws_matrix.draws_array as_draws_matrix.draws_df as_draws_matrix.draws_list as_draws_matrix.draws_matrix as_draws_matrix.draws_rvars as_draws_matrix.mcmc as_draws_matrix.mcmc.list draws_matrix is_draws_matrix
Get/set array of draws underlying a random variabledraws_of draws_of<-
The 'draws_rvars' formatas_draws_rvars as_draws_rvars.default as_draws_rvars.draws_array as_draws_rvars.draws_df as_draws_rvars.draws_list as_draws_rvars.draws_matrix as_draws_rvars.draws_rvars as_draws_rvars.list as_draws_rvars.mcmc as_draws_rvars.mcmc.list draws_rvars is_draws_rvars
Summaries of 'draws' objectsdefault_convergence_measures default_mcse_measures default_summary_measures draws_summary summarise_draws summarise_draws.draws summarise_draws.rvar summarize_draws summary.draws summary.rvar
Index 'draws' objectschain_ids draws-index draw_ids iteration_ids nchains ndraws niterations
Drop redundant dimensionsdrop,rvar-method
Normalized entropyentropy entropy.default entropy.rvar
Basic version of the effective sample sizeess_basic ess_basic.default ess_basic.rvar
Bulk effective sample size (bulk-ESS)ess_bulk ess_bulk.default ess_bulk.rvar
Effective sample size for the meaness_mean ess_mean.default ess_mean.rvar
Effective sample sizes for quantilesess_median ess_quantile ess_quantile.default ess_quantile.rvar
Effective sample size for the standard deviationess_sd ess_sd.default ess_sd.rvar
Tail effective sample size (tail-ESS)ess_tail ess_tail.default ess_tail.rvar
Example 'draws' objectsexample_draws
Extract draws of a single variableextract_variable extract_variable.default extract_variable.draws extract_variable.draws_df extract_variable.draws_list extract_variable.draws_rvars
Extract array of a single (possibly indexed) variableextract_variable_array extract_variable_array.default extract_variable_array.draws
Extract matrix of a single variableextract_variable_matrix extract_variable_matrix.default extract_variable_matrix.draws extract_variable_matrix.draws_df extract_variable_matrix.draws_list extract_variable_matrix.draws_rvars
Loop over drawsfor_each_draw
Is 'x' a random variable?is_rvar
Is 'x' a factor random variable?is_rvar_factor is_rvar_ordered
Value Matching%in% match match.default match.rvar
Monte Carlo standard error for the meanmcse_mean mcse_mean.default mcse_mean.rvar
Monte Carlo standard error for quantilesmcse_median mcse_quantile mcse_quantile.default mcse_quantile.rvar
Monte Carlo standard error for the standard deviationmcse_sd mcse_sd.default mcse_sd.rvar
Merge chains of 'draws' objectsmerge_chains merge_chains.draws_array merge_chains.draws_df merge_chains.draws_list merge_chains.draws_matrix merge_chains.draws_rvars merge_chains.rvar
Modal categorymodal_category modal_category.default modal_category.rvar
Mutate variables in 'draws' objectsmutate_variables mutate_variables.draws_array mutate_variables.draws_df mutate_variables.draws_list mutate_variables.draws_matrix mutate_variables.draws_rvars
Order 'draws' objectsorder_draws order_draws.draws_array order_draws.draws_df order_draws.draws_list order_draws.draws_matrix order_draws.draws_rvars order_draws.rvar
Pareto smoothing diagnosticspareto_convergence_rate pareto_convergence_rate.default pareto_convergence_rate.rvar pareto_diags pareto_diags.default pareto_diags.rvar pareto_khat_threshold pareto_khat_threshold.default pareto_khat_threshold.rvar pareto_min_ss pareto_min_ss.default pareto_min_ss.rvar
Pareto khat diagnosticpareto_khat pareto_khat.default pareto_khat.rvar
Pareto smoothingpareto_smooth pareto_smooth.default pareto_smooth.rvar
Print 'draws_array' objectsprint.draws_array
Print 'draws_df' objectsprint.draws_df
Print 'draws_list' objectsprint.draws_list
Print 'draws_matrix' objectsprint.draws_matrix
Print 'draws_rvars' objectsprint.draws_rvars
Print summaries of 'draws' objectsprint.draws_summary
Print or format a random variableformat.rvar print.rvar str.rvar
Pareto convergence rateps_convergence_rate
Pareto k-hat thresholdps_khat_threshold
Pareto-smoothing minimum sample-sizeps_min_ss
Pareto tail lengthps_tail_length
Compute Quantilesquantile2 quantile2.default quantile2.rvar
Execute expressions of random variablesrdo
Rename variables in 'draws' objectsrename_variables rename_variables.draws
Repair indices of 'draws' objectsrepair_draws repair_draws.draws_array repair_draws.draws_df repair_draws.draws_list repair_draws.draws_matrix repair_draws.draws_rvars repair_draws.rvar
Resample 'draws' objectsresample_draws resample_draws.draws resample_draws.rvar
Reserved variablesreserved_variables reserved_variables.default reserved_variables.draws_array reserved_variables.draws_df reserved_variables.draws_list reserved_variables.draws_matrix reserved_variables.draws_rvars
Create functions of random variablesrfun
Rhat convergence diagnosticrhat rhat.default rhat.rvar
Basic version of the Rhat convergence diagnosticrhat_basic rhat_basic.default rhat_basic.rvar
Nested Rhat convergence diagnosticrhat_nested rhat_nested.default rhat_nested.rvar
Calculate R* convergence diagnosticrstar
Random variables of arbitrary dimensionrvar
Random variable resulting from a function applied over margins of an array or random variablervar_apply
Factor random variables of arbitrary dimensionrvar_factor rvar_ordered
Random variable ifelservar_ifelse
Special value predicates for random variablesrvar_is_finite rvar_is_infinite rvar_is_na rvar_is_nan
Create random variables from existing random number generatorsrvar_rng
Density, CDF, and quantile functions of random variablescdf.rvar cdf.rvar_factor cdf.rvar_ordered density.rvar density.rvar_factor quantile.rvar quantile.rvar_factor quantile.rvar_ordered rvar-dist
Matrix multiplication of random variables%**% matrixOps.rvar rvar-matmult
Random variable slicingrvar-slice [.rvar [<-.rvar [[.rvar [[<-.rvar
Summaries of random variables within array elements, over drawsall.rvar any.rvar E is.finite.rvar is.infinite.rvar is.na.rvar is.nan.rvar mad mad.default mad.rvar mad.rvar_ordered max.rvar mean.rvar median.rvar min.rvar Pr Pr.default Pr.logical Pr.rvar prod.rvar range.rvar rvar-summaries-over-draws sd sd.default sd.rvar sum.rvar Summary.rvar var var.default var.rvar variance.rvar
Summaries of random variables over array elements, within drawsrvar-summaries-within-draws rvar_all rvar_any rvar_mad rvar_max rvar_mean rvar_median rvar_min rvar_prod rvar_quantile rvar_range rvar_sd rvar_sum rvar_var
Split Chainssplit_chains
Subset 'draws' objectssubset.draws subset_draws subset_draws.draws_array subset_draws.draws_df subset_draws.draws_list subset_draws.draws_matrix subset_draws.draws_rvars subset_draws.rvar
Thin 'draws' objectsthin thin_draws thin_draws.draws thin_draws.rvar
Get variable names from 'draws' objectsnvariables variables variables.draws_array variables.draws_df variables.draws_list variables.draws_matrix variables.draws_rvars
Set variable names in 'draws' objectsset_variables variables<- variables<-.draws_array variables<-.draws_df variables<-.draws_list variables<-.draws_matrix variables<-.draws_rvars
Weight 'draws' objectsweight_draws weight_draws.draws_array weight_draws.draws_df weight_draws.draws_list weight_draws.draws_matrix weight_draws.draws_rvars
Extract Weights from Draws Objectsweights.draws