Skip to content

RiskFunctions

pyscripter edited this page Mar 4, 2024 · 9 revisions

XLRisk distribution functions

To describe the uncertainty in your model you can use the distribution functions provided by XLRisk (also referred to as risk functions). The list of these functions is currently short, but it will be expanded in the near future.

Depending on the "Show samples" setting these functions, when entered into the spreadsheet, they will return (display), either a sample of the distribution or its mean value. You can enter these functions using the Excel "Insert function" dialog box.

List of distribution functions

  • RiskBernoulli(P): Generates samples from a Bernulli distribution, with the given probability of success.
  • RiskBeta(alpha, beta, A, B): Generates samples from a Beta distribution, with the given shape parameters alpha and beta. Optionally provide A and B as the minimum and maximum. The parameters are the same as in the built-in BETA.INV function.
  • RiskBinomial(N, P): Generates samples from a Binomial distribution, with the given number of trials and probability of success.
  • RiskCumul(minvalue, maxvalue, XValues, YValues): Generates samples from a cumulative distribution, specified by the minimum, maximum values and two arrays containing the X and Y coordinates of the remaining points. The Y coordinates are cumulative probabilities. XValues and YValues need to be in strictly increasing order. The XValues need to be between the minimum and maximum values.
  • RiskDiscrete(Values, Probabilities): Generates samples from a discrete uniform distribution. The arguements Values and Probabilities can be ranges or an arrays. Values should be in ascending order, and Probibilities should contain the respective probabilities.
  • RiskDUniform(Values): Generates samples from a discrete uniform distribution. The arguement Values can be a range or an array of values. Each of the values has equal chance of being sampled.
  • RiskErlang(alpha, beta): Generates samples from an Erlang distribution, with the given integer shape (alpha) and scale (beta) parameters.
  • RiskExponential(mean): Generates samples from an Exponential distribution, with the given mean.
  • RiskGamma(alpha, beta): Generates samples from a Gamma distribution, with the given given shape (alpha) and scale (beta) parameters.
  • RiskLogNorm(meand, stdev): Generates samples from a log-normal distribution, with the given meand and standard deviation.
  • RiskNormal(mean, stdev): Generates samples from a normal distribution, with the given mean and standard deviation.
  • RiskPert(min, most likely, max): Generates samples from a PERT distribution, with the given minimum most-likely and maximum value. The PERT distribution is a special case of the Beta distribution and can be used as a smoother version of the Triangular distribution.
  • RiskTriang(min, most likely, max): Generates samples from a triangular distribution, with the given minimum most-likely and maximum value.
  • RiskUniform(min, max): Generates samples from a unifor distribution between min and max.
  • RiskWeibull(alpha, beta): Generates samples from a Weibull distribution, with the given given shape (alpha) and scale (beta) parameters.

Other functions

  • RiskCorrmat(CorrmatRng, Index): When added as an optional last argument to a Risk function it creates a link to a correlation matrix. See how to use it in the Correlated Inputs Example.
  • RiskCorrectCorrmat(CorrmatRng): Fixes an correlation matrix that is not semipositive definite and returns a valid correlation matrix.
  • RiskIsValidCorrmat(CorrmatRng): Checks whether a correlation matrix is valid including a test for semipositive definiteness. Returns a Boolean value.
  • RiskSCorrel(Array1, Array2): Returns the Spearman's rank correlation of the two arrays.