| dpqr | R Documentation |
Generates the standard d, p, q, and r
functions associated with an arbitrary one-dimensional probability density
function, analogous to dnorm/pnorm/qnorm/rnorm
and related families.
dpqr(fun, min, max)
fun |
A non-negative, vectorised function proportional to a probability density. It does not need to be normalised. |
min, max |
Lower and upper bounds of the support. The density is assumed to be zero outside this interval. |
Returns a list with the following functions:
d(x) |
Probability density function (PDF), i.e. a normalised version of |
p(x) |
Cumulative distribution function (CDF). |
q(p) |
Quantile function. |
r(n) |
Generates |
Danail Obreschkow
rng, contourlevel
f = function(x) sin(x)
dist = dpqr(f, 0, pi)
x = dist$r(1000)
hist(x, probability = TRUE)
curve(dist$d(x), add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.