Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/UtilitiesDistributions.R
function to do get empirical density, cumulative distribution and quantile function from random numbers
1  RtoDPQ.d(r, e = getdistrOption("RtoDPQ.e"))

r 
the random number generator 
e 
10^e numbers are generated, a higher number leads to a better result. 
RtoDPQ.d
generates 10^e random numbers, by default e =
RtoDPQ.e
which are used to produce a density, cdf and
quantile function.
Of course, the results are usually not exact as they rely on random numbers.
RtoDPQ returns a list of functions.
dfun 
density 
pfun 
cumulative distribution function 
qfun 
quantile function 
Use RtoDPQ for absolutely continuous and RtoDPQ.d for discrete distributions.
Thomas Stabla [email protected],
Florian Camphausen [email protected],
Peter Ruckdeschel [email protected],
Matthias Kohl [email protected]
UnivariateDistributionclass
,
density
,
approxfun
,
ecdf
1 2 3 4 5 6 7 8 9 10 11 12  rn2 < function(n){rnorm(n)^2}
x < RtoDPQ(r = rn2, e = 4, n = 512)
# returns density, cumulative distribution and quantile function of
# squared standard normal distribution
x$dfun(4)
RtoDPQ(r = rn2, e = 5, n = 1024) # for a better result
rp2 < function(n){rpois(n, lambda = 1)^2}
x < RtoDPQ.d(r = rp2, e = 5)
# returns density, cumulative distribution and quantile function of
# squared Poisson distribution with parameter lambda=1

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.