Description Usage Arguments Details Value See Also Examples
This function generates random numbers for a set of univariate parametric distributions from given quantiles. Internally, this is achieved by fitting the distribution function to the given quantiles.
1 2 3  rdistq_fit(distribution, n, percentiles = c(0.05, 0.5, 0.95), quantiles,
relativeTolerance = 0.05, tolConv = 0.001, fit.weights = rep(1,
length(percentiles)), verbosity = 1)

distribution 
A character string that defines the univariate distribution to be randomly sampled. 
n 
Number of generated observations. 
percentiles 
Numeric vector giving the percentiles. 
quantiles 
Numeric vector giving the quantiles. 
relativeTolerance 

tolConv 
positive numerical value, the absolute convergence tolerance for reaching zero by fitting distributions

fit.weights 
numerical vector of the same length as a probabilities vector

verbosity 

The following table shows the available distributions and their identification
(option: distribution
) as a character string:
distribution  Distribution Name  length(quantiles)  Necessary Package 
"norm"  Normal  >=2  
"beta"  Beta  >=2  
"cauchy"  Cauchy  >=2  
"logis"  Logistic  >=2  
"t"  Student t  >=1  
"chisq"  Central ChiSquared  >=1  
"chisqnc"  Noncentral ChiSquared  >=2  
"exp"  Exponential  >=1  
"f"  Central F  >=2  
"gamma"  Gamma with scale=1/rate  >=2  
"lnorm"  Log Normal  >=2  
"unif"  Uniform  ==2  
"weibull"  Weibull  >=2  
"triang"  Triangular  >=3  mc2d 
"gompertz"  Gompertz  >=2  eha 
"pert"  (Modified) PERT  >=4  mc2d 
"tnorm"  Truncated Normal  >=4  msm

percentiles
and quantiles
must be of the same length. percentiles
must be
>=0
and <=1
.
The default for percentiles
is 0.05, 0.5 and 0.95, so for the default,
the quantiles argument should be a vector with 3 elements. If this is to be longer,
the percentiles argument has to be adjusted to match the length of quantiles.
The fitting of the distribution parameters is done using
rriskFitdist.perc
.
A numeric vector of length n
with the sampled values according to the chosen
distribution.
1 2 3 4 5 6 7  # Fit a log normal distribution to 3 quantiles:
if ( requireNamespace("rriskDistributions", quietly = TRUE) ){
percentiles<c(0.05, 0.5, 0.95)
quantiles=c(1,3,15)
hist(r<rdistq_fit(distribution="lnorm", n=10000, quantiles=quantiles),breaks=100)
print(quantile(x=r, probs=percentiles))
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.