Discrete uniform distribution with min \(a\) and max \(b\).

pUnifD(q, min = 0, max = 1)

dUnifD(x, min = 0, max = 1)

varUnifD(min = 0, max = 1)

expValUnifD(min = 0, max = 1)

Arguments

min, max

lower and upper limits of the distribution. Must be finite.

x, q

vector of quantiles.

Value

Function :

  • dUnifD gives the probability density function (PDF).

  • pUnifD gives the cumulative density function (CDF).

  • expValUnifD gives the expected value.

  • varUnifD gives the variance.

Invalid parameter values will return an error detailing which parameter is problematic.

Details

The (discrete) uniform distribution with min and max parameters \(a\) and \(b\) respectively has density: $$\textrm{Pr}\left(X = x \right) = \frac{1}{b - a + 1}$$ for \(x \in \{a, a + 1, \dots, b - 1, b\}\).

Examples

pUnifD(q = 0.2, min = 0, max = 1)
#> [1] 0.5

dUnifD(min = 0, max = 1)
#> [1] 0.5

varUnifD(min = 0, max = 1)
#> [1] 0.25

expValUnifD(min = 0, max = 1)
#> [1] 0.5