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
)
condquant(x, dist = "normal", mu = 0, sigma = 1, randomrange = 0.9)
Matrix consisting of a row for each row of x
for which
x[,1] differs from x[,2] and the following columns:
Median
lower and upper quartiles
random number according to the conditional distribution (one for each row)
probability of the condition being true
(row) index of the corresponding entry in the input 'x'
Attribute distribution
comprises the arguments
dist, mu, sigma
.
matrix with 2 columns or vector of length 2 giving the limits for the conditional distribution
(unconditional) distribution. Currently, only
normal
(or gaussian
),
logistic
and revgumbel
(reverse-Gumbel,
distribution of the logarithm of a Weibull variable) are implemented.
locarion and scale parameter of the distribution
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.
Werner A. Stahel, Seminar for Statistics, ETH Zurich
condquant(cbind(seq(-2,1),c(0,1,Inf,1)))
Run the code above in your browser using DataLab