Construct empirical distribution object.
Arguments
- data
data to construct empirical distribution from. if matrix or
data frame, each row is a joint observation, if a vector, each
element is an observation. whatever data is, it must be
convertible to a tibble.
Value
An empirical_dist object.
Examples
# Univariate empirical distribution from a vector
ed <- empirical_dist(c(1, 2, 3, 4, 5))
mean(ed)
#> [1] 3
# Multivariate empirical distribution from a matrix
mat <- matrix(c(1, 2, 3, 4, 5, 6), ncol = 2)
ed_mv <- empirical_dist(mat)
dim(ed_mv)
#> [1] 2