Main Content

pearscdf

Pearson cumulative distribution function

Since R2023b

    Description

    f = pearscdf(X,mu,sigma,skew,kurt) returns the cumulative distribution function (cdf) of the Pearson system evaluated at the values in X, using the mean mu, standard deviation sigma, skewness skew, and kurtosis kurt.

    example

    f = pearscdf(X,mu,sigma,skew,kurt,"upper") returns the complement of the Pearson cdf at the values in X. This syntax uses an algorithm that more accurately computes the extreme upper-tail probabilities for all Pearson types except 4.

    example

    [f,type] = pearscdf(___) also returns the type of the specified distribution within the Pearson system, using any of the input argument combinations in the previous syntaxes.

    example

    [f,type,coefs] = pearscdf(___) also returns the coefficients of the Pearson cdf.

    Examples

    collapse all

    Define the variables mu, sigma, skew, and kurtosis, which contain values for the mean, standard deviation, skewness, and kurtosis of a Pearson distribution, respectively.

    mu = 0;
    sigma = 2;
    skew = 0;
    kurtosis = 3;

    A Pearson distribution with a skewness of 0 and kurtosis of 3 is equivalent to the normal distribution.

    Create a vector X of points from –7 to 7 using the linspace function. Evaluate the cdf for the Pearson distribution given by mu, sigma, skew, and kurtosis at the points in X. Plot the result together with the cdf for the standard normal distribution.

    X = linspace(-7,7,1000);
    Fp = pearscdf(X,mu,sigma,skew,kurtosis);
    Fn = normcdf(X,mu,sigma);
    
    figure
    hold on
    plot(X,Fp)
    plot(X,Fn)
    legend(["Pearson CDF" "Normal CDF"])

    Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent Pearson CDF, Normal CDF.

    The plot shows that the blue curve for the Pearson distribution cdf is completely hidden by the red curve for the normal distribution cdf. This result indicates that the Pearson cdf is identical to the normal distribution cdf.

    Define the variables mu, sigma, skew, and kurtosis, which contain values for the mean, standard deviation, skewness, and kurtosis of a Pearson distribution, respectively.

    mu = 2;
    sigma = 1;
    skew = 2;
    kurtosis = 10;

    To calculate the probability of sampling a number greater than 150 from the distribution, calculate the probability of sampling a number less than or equal to 150 and subtract it from 1.

    p1 = 1 - pearscdf(150,mu,sigma,skew,kurtosis)
    p1 = 
    0
    

    This result shows that the probability of sampling a number less than or equal to 150 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 Pearson cdf directly.

    p2 = pearscdf(150,mu,sigma,skew,kurtosis,"upper")
    p2 = 
    1.0375e-18
    

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

    Define the variables mu, sigma, skew, and kurtosis, which contain values for the mean, standard deviation, skewness, and kurtosis of a Pearson distribution, respectively.

    mu = 2;
    sigma = 1;
    skew = 2;
    kurtosis = 10;

    Create a vector X of points from 0 to 8 using the linspace function. Evaluate the cdf for the Pearson distribution given by mu, sigma, skew, and kurtosis at the points in X, and return the Pearson distribution type.

    X = linspace(0,8,1000);
    [f,type] = pearscdf(X,mu,sigma,skew,kurtosis);
    type
    type = 
    6
    

    The Pearson distribution defined by mu, sigma, skew, and kurtosis is of type 6. A type 6 Pearson distribution corresponds to the F location scale distribution. In this case, the location is mu and the scale is sigma. For more information, see Pearson Distribution.

    Plot the cdf for the type 6 Pearson distribution at the points in X.

    plot(X,f)

    Figure contains an axes object. The axes object contains an object of type line.

    The plot shows that the cdf evaluates to zero at values less than 0.8. For values greater than 0.8, the cdf increases and then follows the horizontal asymptote corresponding to a probability of 1.

    Input Arguments

    collapse all

    Values at which to evaluate the Pearson cdf, specified as a scalar or a numeric array.

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

    Example: [0 0.4 0.8 0.12]

    Data Types: single | double

    Mean of the Pearson distribution, specified as a scalar, or numeric array.

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

    Example: [0 1 2; 0 1 2]

    Data Types: single | double

    Standard deviation of the Pearson distribution, specified as a positive scalar or an array of positive values.

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

    Example: [1 1 1; 2 2 2]

    Data Types: single | double

    Skewness for the Pearson distribution, specified as a scalar. The value of skew must be less than sqrt(kurt – 1). For more information, see Skewness.

    Example: 3

    Data Types: single | double

    Kurtosis for the Pearson distribution, specified as a scalar. The value of kurt must be greater than skew^2 + 1. For more information, see Kurtosis.

    Example: 11

    Data Types: single | double

    Output Arguments

    collapse all

    Pearson cdf values evaluated at the values in X returned as a scalar or a numeric array. f is the same size as X, mu, and sigma after any necessary scalar expansion. Each element in f is the cdf value of the distribution specified by skew, kurt, and the corresponding elements in mu and sigma, evaluated at the corresponding value in X.

    Type of Pearson distribution used to calculate the cdf, returned as an integer from the interval [0 7] or NaN. If the distribution parameters are invalid, pearscdf returns NaN.

    This table describes the distribution corresponding to each Pearson distribution type.

    Pearson Distribution TypeDescription
    0Normal
    14-parameter beta
    2Symmetric 4-parameter beta
    33-parameter gamma
    4Distribution specific to the Pearson system
    5Inverse 3-parameter gamma
    6F location-scale
    7Student's t location-scale

    Quadratic polynomial coefficients, returned as a numeric 1-by-3 vector. The ith element of coefs is the coefficient bi in the differential equation

    p'(x)p(x)=a+(xμ)b0+b1(xμ)+b2(xμ)2,

    which defines the Pearson distribution probability density function (pdf) p(x).

    You can calculate the support for the Pearson distribution cdf using coefs. For more information, see Probability Density Function and Support.

    More About

    collapse all

    Skewness

    Skewness is a measure of the asymmetry of the data around the sample mean. If skewness is negative, the data spreads out more to the left of the mean than to the right. If skewness is positive, the data spreads out more to the right. The skewness of the normal distribution (or any perfectly symmetric distribution) is zero.

    The skewness of a distribution is defined as

    s=E(xμ)3σ3,

    where µ is the mean of x, σ is the standard deviation of x, and E(t) represents the expected value of the quantity t.

    Kurtosis

    Kurtosis is a measure of how prone a distribution is to outliers. The kurtosis of the normal distribution is 3. Distributions that are more prone to outliers than the normal distribution have a kurtosis value greater than 3; distributions that are less prone have a kurtosis value less than 3. Some definitions of kurtosis subtract 3 from the computed value, so that the normal distribution has a kurtosis of 0. pearscdf does not use this convention.

    The kurtosis of a distribution is defined as

    k=E(xμ)4σ4,

    where μ is the mean of x, σ is the standard deviation of x, and E(t) represents the expected value of the quantity t.

    Alternative Functionality

    pearscdf is a function specific to the Pearson distribution. Statistics and Machine Learning Toolbox™ also offers the generic function cdf, which supports various probability distributions. To use cdf, specify the probability distribution name and its parameters.

    References

    [1] Johnson, Norman Lloyd, et al. "Continuous Univariate Distributions." 2nd ed, vol. 1, Wiley, 1994.

    [2] Willink, R. "A Closed-Form Expression for the Pearson Type IV Distribution Function." Australian & New Zealand Journal of Statistics, vol. 50, no. 2, June 2008, pp. 199–205. https://onlinelibrary.wiley.com/doi/10.1111/j.1467-842X.2008.00508.x.

    Extended Capabilities

    Version History

    Introduced in R2023b