Learn R Programming

plgraphics (version 1.2)

condquant: Quantiles of a Conditional Distribution

Description

Calculates quantiles of a conditional distribution, as well as corresponding random numbers. The condtion is simply to restrict the distribution (given by dist) to a range (given by x)

Usage

condquant(x, dist = "normal", mu = 0, sigma = 1, randomrange = 0.9)

Value

Matrix consisting of a row for each row of x for which x[,1] differs from x[,2] and the following columns:

median

Median

lowq, uppq

lower and upper quartiles

random

random number according to the conditional distribution (one for each row)

prob

probability of the condition being true

index

(row) index of the corresponding entry in the input 'x'

Attribute distribution comprises the arguments

dist, mu, sigma.

Arguments

x

matrix with 2 columns or vector of length 2 giving the limits for the conditional distribution

dist

(unconditional) distribution. Currently, only normal (or gaussian), logistic and revgumbel (reverse-Gumbel, distribution of the logarithm of a Weibull variable) are implemented.

mu, sigma

locarion and scale parameter of the distribution

randomrange

random numbers from the conditional distribution are drawn for the inner 100*randomrange percent of the suitable p-range. This avoids random extreme outliers and points close to the limit of the intervals on which they are conditioned.

Author

Werner A. Stahel, Seminar for Statistics, ETH Zurich

Examples

Run this code
condquant(cbind(seq(-2,1),c(0,1,Inf,1)))

Run the code above in your browser using DataLab