| uq {Runuran} | R Documentation |
Evaluates quantile of distribution approximately using
a unuran object that implements an inversion method.
[Universal] – Quantile Function.
uq(unr, U)
unr |
a unuran object that implements an inversion menthod. |
U |
vector of probabilities. |
The routine evaluates the quantiles (inverse CDF) for a given
(vector of) probabilities approximately.
It requires a unuran object that implements an inversion method.
Currently these are
Josef Leydold and Wolfgang H"ormann unuran@statmath.wu-wien.ac.at.
W. H"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg.
## Compute quantiles of normal distribution using method 'HINV'
unr <- unuran.new("normal()","hinv")
uq(unr,0.975)
uq(unr,c(0.025,0.975))
## Compute quantiles of user-defined distributio using method 'HINV'
cdf <- function (x) { 1.-exp(-x) }
pdf <- function (x) { exp(-x) }
dist <- new("unuran.cont", cdf=cdf, pdf=pdf, lb=0, ub=Inf)
unr <- unuran.new(dist, "hinv; u_resolution=1.e-12")
uq(unr,seq(0,1,0.05))
## Compute quantiles of user-defined distribution using method PINV
pdf <- function (x) { exp(-x) }
dist <- new("unuran.cont", pdf=pdf, lb=0, ub=Inf)
unr <- unuran.new(dist, "pinv; u_resolution=1.e-12")
uq(unr,seq(0,1,0.05))