Documentation

cdf

Cumulative distribution functions

Syntax

  • y = cdf('name',x,A) example
  • y = cdf('name',x,A,B) example
  • y = cdf('name',x,A,B,C)
  • y = cdf(___,'upper')

Description

example

y = cdf('name',x,A) returns the cumulative distribution function (cdf) for the one-parameter distribution family specified by 'name', evaluated at the values in x. A contains the parameter value for the distribution.

example

y = cdf('name',x,A,B) returns the cdf for the two-parameter distribution family specified by 'name', evaluated at the values in x. A and B contain the parameter values for the distribution.

y = cdf('name',x,A,B,C) returns the cdf for the three-parameter distribution family specified by 'name', evaluated at the values in x. A, B, and C contain the parameter values for the distribution.

example

y = cdf(pd,x) returns the cumulative distribution function of the probability distribution object, pd, evaluated at the values in x.

y = cdf(___,'upper') returns the complement of the cumulative distribution function using an algorithm that more accurately computes the extreme upper tail probabilities. You can use the 'upper' argument with any of the previous syntaxes.

Examples

collapse all

Compute the Normal Distribution cdf

Create a standard normal distribution object with the mean, $\mu$, equal to 0 and the standard deviation, $\sigma$, equal to 1.

mu = 0;
sigma = 1;
pd = makedist('Normal',mu,sigma);

Define the input vector x to contain the values at which to calculate the cdf.

x = [-2,-1,0,1,2];

Compute the cdf values for the standard normal distribution at the values in x.

y = cdf(pd,x)
y =

    0.0228    0.1587    0.5000    0.8413    0.9772

Each value in y corresponds to a value in the input vector x. For example, at the value x equal to 1, the corresponding cdf value y is equal to 0.8413.

Alternatively, you can compute the same cdf values without creating a probability distribution object. Use the cdf function, and specify a standard normal distribution using the same parameter values for $\mu$ and $\sigma$.

y2 = cdf('Normal',x,mu,sigma)
y2 =

    0.0228    0.1587    0.5000    0.8413    0.9772

The cdf values are the same as those computed using the probability distribution object.

Compute the Poisson Distribution cdf

Create a Poisson distribution object with the rate parameter, $\lambda$, equal to 2.

lambda = 2;
pd = makedist('Poisson',lambda);

Define the input vector x to contain the values at which to calculate the cdf.

x = [0,1,2,3,4];

Compute the cdf values for the Poisson distribution at the values in x.

y = cdf(pd,x)
y =

    0.1353    0.4060    0.6767    0.8571    0.9473

Each value in y corresponds to a value in the input vector x. For example, at the value x equal to 3, the corresponding cdf value y is equal to 0.8571.

Alternatively, you can compute the same cdf values without creating a probability distribution object. Use the cdf function, and specify a Poisson distribution using the same value for the rate parameter, $\lambda$.

y2 = cdf('Poisson',x,lambda)
y2 =

    0.1353    0.4060    0.6767    0.8571    0.9473

The cdf values are the same as those computed using the probability distribution object.

Input Arguments

collapse all

'name' — Probability distribution nameprobability distribution name string

Probability distribution name, specified as one of the following probability distribution name strings.

