is_discrete: Determine whether a distribution is discrete or continuous

View source: R/is_discrete.R

is_discreteR Documentation

Determine whether a distribution is discrete or continuous

Description

Generic functions for determining whether a certain probability distribution is discrete or continuous, respectively.

Usage

is_discrete(d, ...)

is_continuous(d, ...)

Arguments

d

An object. The package provides methods for distribution objects such as those from Normal() or Binomial() etc.

...

Arguments passed to methods. Unevaluated arguments will generate a warning to catch mispellings or other possible errors.

Details

The generic function is_discrete is intended to return TRUE for every distribution whose entire support is discrete and FALSE otherwise. Analogously, is_continuous is intended to return TRUE for every distribution whose entire support is continuous and FALSE otherwise. For mixed discrete-continuous distributions both methods should return FALSE.

Methods for both generics are provided for all distribution classes set up in this package.

Value

A logical vector indicating whether the distribution(s) in d is/are discrete or continuous, respectively.

Examples

X <- Normal()
is_discrete(X)
is_continuous(X)
Y <- Binomial(size = 10, p = c(0.2, 0.5, 0.8))
is_discrete(Y)
is_continuous(Y)

distributions3 documentation built on Sept. 30, 2024, 9:37 a.m.