q_approxfun | R Documentation |
q_approxfun
is a generic function that for a given object generates function to approximate the quantile function.
q_approxfun(O, range = q(O, c(0.005, 0.995)), n = 1000) ## S3 method for class 'dist' q_approxfun(O, range = q(O, c(0.005, 0.995)), n = 1000)
O |
distribution object. |
range |
interval on which the grid is defined, q(O, c(0.005, 0.995)). |
n |
number of points within the grid, default: 1000. |
Function q_approxfun
generates a grid of values on which the CDF of the object is evaluated.
The function returns a quantile function that uses approx
and the values
of the grid to approximate the quantiles. This function is designed mostly for the mixture distributions
where the standard q
method may be slow and thus allows to trade the accuracy for the speed.
The returned function takes the arguments p
, lower.tail
and log.p
, see q
.
Function.
N <- normdist(1, 3) N2 <- normdist(8, 3) M <- mixdist(N, N2, weights = c(0.5, 0.5)) q_app <- q_approxfun(M) q_app(c(.2, .5, .7)) q_app(c(.2, .5, .7), lower.tail = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.