fit.perc {rriskDistributions} | R Documentation |
Choosing distribution by given quantiles
Description
This function provides a GUI for choosing a most appropriate continuous distribution for known quantiles.
Usage
fit.perc(p = c(0.025, 0.5, 0.975), q = stats::qnorm(p), show.output = FALSE,
tolPlot = 0.1, tolConv = 0.001, fit.weights = rep(1, length(p)))
Arguments
p |
numerical vector of probabilities. |
q |
numerical vector of quantiles. |
show.output |
logical, if |
tolPlot |
single positive numerical value giving a tolerance for plotting graphical diagnostics. If the sums of the differences between the distribution percentiles and the given percentiles are smaller than this value, the distribution will be plotted. |
tolConv |
positive numerical value, the absolute convergence tolerance for reaching zero. |
fit.weights |
numerical vector of the same length as a probabilities vector
|
Details
The argument tolPlot
defines a tolerance for plotting graphical diagnostics.
If the sums of the differences between the percentiles of the estimated distribution
and the given percentiles are smaller than this value, the distribution will be plotted.
The items of the probability vector p
should lie between 0 and 1.
Value
Returns a named list containing a chosen distribution, its estimated parameters and the data on which the estimation is based.
Note
This function is used for defining a Monte-Carlo random variate item
(mcrv
) in the rrisk
project.
Author(s)
Matthias Greiner matthias.greiner@bfr.bund.de (BfR),
Kristin Tolksdorf kristin.tolksdorf@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
## Not run:
chosenDistr1 <- fit.perc()
chosenDistr1
chosenDistr2 <- fit.perc(tolPlot = 5)
chosenDistr2
chosenDistr3 <- fit.perc(p = c(0.3, 0.8, 0.9), q = c(10, 20, 40))
chosenDistr3
chosenDistr4 <- fit.perc(p = c(0.3, 0.8, 0.9), q = c(10, 30, 40))
chosenDistr4
chosenDistr5 <- fit.perc(p = c(0.3, 0.8, 0.9), q = c(10, 30, 40), tolPlot = 10)
chosenDistr5
## Fitting a PERT distribution
p <- c(0.025, 0.5, 0.6, 0.975)
q <- round(mc2d::qpert(p = p, min = 0, mode = 3, max = 10, shape = 5), digits = 2)
chosenDistr6 <- fit.perc(p = p, q = q, tolPlot = 10)
chosenDistr6
## End(Not run)