Description Usage Arguments Author(s) Examples
View source: R/get_quantiles.R
These functions approximate quantiles for a probability density function or
mass function given by a function f
.
1 2 | get_quantiles(f, p, continuous = NULL, precision = 0.01, n_steps = 1000,
maxit = 1000, ...)
|
f |
A function returning the probability density function (for
|
p |
A vector of probabilities. |
continuous |
A logical indicating if the distribution computed by
|
precision |
The size of the step used to discretise the continuous distribution. Defaults to 0.01. |
n_steps |
The number steps used to discretise the continuous
distribution. Defaults to 1000. Note that if |
maxit |
The maximum number of batches of |
... |
Further arguments passed to the function |
Anne Cori (a.cori@imperial.ac.uk) and Thibaut Jombart.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## reference: exponential of rate 1
qexp(c(.4, .5, .95))
## approximation
get_quantiles(f = dexp, c(.4,.5,.95), TRUE)
## better precision
get_quantiles(f = dexp, c(.4,.5,.95), precision = 0.001, TRUE)
## example with fpaircase
f <- fpaircase("spatial", sd_spatial=10)
plot(f)
plot(f, xlim = c(0, 100))
plot(f, xlim = c(0, 100), pi = 0.4)
q <- get_quantiles(f, c(.9, .95, .99))
q
abline(v = q)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.