Skip to contents

Create an R function which behaves like the probability mass function (PMF) of a given ddf distribution.

Usage

pmf(dist)

Arguments

dist

A ddf object, the distribution.

Value

A function.

Details

The probability mass function \(p_X\) of a discrete random variable \(X\) is given by $$p_X(x) = \mathbb{P}[X = x],$$ where \(\mathbb{P}\) is the probability operator.

Examples

# Get probability of 5 in a geometric distribution
pmf(geometric(0.4))(5)
#> [1] 0.031104