Tools for working with random draws from a distribution, eg draws from a posterior distribution in a Bayesian analysis.
Details
An rvec holds multiple draws, but wherever possible
behaves like an ordinary R vector. For instance, if x
is an rvec holding 1000 draws from a distribution,
then 2 * x
returns a new rvec where each draw has
been multiplied by 2.
To summarise across draws, use a function starting with draws
.
For instance, to calculate a credible interval, use draws_ci()
.
Functions
Creating rvecs
rvec()
Class depends on inputrvec_dbl()
Doublesrvec_int()
Integersrvec_lgl()
Logicalrvec_chr()
Charactercollapse_to_rvec()
Data in data framenew_rvec()
Blanks
Manipulating rvecs
if_else_rvec()
if_else()
wherecondition
is rvecmap_rvec()
map()
for rvecsextract_draw()
Single draw from rvec
Probability distributions
dbeta_rvec()
Betadbinom_rvec()
Binomialdcauchy_rvec()
Cauchydchisq_rvec()
Chi-squaredexp_rvec()
Exponentialdgamma_rvec()
Gammadgeom_rvec()
Geometricdhyper_rvec()
Hypergeometricdlnorm_rvec()
Lognormaldmultinom()
Multinomialdnbinom_rvec()
Negative binomialdnorm_rvec()
Normaldpois_rvec()
Poissondt_rvec()
Student's Tdunif_rvec()
Uniformdweibull_rvec()
Weibull
Summarizing across draws
draws_all()
All drawsdraws_any()
Any drawsdraws_min()
Minimum drawdraws_max()
Maximum drawdraws_median()
Median drawdraws_mean()
Mean drawdraws_mode()
Modal drawdraws_ci()
Credible intervalsdraws_quantile()
Quantilesdraws_fun()
Arbitrary functionn_draw()
Number of draws
Coercion, classes
as_list_col()
Rvec or matrix to listexpand_from_rvec()
Inverse ofcollapse_to_rvec()
is_rvec()
Object an rvec?
Weighted summaries
weighted_mad()
Weighted mean absolute deviationweighted_mean()
Weighted meanweighted_median()
Weighted medianweighted_sd()
Weighted standard deviationweighted_var()
Weighted variances
Datasets
divorce()
Divorce ratesreg_post()
Regression coefficients
Author
Maintainer: John Bryant john@bayesiandemography.com
Other contributors:
Bayesian Demography Limited [copyright holder]