Learn R Programming

RVCompare (version 0.1.8)

uniformDensity: The probability density function of the uniform distribution

Description

Returns the density function of the uniform distribution in the interval (xlims[[1]], xlims[[2]]). The returned function is a single parameter function that returns the probability of the uniform distribution in that point. It is just a convinient wrapper of dunif from the package 'stat' with some parameter checks.

Usage

uniformDensity(xlims)

Value

Returns a callable function with a single parameter that rerturns the probability of the uniform distribution in each point.

Arguments

xlims

a tuple representing the interval of nonzero probability of the distribution.

See Also

Other probability density distributions: normalDensity()

Examples

Run this code
dist <- uniformDensity(c(-2,2))
dist(-3)
dist(0)
dist(1)

Run the code above in your browser using DataLab