rvec-package {rvec} | R Documentation |
Package 'rvec'
Description
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 input -
rvec_dbl()
Doubles -
rvec_int()
Integers -
rvec_lgl()
Logical -
rvec_chr()
Character -
collapse_to_rvec()
Data in data frame -
new_rvec()
Blanks
Manipulating rvecs
-
if_else_rvec()
if_else()
wherecondition
is rvec -
map_rvec()
map()
for rvecs -
extract_draw()
Single draw from rvec
Probability distributions
-
dbeta_rvec()
Beta -
dbinom_rvec()
Binomial -
dcauchy_rvec()
Cauchy -
dchisq_rvec()
Chi-square -
dexp_rvec()
Exponential -
dgamma_rvec()
Gamma -
dgeom_rvec()
Geometric -
dhyper_rvec()
Hypergeometric -
dlnorm_rvec()
Lognormal -
dmultinom()
Multinomial -
dnbinom_rvec()
Negative binomial -
dnorm_rvec()
Normal -
dpois_rvec()
Poisson -
dt_rvec()
Student's T -
dunif_rvec()
Uniform -
dweibull_rvec()
Weibull
Summarizing across draws
-
draws_all()
All draws -
draws_any()
Any draws -
draws_min()
Minimum draw -
draws_max()
Maximum draw -
draws_median()
Median draw -
draws_mean()
Mean draw -
draws_mode()
Modal draw -
draws_ci()
Credible intervals -
draws_quantile()
Quantiles -
draws_fun()
Arbitrary function -
n_draw()
Number of draws
Coercion, classes
-
as_list_col()
Rvec or matrix to list -
expand_from_rvec()
Inverse ofcollapse_to_rvec()
-
is_rvec()
Object an rvec?
Weighted summaries
-
weighted_mad()
Weighted mean absolute deviation -
weighted_mean()
Weighted mean -
weighted_median()
Weighted median -
weighted_sd()
Weighted standard deviation -
weighted_var()
Weighted variances
Datasets
-
divorce()
Divorce rates -
reg_post()
Regression coefficients
Packages with similar functionality
Author(s)
Maintainer: John Bryant john@bayesiandemography.com
Other contributors:
Bayesian Demography Limited [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/bayesiandemography/rvec/issues