dst_empirical: Create an Empirical Distribution

View source: R/dst_empirical.R

dst_empiricalR Documentation

Create an Empirical Distribution

Description

An empirical distribution is a non-parametric way to estimate a distribution using data. By default, it assigns equal probability to all observations (this can be overridden with the weights argument). Identical to dst_finite() with weights as probabilities, except weights need not add to 1.

Usage

dst_empirical(y, data, weights = 1, ...)

Arguments

y

<data-masking> Outcomes to comprise the distribution. Should either evaluate to an (atomic) vector, or be a name in the specified data.

data

Data frame containing the outcomes y and/or weights. Optional.

weights

<data-masking> Weights to assign each outcome in y. Will be normalized so that the weights add up to 1 (unlike dst_finite()), representing probabilities.

...

Additional arguments, currently not used.

Value

An object of class c("finite", "dst").

See Also

dst_finite()

Examples

x <- rnorm(100)
dst_empirical(x)
dst_empirical(value, data = data.frame(value = x))

vincenzocoia/distionary documentation built on March 5, 2024, 3:13 a.m.