icdf
Inverse cumulative distribution function
Syntax
Description
Examples
Compute Normal Distribution icdf by Specifying Distribution Name and Parameters
Compute the icdf values for a normal distribution by specifying the distribution name 'Normal'
and the distribution parameters.
Define the input vector p to contain the probability values at which to calculate the icdf.
p = [0.1,0.25,0.5,0.75,0.9];
Compute the icdf values for the normal distribution with the mean equal to 1 and the standard deviation equal to 5.
mu = 1;
sigma = 5;
y = icdf('Normal',p,mu,sigma)
y = 1×5
-5.4078 -2.3724 1.0000 4.3724 7.4078
Each value in y corresponds to a value in the input vector x. For example, at the value x equal to 1, the corresponding icdf value y is equal to 7.4078.
Compute Normal Distribution icdf Using Distribution Object
Create a normal distribution object and compute the icdf values of the normal distribution using the object.
Create a normal distribution object with the mean equal to 1 and the standard deviation equal to 5.
mu = 1; sigma = 5; pd = makedist('Normal','mu',mu,'sigma',sigma);
Define the input vector p to contain the probability values at which to calculate the icdf.
p = [0.1,0.25,0.5,0.75,0.9];
Compute the icdf values for the normal distribution at the values in p.
x = icdf(pd,p)
x = 1×5
-5.4078 -2.3724 1.0000 4.3724 7.4078
Each value in x corresponds to a value in the input vector p. For example, at the value p equal to 0.9, the corresponding icdf value x is equal to 7.4078.
Compute the Poisson Distribution icdf
Create a Poisson distribution object with the rate parameter, , equal to 2.
lambda = 2; pd = makedist('Poisson','lambda',lambda);
Define the input vector p to contain the probability values at which to calculate the icdf.
p = [0.1,0.25,0.5,0.75,0.9];
Compute the icdf values for the Poisson distribution at the values in p.
x = icdf(pd,p)
x = 1×5
0 1 2 3 4
Each value in x corresponds to a value in the input vector p. For example, at the value p equal to 0.9, the corresponding icdf value x is equal to 4.
Alternatively, you can compute the same icdf values without creating a probability distribution object. Use the icdf
function and specify a Poisson distribution using the same value for the rate parameter .
x2 = icdf('Poisson',p,lambda)
x2 = 1×5
0 1 2 3 4
The icdf values are the same as those computed using the probability distribution object.
Compute Standard Normal Critical Values
Create a standard normal distribution object.
pd = makedist('Normal')
pd = NormalDistribution Normal distribution mu = 0 sigma = 1
Determine the critical values at the 5% significance level for a test statistic with a standard normal distribution, by computing the upper and lower 2.5% values.
x = icdf(pd,[.025,.975])
x = 1×2
-1.9600 1.9600
Plot the cdf and shade the critical regions.
p = normspec(x,0,1,'outside')
p = 0.0500
Input Arguments
name
— Probability distribution name
character vector or string scalar of probability distribution
name
Probability distribution name, specified as one of the probability distribution names in this table.
name | Distribution | Input Parameter A | Input Parameter B | Input Parameter C | Input Parameter D |
---|---|---|---|---|---|
'Beta' | Beta Distribution | a first shape parameter | b second shape parameter | N/A | N/A |
'Binomial' | Binomial Distribution | n number of trials | p probability of success for each trial | N/A | N/A |
'BirnbaumSaunders' | Birnbaum-Saunders Distribution | β scale parameter | γ shape parameter | N/A | N/A |
'Burr' | Burr Type XII Distribution | α scale parameter | c first shape parameter | k second shape parameter | N/A |
'Chisquare' or
'chi2' | Chi-Square Distribution | ν degrees of freedom | N/A | N/A | N/A |
'Exponential' | Exponential Distribution | μ mean | N/A | N/A | N/A |
'Extreme Value' or
'ev' | Extreme Value Distribution | μ location parameter | σ scale parameter | N/A | N/A |
'F' | F Distribution | ν1 numerator degrees of freedom | ν2 denominator degrees of freedom | N/A | N/A |
'Gamma' | Gamma Distribution | a shape parameter | b scale parameter | N/A | N/A |
'Generalized Extreme Value' or
'gev' | Generalized Extreme Value Distribution | k shape parameter | σ scale parameter | μ location parameter | N/A |
'Generalized Pareto' or
'gp' | Generalized Pareto Distribution | k tail index (shape) parameter | σ scale parameter | μ threshold (location) parameter | N/A |
'Geometric' | Geometric Distribution | p probability parameter | N/A | N/A | N/A |
'Half Normal' or
'hn' | Half-Normal Distribution | μ location parameter | σ scale parameter | N/A | N/A |
'Hypergeometric' or
'hyge' | Hypergeometric Distribution | m size of the population | k number of items with the desired characteristic in the population | n number of samples drawn | N/A |
'InverseGaussian' | Inverse Gaussian Distribution | μ scale parameter | λ shape parameter | N/A | N/A |
'Logistic' | Logistic Distribution | μ mean | σ scale parameter | N/A | N/A |
'LogLogistic' | Loglogistic Distribution | μ mean of logarithmic values | σ scale parameter of logarithmic values | N/A | N/A |
'LogNormal' | Lognormal Distribution | μ mean of logarithmic values | σ standard deviation of logarithmic values | N/A | N/A |
'Loguniform' | Loguniform Distribution | a lower endpoint (minimum) | b upper endpoint (maximum) | N/A | N/A |
'Nakagami' | Nakagami Distribution | μ shape parameter | ω scale parameter | N/A | N/A |
'Negative Binomial' or
'nbin' | Negative Binomial Distribution | r number of successes | p probability of success in a single trial | N/A | N/A |
'Noncentral F' or
'ncf' | Noncentral F Distribution | ν1 numerator degrees of freedom | ν2 denominator degrees of freedom | δ noncentrality parameter | N/A |
'Noncentral t' or
'nct' | Noncentral t Distribution | ν degrees of freedom | δ noncentrality parameter | N/A | N/A |
'Noncentral Chi-square' or
'ncx2' | Noncentral Chi-Square Distribution | ν degrees of freedom | δ noncentrality parameter | N/A | N/A |
'Normal' | Normal Distribution | μ mean | σ standard deviation | N/A | N/A |
'Poisson' | Poisson Distribution | λ mean | N/A | N/A | N/A |
'Rayleigh' | Rayleigh Distribution | b scale parameter | N/A | N/A | N/A |
'Rician' | Rician Distribution | s noncentrality parameter | σ scale parameter | N/A | N/A |
'Stable' | Stable Distribution | α first shape parameter | β second shape parameter | γ scale parameter | δ location parameter |
'T' | Student's t Distribution | ν degrees of freedom | N/A | N/A | N/A |
'tLocationScale' | t Location-Scale Distribution | μ location parameter | σ scale parameter | ν shape parameter | N/A |
'Uniform' | Uniform Distribution (Continuous) | a lower endpoint (minimum) | b upper endpoint (maximum) | N/A | N/A |
'Discrete Uniform' or
'unid' | Uniform Distribution (Discrete) | n maximum observable value | N/A | N/A | N/A |
'Weibull' or
'wbl' | Weibull Distribution | a scale parameter | b shape parameter | N/A | N/A |
Example: 'Normal'
p
— Probability values at which to evaluate icdf
scalar value | array of scalar values
Probability values at which to evaluate the icdf, specified as a scalar value, or an array of scalar values in the range [0,1].
If one or more of the input arguments p
,
A
, B
, C
, and
D
are arrays, then the array sizes must be the same. In this case,
icdf
expands each scalar input into a constant array of the same
size as the array inputs. See name
for the definitions of
A
, B
, C
, and
D
for each distribution.
Example: [0.1,0.25,0.5,0.75,0.9]
Data Types: single
| double
A
— First probability distribution parameter
scalar value | array of scalar values
First probability distribution parameter, specified as a scalar value or an array of scalar values.
If one or more of the input arguments p
,
A
, B
, C
, and
D
are arrays, then the array sizes must be the same. In this case,
icdf
expands each scalar input into a constant array of the same
size as the array inputs. See name
for the definitions of
A
, B
, C
, and
D
for each distribution.
Data Types: single
| double
B
— Second probability distribution parameter
scalar value | array of scalar values
Second probability distribution parameter, specified as a scalar value or an array of scalar values.
If one or more of the input arguments p
,
A
, B
, C
, and
D
are arrays, then the array sizes must be the same. In this case,
icdf
expands each scalar input into a constant array of the same
size as the array inputs. See name
for the definitions of
A
, B
, C
, and
D
for each distribution.
Data Types: single
| double
C
— Third probability distribution parameter
scalar value | array of scalar values
Third probability distribution parameter, specified as a scalar value or an array of scalar values.
If one or more of the input arguments p
,
A
, B
, C
, and
D
are arrays, then the array sizes must be the same. In this case,
icdf
expands each scalar input into a constant array of the same
size as the array inputs. See name
for the definitions of
A
, B
, C
, and
D
for each distribution.
Data Types: single
| double
D
— Fourth probability distribution parameter
scalar value | array of scalar values
Fourth probability distribution parameter, specified as a scalar value or an array of scalar values.
If one or more of the input arguments p
,
A
, B
, C
, and
D
are arrays, then the array sizes must be the same. In this case,
icdf
expands each scalar input into a constant array of the same
size as the array inputs. See name
for the definitions of
A
, B
, C
, and
D
for each distribution.
Data Types: single
| double
pd
— Probability distribution
probability distribution object
Probability distribution, specified as one of the probability distribution objects in this table.
Distribution Object | Function or App to Create Probability Distribution Object |
---|---|
BetaDistribution | makedist , fitdist , Distribution Fitter |
BinomialDistribution | makedist , fitdist ,
Distribution Fitter |
BirnbaumSaundersDistribution | makedist , fitdist ,
Distribution Fitter |
BurrDistribution | makedist , fitdist ,
Distribution Fitter |
ExponentialDistribution | makedist , fitdist ,
Distribution Fitter |
ExtremeValueDistribution | makedist , fitdist ,
Distribution Fitter |
GammaDistribution | makedist , fitdist ,
Distribution Fitter |
GeneralizedExtremeValueDistribution | makedist , fitdist ,
Distribution Fitter |
GeneralizedParetoDistribution | makedist , fitdist ,
Distribution Fitter |
HalfNormalDistribution | makedist , fitdist ,
Distribution Fitter |
InverseGaussianDistribution | makedist , fitdist ,
Distribution Fitter |
KernelDistribution | fitdist , Distribution Fitter |
LogisticDistribution | makedist , fitdist ,
Distribution Fitter |
LoglogisticDistribution | makedist , fitdist ,
Distribution Fitter |
LognormalDistribution | makedist , fitdist ,
Distribution Fitter |
LoguniformDistribution | makedist |
MultinomialDistribution | makedist |
NakagamiDistribution | makedist , fitdist ,
Distribution Fitter |
NegativeBinomialDistribution | makedist , fitdist ,
Distribution Fitter |
NormalDistribution | makedist , fitdist ,
Distribution Fitter |
Piecewise distribution with generalized Pareto distributions in the tails | paretotails |
PiecewiseLinearDistribution | makedist |
PoissonDistribution | makedist , fitdist ,
Distribution Fitter |
RayleighDistribution | makedist , fitdist ,
Distribution Fitter |
RicianDistribution | makedist , fitdist ,
Distribution Fitter |
StableDistribution | makedist , fitdist ,
Distribution Fitter |
tLocationScaleDistribution | makedist , fitdist ,
Distribution Fitter |
TriangularDistribution | makedist |
UniformDistribution | makedist |
WeibullDistribution | makedist , fitdist ,
Distribution Fitter |
Output Arguments
x
— icdf values
scalar value | array of scalar values
icdf values, returned as a scalar value or an array of scalar values.
x
is the same size as p
after
any necessary scalar expansion. Each element in x
is
the icdf value of the distribution, specified by the corresponding elements
in the distribution parameters (A
,
B
, C
, and
D
) or specified by the probability distribution
object (pd
), evaluated at the corresponding element in
p
.
Alternative Functionality
icdf
is a generic function that accepts either a distribution by
its name name
or a probability distribution object
pd
. It is faster to use a distribution-specific function, such
as norminv
for the normal distribution and
binoinv
for the binomial distribution.
For a list of distribution-specific functions, see Supported Distributions.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
The input argument
name
must be a compile-time constant. For example, to use the normal distribution, includecoder.Constant('Normal')
in the-args
value ofcodegen
(MATLAB Coder).The input argument
pd
can be a fitted probability distribution object for beta, exponential, extreme value, lognormal, normal, and Weibull distributions. Createpd
by fitting a probability distribution to sample data from thefitdist
function. For an example, see Code Generation for Probability Distribution Objects.
For more information on code generation, see Introduction to Code Generation and General Code Generation Workflow.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a
See Also
cdf
| mle
| pdf
| random
| makedist
| fitdist
| Distribution Fitter | paretotails
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)