get.unif.par {rriskDistributions} | R Documentation |
Fitting parameters of a uniform distribution from two or more quantiles
Description
get.unif.par
returns the parameters of a uniform distribution
where the p
th percentiles match with the quantiles q
.
Usage
get.unif.par(p = c(0.025, 0.975), q, plot = TRUE, scaleX = c(0.1, 0.9), ...)
Arguments
p |
numeric, single value or vector of probabilities. |
q |
numeric, single value or vector of quantiles corresponding to p. |
plot |
logical, if |
scaleX |
numerical vector of the length 2 containing values (from the open interval (0, 1))
for scaling quantile-axis (relevant only if |
... |
further arguments passed to the functions |
Details
The number of probabilities and the number of quantiles must be identical
and should be at least two. Using the default p
, the three corresponding
quantiles are the 2.5th percentile, the median and the 97.5th percentile,
respectively.
Parameters of the uniform distribution are estimated exactly.
The items of the probability vector p
should lie between 0 and 1.
Value
Returns fitted parameters of a uniform distribution.
Note
It should be noted that there might be deviations between the estimated
and the theoretical distribution parameters in certain circumstances. This is
because the estimation of the parameters is based on a numerical optimization
method and depends strongly on the initial values. In addition, one must always
keep in mind that a distribution for different combinations of parameters may
look very similar. Therefore, the optimization method cannot always find the
"right" distribution, but a "similar" one.
If the function terminates with the error massage "convergence error occurred or
specified tolerance not achieved", one may try to set the convergence tolerance
to a higher value. It is yet to be noted, that good till very good fits of parameters
could only be obtained for tolerance values that are smaller than 0.001.
Author(s)
Matthias Greiner matthias.greiner@bfr.bund.de (BfR),
Katharina Schueller schueller@stat-up.de (STAT-UP Statistical Consulting),
Natalia Belgorodski belgorodski@stat-up.de (STAT-UP Statistical Consulting)
Examples
q <- stats::qunif(p = c(0.025, 0.975), min = 0, max = 5)
get.unif.par(q = q)
get.unif.par(q = q, scaleX = c(0.001, 0.999))
q <- stats::qunif(p = c(0.025, 0.975), min=-6, max = 5)
get.unif.par(q = q)