Learn R Programming

algebraic.dist (version 0.9.1)

density.empirical_dist: 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 empirical_dist
density(x, ...)

Value

A function computing the empirical PMF at given points.

Arguments

x

The object to obtain the pdf of.

...

Additional arguments to pass into the pdf function.

Examples

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

Run the code above in your browser using DataLab