nameDistributionInput Parameter AInput Parameter BInput Parameter C
'Beta'Beta Distributiona: first shape parameterb: second shape parameter
'Binomial'Binomial Distributionn: number of trialsp: probability of success for each trial
'BirnbaumSaunders'Birnbaum-Saunders Distributionβ: scale parameterγ: shape parameter
'Burr'Burr Type XII Distributionα: scale parameterc: first shape parameterk: second shape parameter
'Chisquare'Chi-Square Distributionν: degrees of freedom
'Exponential'Exponential Distributionμ: mean
'Extreme Value'Extreme Value Distributionμ: location parameterσ: scale parameter
'F'F Distributionν1: numerator degrees of freedomν2: denominator degrees of freedom
'Gamma'Gamma Distributiona: shape parameterb: scale parameter
'Generalized Extreme Value'Generalized Extreme Value Distributionk: shape parameterσ: scale parameterμ: location parameter
'Generalized Pareto'Generalized Pareto Distributionk: tail index (shape) parameterσ: scale parameterμ: threshold (location) parameter
'Geometric'Geometric Distributionp: probability parameter
'Hypergeometric'Hypergeometric Distributionm: size of the populationk: number of items with the desired characteristic in the populationn: number of samples drawn
'InverseGaussian'Inverse Gaussian Distributionμ: scale parameterλ: shape parameter
'Logistic'Logistic Distributionμ: meanσ: scale parameter
'LogLogistic'Loglogistic Distributionμ: log meanσ: log scale parameter
'Lognormal'Lognormal Distributionμ: log meanσ: log standard deviation
'Nakagami'Nakagami Distributionμ: shape parameterω: scale parameter
'Negative Binomial'Negative Binomial Distributionr: number of successesp: probability of success in a single trial
'Noncentral F'Noncentral F Distributionν1: numerator degrees of freedomν2: denominator degrees of freedomδ: noncentrality parameter
'Noncentral t'Noncentral t Distributionν: degrees of freedomδ: noncentrality parameter
'Noncentral Chi-square'Noncentral Chi-Square Distributionν: degrees of freedomδ: noncentrality parameter
'Normal'Normal Distributionμ: mean σ: standard deviation
'Poisson'Poisson Distributionλ: mean
'Rayleigh'Rayleigh Distributionb: scale parameter
'Rician'Rician Distributions: noncentrality parameterσ: scale parameter
'T'Student's t Distributionν: degrees of freedom
'tLocationScale't Location-Scale Distributionμ: location parameterσ: scale parameterν: shape parameter
'Uniform'Uniform Distribution (Continuous)a: lower endpoint (minimum)b: upper endpoint (maximum)
'Discrete Uniform'Uniform Distribution (Discrete)n: maximum observable value
'Weibull'Weibull Distributiona: scale parameterb: shape parameter

x — Values at which to evaluate cdfscalar value | array of scalar values

Values at which to evaluate the cdf, specified as a scalar value, or an array of scalar values.

  • If x is a scalar value, and if you specify distribution parameters A, B, or C as arrays, then cdf expands x into a constant matrix the same size as A and B.

  • If x is an array, and if you specify distribution parameters A, B, or C as arrays, then x, A, B, and C must all be the same size.

Example: [0.1,0.25,0.5,0.75,0.9]

Data Types: single | double

A — First probability distribution parameterscalar value | array of scalar values

First probability distribution parameter, specified as a scalar value, or an array of scalar values.

If x and A are arrays, they must be the same size. If x is a scalar, then cdf expands it into a constant matrix the same size as A. If A is a scalar, then cdf expands it into a constant matrix the same size as x.

Data Types: single | double

B — Second probability distribution parameterscalar value | array of scalar values

Second probability distribution parameter, specified as a scalar value, or an array of scalar values.

If x, A, and B are arrays, they must be the same size. If x is a scalar, then cdf expands it into a constant matrix the same size as A and B. If A or B are scalars, then cdf expands them into constant matrices the same size as x

Data Types: single | double

C — Third probability distribution parameterscalar value | array of scalar values

Third probability distribution parameter, specified as a scalar value, or an array of scalar values.

If x, A, B, and C are arrays, they must be the same size. If x is a scalar, then cdf expands it into a constant matrix the same size as A, B, and C. If any of A, B or C are scalars, then cdf expands them into constant matrices the same size as x.

Data Types: single | double

pd — Probability distributionprobability distribution object

Probability distribution, specified as a probability distribution object created using one of the following.

makedistCreate a probability distribution object using specified parameter values.
fitdistFit a probability distribution object to sample data.
dfittoolFit a probability distribution object to sample data using the interactive Distribution Fitting app.
paretotailsCreate a Pareto tails object.
gmdistributionCreate a Gaussian mixture distribution object.

Output Arguments

collapse all

y — Cumulative distribution functionarray

Cumulative distribution function of the specified probability distribution, returned as an array.

  • If you specify distribution parameters A, B, or C, then y is the same size as x, A, B, and C, after any necessary scalar expansion.

  • If you specify a probability distribution object, pd, then y has the same dimensions as x.

See Also

| |

Was this topic helpful?