Overview

Pacakge overview and global options

posterior-package posterior

Tools for working with posterior (and prior) distributions

Draws objects and formats

Createdraws objects and convert between supported formats

as_draws() is_draws()

Transform to draws objects

as_draws_array() draws_array() is_draws_array()

The draws_array format

as_draws_df() draws_df() is_draws_df()

The draws_df format

as_draws_list() draws_list() is_draws_list()

The draws_list format

as_draws_matrix() draws_matrix() is_draws_matrix()

The draws_matrix format

as_draws_rvars() draws_rvars() is_draws_rvars()

The draws_rvars format

print(<draws_array>)

Print draws_array objects

print(<draws_df>)

Print draws_df objects

print(<draws_list>)

Print draws_list objects

print(<draws_matrix>)

Print draws_matrix objects

print(<draws_rvars>)

Print draws_rvars objects

print(<draws_summary>)

Print summaries of draws objects

print(<rvar>) format(<rvar>) str(<rvar>)

Print or format a random variable

variables() nvariables()

Get variable names from draws objects

example_draws()

Example draws objects

reserved_variables()

Reserved variables

Working with draws objects

Functions for modifying draws objects and extracting their contents

bind_draws()

Bind draws objects together

extract_variable()

Extract draws of a single variable

extract_variable_array()

Extract array of a single (possibly indexed) variable

extract_variable_matrix()

Extract matrix of a single variable

merge_chains()

Merge chains of draws objects

mutate_variables()

Mutate variables in draws objects

`variables<-`() set_variables()

Set variable names in draws objects

order_draws()

Order draws objects

split_chains()

Split Chains

subset_draws() subset(<draws>)

Subset draws objects

iteration_ids() chain_ids() draw_ids() niterations() nchains() ndraws()

Index draws objects

rename_variables()

Rename variables in draws objects

repair_draws()

Repair indices of draws objects

resample_draws()

Resample draws objects

thin_draws()

Thin draws objects

weight_draws()

Weight draws objects

weights(<draws>)

Extract Weights from Draws Objects

Summarizing and diagnosing draws objects

Compute summary statistics and convergence diagnostics

summarise_draws() summarize_draws() summary(<draws>) summary(<rvar>) default_summary_measures() default_convergence_measures() default_mcse_measures()

Summaries of draws objects

diagnostics convergence

List of available convergence diagnostics

ess_basic()

Basic version of the effective sample size

ess_bulk()

Bulk effective sample size (bulk-ESS)

ess_mean()

Effective sample size for the mean

ess_quantile() ess_median() ess_mean(<default>)

Effective sample sizes for quantiles

ess_sd()

Effective sample size for the standard deviation

ess_tail()

Tail effective sample size (tail-ESS)

rhat()

Rhat convergence diagnostic

rhat_basic()

Basic version of the Rhat convergence diagnostic

rhat_nested()

Nested Rhat convergence diagnostic

mcse_mean()

Monte Carlo standard error for the mean

mcse_quantile() mcse_median()

Monte Carlo standard error for quantiles

mcse_sd()

Monte Carlo standard error for the standard deviation

pareto_diags() pareto_khat_threshold() pareto_min_ss() pareto_convergence_rate()

Pareto smoothing diagnostics

pareto_khat()

Pareto khat diagnostic

pareto_smooth()

Pareto smoothing

ps_convergence_rate()

Pareto convergence rate

ps_khat_threshold()

Pareto k-hat threshold

ps_min_ss()

Pareto-smoothing minimum sample-size

ps_tail_length()

Pareto tail length

quantile2()

Compute Quantiles

rstar()

Calculate R* convergence diagnostic

entropy()

Normalized entropy

dissent()

Dissention

modal_category()

Modal category

Functionality specific to the rvar datatype

The draws_rvar format (a structured list of rvar objects) has the same methods (e.g. bind_draws()) as the other draws formats. For individual rvar objects themselves, however, posterior provides additional functionality.

chol(<rvar>)

Cholesky decomposition of random matrix

density(<rvar>) density(<rvar_factor>) cdf(<rvar>) cdf(<rvar_factor>) cdf(<rvar_ordered>) quantile(<rvar>) quantile(<rvar_factor>) quantile(<rvar_ordered>)

Density, CDF, and quantile functions of random variables

`%**%` matrixOps(<rvar>)

Matrix multiplication of random variables

`[[`(<rvar>) `[[<-`(<rvar>) `[`(<rvar>) `[<-`(<rvar>)

Random variable slicing

E() mean(<rvar>) Pr() median(<rvar>) min(<rvar>) max(<rvar>) sum(<rvar>) prod(<rvar>) all(<rvar>) any(<rvar>) Summary(<rvar>) variance(<rvar>) var() sd() mad() range(<rvar>) is.finite(<rvar>) is.infinite(<rvar>) is.nan(<rvar>) is.na(<rvar>)

Summaries of random variables within array elements, over draws

rvar_mean() rvar_median() rvar_sum() rvar_prod() rvar_min() rvar_max() rvar_sd() rvar_var() rvar_mad() rvar_range() rvar_quantile() rvar_all() rvar_any()

Summaries of random variables over array elements, within draws

rvar()

Random variables of arbitrary dimension

rvar_apply()

Random variable resulting from a function applied over margins of an array or random variable

rvar_factor() rvar_ordered()

Factor random variables of arbitrary dimension

rvar_ifelse()

Random variable ifelse

rvar_is_finite() rvar_is_infinite() rvar_is_nan() rvar_is_na()

Special value predicates for random variables

rvar_rng()

Create random variables from existing random number generators

is_rvar()

Is x a random variable?

is_rvar_factor() is_rvar_ordered()

Is x a factor random variable?

as_rvar() as_rvar_numeric() as_rvar_integer() as_rvar_logical()

Coerce to a random variable

as_rvar_factor() as_rvar_ordered()

Coerce to a factor random variable

rdo()

Execute expressions of random variables

rfun()

Create functions of random variables

draws_of() `draws_of<-`()

Get/set array of draws underlying a random variable

diag(<rvar>)

Matrix diagonals (including for random variables)

drop(<rvar>)

Drop redundant dimensions

for_each_draw()

Loop over draws

match() `%in%`

Value Matching