fit.perc: Choosing distribution by given quantiles

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/rriskDistributions_functions.R

Description

This function provides a GUI for choosing a most appropriate continuous distribution for known quantiles.

Usage

1
2
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 TRUE the output of the fitting functions get.distribution.par will be shown.

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 p containing positive values for weighting quantiles. By default all quantiles will be weighted by 1.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## 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)

rriskDistributions documentation built on May 2, 2019, 3:44 a.m.