dst_empirical.Rd
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.
dst_empirical(y, data, weights = 1, ...)
<data-masking
>
Outcomes to comprise the distribution. Should either
evaluate to an (atomic) vector, or be a name in the specified data.
Data frame containing the outcomes y
and/or
weights
. Optional.
<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.
An object of class c("finite", "dst")
.
x <- rnorm(100)
dst_empirical(x)
#> finite dst
#>
#> probabilities :
#> # A tibble: 100 × 2
#> location size
#> <dbl> <dbl>
#> 1 -2.94 0.01
#> 2 -2.46 0.01
#> 3 -2.00 0.01
#> 4 -1.99 0.01
#> 5 -1.83 0.01
#> 6 -1.82 0.01
#> 7 -1.78 0.01
#> 8 -1.77 0.01
#> 9 -1.71 0.01
#> 10 -1.70 0.01
#> # … with 90 more rows
dst_empirical(value, data = data.frame(value = x))
#> finite dst
#>
#> probabilities :
#> # A tibble: 100 × 2
#> location size
#> <dbl> <dbl>
#> 1 -2.94 0.01
#> 2 -2.46 0.01
#> 3 -2.00 0.01
#> 4 -1.99 0.01
#> 5 -1.83 0.01
#> 6 -1.82 0.01
#> 7 -1.78 0.01
#> 8 -1.77 0.01
#> 9 -1.71 0.01
#> 10 -1.70 0.01
#> # … with 90 more rows