dpqr | R Documentation |
Produces the family of d/p/q/r functions associated with a custom one-dimensional distribution function; similarly to the standard families dnorm/pnorm/qnorm/rnorm, dunif/punif/...
dpqr(fun, min, max)
fun |
distribution function of a single variable; does not have to be normalized |
min , max |
domain of distribution function; outside this domain |
Returns a list of items:
d(x) |
Probability distribution function (PDF), i.e. a normalised version of |
p(x) |
Cumulative distributiont function, defined as the integrated PDF up to x. |
q(p) |
Quantile function, returning the position x, at which the cumulative probability equals |
r(n) |
A vector of |
Danail Obreschkow
rng
, contourlevel
f = function(x) sin(x)
rsin = dpqr(f,0,pi)$r
x = rsin(1e3)
hist(x,freq=FALSE)
curve(sin(x)/2,0,pi,add=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.