dpqr {estimators}R Documentation

The d p q r Functions

Description

Four generic functions that take a distribution object (e.g. Bern) and return the density, cumulative probability, quantile, and random generator functions, respectively.

Usage

d(x, ...)

p(x, ...)

qn(x, ...)

r(x, ...)

Arguments

x

an object of subclass Distribution.

...

extra arguments.

Value

The d p q r functions return the density, cumulative probability, quantile, and random generator functions, respectively.

Examples

# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------

library(estimators)

# Create the distribution
x <- Beta(3, 5)

# Density function
df <- d(x)
df(c(0.3, 0.8, 0.5))

# Probability function
pf <- p(x)
pf(c(0.3, 0.8, 0.5))

# Density function
qf <- qn(x)
qf(c(0.3, 0.8, 0.5))

# Random Generator function
rf <- r(x)
rf(5)

[Package estimators version 0.8.5 Index]