quantile.density | R Documentation |
Quantiles for objects of class "density", "pred.density" or "coef.density"
## S3 method for class 'density' quantile(x, probs = seq(0.25, 0.75, 0.25), names = TRUE, normalize = TRUE, ...) ## S3 method for class 'coef.density' quantile(x, probs = seq(0.25, 0.75, 0.25), names = TRUE, ...) ## S3 method for class 'pred.density' quantile(x, probs = seq(0.25, 0.75, 0.25), names = TRUE, ...)
x |
a object of class |
probs |
numeric vector of probabilities with values in [0,1] - elements
very close to the boundaries return |
names |
logical; if |
normalize |
logical; if |
... |
further arguments passed to or from other methods. |
The methods quantile.coef.density
and quantile.pred.density
both apply quantile.density
to densities nested with object of class
coef.density
or pred.density
.
The function
quantile.density
applies generically to the built-in class
density
(as least for versions where there is no such method
in the pre-configured packages).
Note that quantile.density
relies
on trapezoidal integration in order to compute the cumulative densities
necessary for the calculation of quantiles.
If x
is of class density
(or a list with exactly one
element), a vector with quantiles.
If x
is a list
of
densities with more than one element (e.g. as resulting from
pred.density
or coef.density
), then the output is a matrix of
quantiles, with each matrix row corresponding to the respective density.
Stefan Zeugner
quantile.default
for a comparable function,
pred.density
and density.bma
for the
BMA-specific objects.
Check http://bms.zeugner.eu for additional help.
data(datafls) mm = bms(datafls[1:70,], user.int=FALSE) #predict last two observations with preceding 70 obs: pmm = pred.density(mm, newdata=datafls[71:72,], plot=FALSE) #'standard error' quantiles quantile(pmm, c(.05, .95)) #Posterior density for Coefficient of "GDP60" cmm = density(mm, reg="GDP60", plot=FALSE) quantile(cmm, probs=c(.05, .95)) #application to generic density: dd1 = density(rnorm(1000)) quantile(dd1) ## Not run: #application to list of densities: quantile.density( list(density(rnorm(1000)), density(rnorm(1000))) ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.