icdf — Evaluate inverse cumulative distribution functions by distribution name or fitted distribution object.
icdf(name,p,...) evaluates inverse cumulative distribution functions for supported named distributions. icdf(pd,p) evaluates quantiles for a ProbabilityDistribution object returned by fitdist.
Syntax
x = icdf("Normal", p)
x = icdf("Normal", p, mu, sigma)
x = icdf("t", p, nu)
x = icdf("Weibull", p, a, b)
x = icdf("Chi-square", p, nu)
x = icdf("Binomial", p, n, prob)All supported icdf forms
x = icdf("Normal", p)
x = icdf("Normal", p, mu, sigma)
x = icdf("t", p, nu)
x = icdf("Weibull", p, a, b)
x = icdf("Chi-square", p, nu)
x = icdf("Binomial", p, n, prob)
x = icdf("Gamma", p, shape, scale)
x = icdf("Exponential", p, mu)
x = icdf("Poisson", p, lambda)
x = icdf("Uniform", p)
x = icdf("Uniform", p, a, b)
x = icdf("Lognormal", p, mu, sigma)
x = icdf("Beta", p, a, b)
x = icdf("F", p, v1, v2)
x = icdf(pd, p)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name | StringScalar | Yes | — | Distribution name. |
p | Any | Yes | — | Probability value. |
mu | Any | No | 0 | Mean parameter. |
sigma | Any | No | 1 | Standard deviation parameter. |
nu | Any | Yes | — | Degrees of freedom parameter. |
a | Any | No | 1 | Scale parameter. |
b | Any | No | 1 | Shape parameter. |
n | Any | Yes | — | Number of trials. |
prob | Any | Yes | — | Success probability parameter. |
shape | Any | Yes | — | Shape parameter. |
scale | Any | Yes | — | Scale parameter. |
mu | Any | Yes | — | Mean parameter. |
lambda | Any | Yes | — | Rate or mean parameter. |
a | Any | Yes | — | Lower endpoint. |
b | Any | Yes | — | Upper endpoint. |
a | Any | Yes | — | First shape parameter. |
b | Any | Yes | — | Second shape parameter. |
v1 | Any | Yes | — | Numerator degrees of freedom. |
v2 | Any | Yes | — | Denominator degrees of freedom. |
pd | Any | Yes | — | ProbabilityDistribution object returned by fitdist. |
p | NumericArray | Yes | — | Probability values. |
Returns
| Name | Type | Description |
|---|---|---|
y | NumericArray | Distribution function value. |
y | NumericArray | Distribution function values. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:icdf:InvalidArgument | Inputs are nonnumeric, sizes are incompatible, or too many arguments are supplied. | icdf: invalid argument |
RunMat:icdf:Internal | Internal tensor conversion or allocation fails. | icdf: internal error |
How icdf works
- Supported distribution names include
"Normal","t","Weibull","Chi-square","Binomial","Gamma","Exponential","Poisson","Uniform","Lognormal","Beta", and"F". - Common aliases are accepted after case-insensitive normalization and removal of punctuation or spaces, including
"norm","gaussian","student t","wbl","chi2","bino","gam","exp","poiss","unif","logn", and"fdist". icdf("Normal",p)uses mean0and standard deviation1;icdf("Normal",p,mu,sigma)uses supplied normal parameters.icdf("t",p,nu)returns Student's t quantiles for degrees of freedomnu.icdf("Weibull",p)uses scale1and shape1;icdf("Weibull",p,a,b)uses supplied Weibull scale and shape.icdf("Chi-square",p,nu)inverts the chi-square CDF with degrees of freedomnu.icdf("Binomial",p,n,prob)returns the smallest integer outcome whose binomial CDF is at leastp.icdf("Gamma",p,shape,scale),icdf("Exponential",p,mu),icdf("Poisson",p,lambda),icdf("Beta",p,a,b), andicdf("F",p,v1,v2)require the shown distribution parameters.icdf("Uniform",p)uses bounds[0,1];icdf("Uniform",p,a,b)uses supplied lower and upper bounds.icdf("Lognormal",p)uses mean0and standard deviation1for the underlying normal distribution;icdf("Lognormal",p,mu)andicdf("Lognormal",p,mu,sigma)use supplied lognormal parameters.icdf(pd,p)supports fitted normal, exponential, lognormal, gamma, Weibull, and Poisson distribution objects returned byfitdist.- Scalar and compatible array inputs broadcast to a common output shape. Invalid probabilities or distribution parameters produce
NaNelements. - Continuous distributions return endpoint values at
p = 0andInfwhere the upper tail is unbounded atp = 1; bounded distributions return their finite endpoints. The Poisson inverse returnsInfatp = 1.
Examples
Normal median with parameters
x = icdf("Normal", 0.5, 10, 2)Expected output:
x = 10Discrete binomial quantile
k = icdf("Binomial", 0.75, 10, 0.5)Expected output:
k = 6Uniform quantile with bounds
x = icdf("Uniform", 0.25, 10, 20)Expected output:
x = 12.5Fitted distribution median
pd = fitdist([1;2;3], "Normal"); x = icdf(pd, 0.5)Expected output:
x = 2Using icdf with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how icdf changes the result.
Run a small icdf example, explain the result, then change one input and compare the output.
FAQ
How is icdf related to distribution-specific inverse functions?⌄
icdf("Normal",p,mu,sigma) dispatches to the same numerical path as norminv(p,mu,sigma), icdf("t",p,nu) to tinv, and icdf("Weibull",p,a,b) to wblinv. Other supported distribution names use matching runtime CDF or inverse helper implementations.
Related Stats functions
Summary
binocdf · boxplot · cdf · cdfplot · chi2cdf · corr · corrcoef · corrcov · cov · cov2corr · dummyvar · ecdf · filloutliers · fitdist · geomean · grpstats · harmmean · isoutlier · kstest · kurtosis · lsline · mad · mode · nanmax · normalize · normcdf · norminv · normpdf · onehotdecode · onehotencode · pdf · prctile · quantile · refline · rmse · skewness · tabulate · tcdf · tiedrank · tinv · tpdf · ttest2 · wblinv
Ml
bayesopt · classify · confusionmat · crossvalind · cvpartition · fitclinear · fitctree · fitlm · kmeans · knnsearch · lasso · lassoglm · linkage · lscov · mnrfit · optimizableVariable · pdist · pdist2 · perfcurve · predict · regress · ridge · squareform · test · training · tsne
Random
binornd · bootstrp · datasample · dividerand · exprnd · gamrnd · lhsdesign · mvnrnd · normrnd · random · randsample · rng · trnd · unidrnd · unifrnd · wblrnd
Hist
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how icdf is executed, line by line, in Rust.
- View the source for icdf in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.