Main Content

wblcdf

Weibull cumulative distribution function

Description

p = wblcdf(x) returns the Weibull cumulative distribution function (cdf) evaluated at the values in x, using unit scale and shape parameters.

example

p = wblcdf(x,a,b) returns the cdf with the scale parameters in a and shape parameters in b.

example

[p,pLo,pUp] = wblcdf(x,a,b,pCov,alpha) additionally returns the 95% confidence interval [pLo,pUp] of p when a and b are estimates. pCov is the covariance matrix of the estimated parameters, and alpha specifies the confidence level for the confidence interval [pLo,pUp] to be 100(1 – alpha)%.

example

___ = wblcdf(___,"upper") returns the complement of the Weibull cdf, evaluated at the values in x, using an algorithm that more accurately computes the extreme upper-tail probabilities as compared to subtracting the lower-tail value from 1. "upper" can follow any of the input argument combinations in the previous syntaxes.

example

Examples

collapse all

Compute the cdf values evaluated at the values in x for the Weibull distribution with scale parameter a=1.5 and shape parameter b=2.

x = 0:0.2:5;
a = 1.5;
b = 2;
p = wblcdf(x,a,b);

Plot the cdf.

plot(x,p)
grid on
xlabel("x")
ylabel("p")

Figure contains an axes object. The axes object with xlabel x, ylabel p contains an object of type line.

Find the maximum likelihood estimates (MLEs) of the Weibull distribution parameters, and then find the confidence interval of the corresponding cdf value.

Generate 1000 random numbers from the Weibull distribution with the parameters 3 and 2.

rng(0,"twister") % For reproducibility
n = 1000; % Number of samples
x = wblrnd(3,2,n,1);

Find the MLEs for the distribution parameters (scale and shape) by using the mle function.

pHat = mle(x,Distribution="Weibull")
pHat = 1×2

    3.0406    2.1291

aHat = pHat(1);
bHat = pHat(2);

Use the wbllike function to estimate the covariance of the distribution parameters. The function returns an approximation to the asymptotic covariance matrix if you pass the MLEs and the samples used to estimate the MLEs.

[~,pCov] = wbllike(pHat,x)
pCov = 2×2

    0.0023    0.0008
    0.0008    0.0028

Find the cdf value at 0.5 and its 95% confidence interval.

[p,pLo,pUp] = wblcdf(0.5,aHat,bHat,pCov)
p = 
0.0212
pLo = 
0.0171
pUp = 
0.0262

p is the cdf value of the Weibull distribution with the parameters aHat and bHat. The interval [pLo,pUp] is the 95% confidence interval of the cdf evaluated at 0.5, considering the uncertainty of aHat and bHat using pCov. The 95% confidence interval means the probability that [pLo,pUp] contains the true cdf value is 0.95.

Determine the probability of sampling a number greater than 15 from the Weibull distribution with scale parameter a=2 and shape parameter b=2. To determine the probability, calculate the probability of sampling a number less than or equal to 15 and subtract it from 1.

a = 2;
b = 2;
p1 = 1 - wblcdf(15,a,b)
p1 = 
0

This result shows that the probability of sampling a number less than or equal to 15 is so close to 1 that subtracting it from 1 gives 0.

To approximate the extreme upper-tail probability with greater precision, compute the complement of the Weibull cdf directly.

p2 = wblcdf(15,a,b,"upper")
p2 = 
3.7234e-25

The output indicates a small probability of sampling a number greater than 15.

Input Arguments

collapse all

Values at which to evaluate the Weibull cdf, specified as a nonnegative scalar or an array of nonnegative scalars.

To evaluate the cdf at multiple values, specify x as an array. To evaluate the cdfs of multiple distributions, specify either a or b (or both) using arrays. If one or more of the input arguments x, a, and b are arrays, then the array sizes must be the same. In this case, wblcdf expands each scalar input into a constant array of the same size as the array inputs. Each element in p is the cdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

Data Types: single | double

Scale parameter, specified as a positive scalar or an array of positive scalars. If you specify pCov to compute the confidence interval [pLo,pUp], then a must be a scalar.

To evaluate the cdf at multiple values, specify x as an array. To evaluate the cdfs of multiple distributions, specify either a or b (or both) using arrays. If one or more of the input arguments x, a, and b are arrays, then the array sizes must be the same. In this case, wblcdf expands each scalar input into a constant array of the same size as the array inputs. Each element in p is the cdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

Data Types: single | double

Shape parameter, specified as a positive scalar or an array of positive scalars. If you specify pCov to compute the confidence interval [pLo,pUp], then b must be a scalar.

To evaluate the cdf at multiple values, specify x as an array. To evaluate the cdfs of multiple distributions, specify either a or b (or both) using arrays. If one or more of the input arguments x, a, and b are arrays, then the array sizes must be the same. In this case, wblcdf expands each scalar input into a constant array of the same size as the array inputs. Each element in p is the cdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

Data Types: single | double

Covariance of the estimates a and b, specified as a 2-by-2 matrix.

If you specify pCov to compute the confidence interval [pLo,pUp], then a and b must be numeric scalars.

You can estimate a and b by using wblfit or mle, and estimate the covariance of a and b by using wbllike. For an example, see Confidence Interval of Weibull cdf Value.

Data Types: single | double

Significance level for the confidence interval, specified as a scalar in the range (0,1). The confidence level is 100(1 – alpha)%, where alpha is the probability that the confidence interval does not contain the true value.

Data Types: single | double

Output Arguments

collapse all

Weibull cdf values evaluated at the values in x, returned as a scalar a numeric array. p is the same size as x, a, and b after any necessary scalar expansion. Each element in p is the cdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding value in x.

Lower confidence bound for p, returned as a numeric scalar or numeric array. pLo has the same size as p.

Upper confidence bound for p, returned as a numeric scalar or numeric array. pUp has the same size as p.

More About

collapse all

Alternative Functionality

  • wblcdf is a function specific to the Weibull distribution. Statistics and Machine Learning Toolbox™ also offers the generic function cdf, which supports various probability distributions. To use cdf, create a WeibullDistribution probability distribution object and pass the object as an input argument or specify the probability distribution name and its parameters. Note that the distribution-specific function wblcdf is faster than the generic function cdf.

  • Use the Probability Distribution Function Tool to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

Extended Capabilities

expand all

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a