QuantileFun {glmmAK}R Documentation

Sample quantiles

Description

This is (almost) the same as quantile(x), or apply(x, 1, quantile) or apply(x, 2, quantile).

The motivation to write it was to validate my C++ function.

Usage

QuantileFun(x, probs=seq(0, 1, 0.25), vals.in.cols=TRUE)

Arguments

x values of the function
probs numeric vector of probabilities with values in [0,1]
vals.in.cols if TRUE then it is assumed that function f evaluated in a specific grid point over (MCMC) iterations is stored in a column of x. That is (MCMC) iterations correspond to rows.

Value

A data.frame with 1 row for each probs value.

Author(s)

Arnošt Komárek arnost.komarek[AT]mff.cuni.cz

See Also

quantile.

Examples

probs <- c(0, 0.25, 0.354, 0.5, 0.75, 1)

x <- rnorm(1001)
QuantileFun(x, probs=probs)
quantile(x, probs=probs)

n <- 1001
xx <- data.frame(x1=rnorm(n), x2=rgamma(n, shape=1, rate=1), x3=1:n)
QuantileFun(xx, probs=probs, vals.in.cols=TRUE)
apply(xx, 2, quantile, probs=probs)

xx2 <- t(xx)
QuantileFun(xx2, probs=probs, vals.in.cols=FALSE)
apply(xx2, 1, quantile, probs=probs)

[Package glmmAK version 1.2 Index]