density.empirical_dist: Method for obtaining the pdf of a 'empirical_dist' object.

View source: R/empirical_dist.R

density.empirical_distR Documentation

Method for obtaining the pdf of a empirical_dist object.

Description

Method for obtaining the pdf of a empirical_dist object.

Usage

## S3 method for class 'empirical_dist'
density(x, ...)

Arguments

x

The object to obtain the pdf of.

...

Additional arguments to pass into the pdf function.

Value

A function computing the empirical PMF at given points.

Note

sort tibble lexicographically and do a binary search to find upper and lower bound in log(nobs(x)) time.

Examples

ed <- empirical_dist(c(1, 2, 2, 3, 3, 3))
f <- density(ed)
f(2)          # 2/6
f(3, log = TRUE) # log(3/6)

algebraic.dist documentation built on Feb. 27, 2026, 5:06 p.m.