SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

RGTPDF

Name:
    RGTPDF (LET)
Type:
    Library Function
Purpose:
    Compute the reflected generalized Topp and Leone probability density function with shape parameters alpha and beta.
Description:
    The reflected generalized Topp and Leone distribution has the following probability density function:

      f(x;alpha,beta,a,b) = (beta/(b-a))*
((b-x)/(b-a))**(beta-1)*
{alpha - (alpha-1)*((b-x)/(b-a))}**(beta-1)*
{alpha - 2*(alpha-1)*((b-x)/(b-a))}
   a <= x <= b, beta > 0, 0 < alpha <= 2

    with alpha and beta denoting the shape parameters and a and b the lower and upper limits, respectively.

    The case where a = 0 and b = 1 is referred to as the standard reflected generalized Topp and Leone distribution.

    The lower and upper limits are related to the location and scale parameters as follows:

      location = a
      scale = b - a

    Kotz and van Dorp have proposed this distribution as an alternative to the beta distribution. It is distinguished from the beta distribution in that it can have positive density at the lower limit with a strict positive mode.

Syntax:
    LET <y> = RGTPDF(<x>,<alpha>,<beta>,<a>,<b>)
                            <SUBSET/EXCEPT/FOR qualification>
    where <x> is a number, parameter, or variable containing values in the interval (a,b);
                <y> is a variable or a parameter (depending on what <x> is) where the computed reflected generalized Topp and Leone pdf value is stored;
                <alpha> is a number, parameter, or variable in the interval (0, 2) that specifies the first shape parameter;
                <beta> is a positive number, parameter, or variable that specifies the second shape parameter;
                <a> is a number, parameter, or variable that specifies the lower limit;
                <b> is a number, parameter, or variable that specifies the upper limit;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    If <a> and <b> are omitted, they default to 0 and 1, respectively.

Examples:
    LET A = RGTPDF(0.3,0.2,1.2)
    LET Y = RGTPDF(X,0.5,2)
    PLOT RGTPDF(X,2,3) FOR X = 0 0.01 1
Note:
    Reflected generalized Topp and Leone random numbers, probability plots, and goodness of fit tests can be generated with the commands:

      LET ALPHA = <value>
      LET BETA = <value>
      LET A = <value>
      LET B = <value>
      LET Y = REFLECTED GENERALIZED TOPP LEONE ...
                      RANDOM NUMBERS FOR I = 1 1 N
      REFLECTED GENERALIZED TOPP LEONE PROBABILITY PLOT Y
      REFLECTED GENERALIZED TOPP LEONE PROBABILITY PLOT Y2 X2
      REFLECTED GENERALIZED TOPP LEONE PROBABILITY PLOT ...
                      Y3 XLOW XHIGH
      REFLECTED GENERALIZED TOPP LEONE ...
                      KOLMOGOROV SMIRNOV GOODNESS OF FIT Y
      REFLECTED GENERALIZED TOPP LEONE CHI-SQUARE ...
                      GOODNESS OF FIT Y2 X2
      REFLECTED GENERALIZED TOPP LEONE CHI-SQUARE ...
                      GOODNESS OF FIT Y3 XLOW XHIGH

    The following commands can be used to estimate the alpha and beta shape parameters for the reflected generalized Topp and Leone distribution:

      LET ALPHA1 = <value>$
      LET ALPHA2 = <value>$
      LET BETA1 = <value>$
      LET BETA2 = <value>$
      REFLECTED GENERALIZED TOPP LEONE PPCC PLOT Y$
      REFLECTED GENERALIZED TOPP LEONE PPCC PLOT Y2 X2$
      REFLECTED GENERALIZED TOPP LEONE PPCC PLOT Y3 XLOW XHIGH$
      REFLECTED GENERALIZED TOPP LEONE KS PLOT Y$
      REFLECTED GENERALIZED TOPP LEONE KS PLOT Y2 X2$
      REFLECTED GENERALIZED TOPP LEONE KS PLOT Y3 XLOW XHIGH$

    The default values for ALPHA1 and ALPHA2 are 0.1 and 2. The default values for BETA1 and BETA2 are 0.5 and 10.

    The probability plot can then be used to estimate the lower and upper limits (lower limit = PPA0, upper limit = PPA0 + PPA1).

    The following options may be useful for these commands.

    1. Instead of generating the ppcc plot or ks plot on the original data, we can generate them on selected percentiles of the data. For example, if we have 1,000 points, we can choose to generate the plots on 100 evenly spaced percentiles with the command

        SET PPCC PLOT DATA POINTS 100

      This can be used to speed up the generation of the plot for larger data sets.

    2. For the ks plot, we can fix the location and scale. This is equivalent to assuming that the lower and upper limits are known (e.g., we could use the data minimum and maximum as the lower and upper limit values). Given that the lower and upper limits are LOWLIM and UPPLIM, enter the commands

        LET KSLOC = LOWLIM
        LET KSSCALE = UPPLIM

      The ppcc plot is invariant to location and scale, so we cannot fix the lower and upper limits.

    Kotz and Van Dorp describe an approximate maximum likelihood method for estimating the alpha and beta parameters of the standard reflected generalized Topp and Leone distribution. It is assumed that the data are grouped into m intervals [xi-1,xi] where the ith interval has ni observations. The midpoint of the interval is denoted as xbar(i). For unbinned data, the intervals consist of the individual observations (and the frequency is equal to 1). The total sample size, N is the sum of the ni.

    The parameter alpha is the solution to the following equation:

      G(alpha) = {N/SUM[i=1 to m][n(i)*LOG(1/(alpha*y(i) - 
(alpha - 1)*y(i)^2)]) - 1}*
SUM[i=1 to m][n(i)*(1 - y(i)/(alpha - (alpha - 1)*y(i))]  + 
SUM[i=1 to m][n(i)*(1 - 2*y(i)/(alpha - 2*(alpha - 1)*y(i))]

    where

      y(i) = 1 - xbar(i)

    The maximum likelihood estimate of beta is then:

      betahat = N/{SUM[i=1 to m][n(i)*LOG(1/(alpha*y(i)-(alpha-1)*y(i)^2))]

    If the data lie outside the (0,1) interval, then we first apply the transformation

      X'(i) = (X(i) - Lower Limit)/(Upper Limit - Lower Limit)

    To generate the approximate maximum likelihood estimates for ungrouped data in Dataplot, enter the command

      REFLECTED GENERALIZED TOPP AND LEONE MLE Y

    For grouped data, enter one of the following commands

      REFLECTED GENERALIZED TOPP AND LEONE MLE Y X
      REFLECTED GENERALIZED TOPP AND LEONE MLE Y XLOW XHIGH

    In the first case, X denotes the mid-points of the bins and Y denotes the corresponding frequency. In the second case, XLOW denotes the lower end-points of the bins and XHIGH denotes the upper end-points of the bins.

    If the lower and upper limits are fixed and known, you can enter the following commands:

      LET LOWLIMIT = <VALUE>
      LET UPPLIMIT = <VALUE>

    For the unknown case, the minimum and maximum of the data will be used (an epsilon value will be subtracted/added to the minimum/maximum). Alternatively, you can use the estimates of the lower/upper limits generated by either the PPCC plot method or the KS plot methods and specify the LOWLIMIT and UPPLIMIT as above.

    To specify starting values for alpha and beta, enter the commands

      LET ALPHASV = <VALUE>
      LET BETASV = <VALUE>

    For example, the estimates obtained from the PPCC plot or the KS plot can be used as starting values for the maximum likelihood estimates.

Default:
    None
Synonyms:
    MAXIMUM LIKELIHOOD is a synonym for MLE.
Related Commands:
    RGTCDF = Compute the reflected generalized Topp and Leone cumulative distribution function.
    RGTPPF = Compute the reflected generalized Topp and Leone percent point function.
    GTLPDF = Compute the generalized Topp and Leone probability density function.
    TOPPDF = Compute the Topp and Leone probability density function.
    TSPPDF = Compute the two-sided power probability density function.
    BETPDF = Compute the beta probability density function.
    TRIPDF = Compute the triangular probability density function.
    TRAPDF = Compute the trapezoid probability density function.
    UNIPDF = Compute the uniform probability density function.
    POWPDF = Compute the power probability density function.
    JSBPDF JSBPDF = Compute the Johnson SB probability density function.
Reference:
    Samuel Kotz and J. Rene Van Dorp 2004, "Beyond Beta: Other Continuous Families of Distributions with Bounded Support and Applications", World Scientific, chapter 7.
Applications:
    Distributional Modeling
Implementation Date:
    2007/2 2007/9: Support for maximum likelihood estimation
Program 1:
    LABEL CASE ASIS
    TITLE CASE ASIS
    TITLE OFFSET 2
    .
    MULTIPLOT 3 3
    MULTIPLOT CORNER COORDINATES 0 0 100 95
    MULTIPLOT SCALE FACTOR 3
    .
    LET ALPHA = 2
    LET BETA  = 3
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 1.5
    LET BETA  = 6
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 1.5
    LET BETA  = 2
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 1.5
    LET BETA  = 1
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 0.5
    LET BETA  = 2
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 0.5
    LET BETA  = 1
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 0.5
    LET BETA  = 0.75
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 0.5
    LET BETA  = 0.25
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    LET ALPHA = 1
    LET BETA  = 1
    TITLE Alpha = ^alpha, Beta = ^beta
    PLOT RGTPDF(X,ALPHA,BETA) FOR X = 0  0.01  1
    .
    END OF MULTIPLOT
        
    plot generated by sample program
Program 2:
     
    let alpha = 1.5
    let beta = 2
    .
    let y = reflected generalized topp leone rand numb for i = 1 1 200
    .
    let alphsav = alpha
    let betasav = beta
    reflected generalized topp leone ppcc plot y
    just center
    move 50 5
    let alpha = shape1
    let beta = shape2
    text maxppcc = ^maxppcc, Alpha = ^alpha, Beta = ^beta
    move 50 2
    text Alphasav = ^alphsav, Betasav = ^betasav
    .
    char x
    line blank
    reflected generalized topp leone prob plot y
    move 50 5
    text PPA0 = ^ppa0, PPA1 = ^ppa1
    move 50 2
    let upplim = ppa0 + ppa1
    text Lower Limit = ^ppa0, Upper Limit = ^upplim
    char blank
    line solid
    .
    let ksloc = ppa0
    let ksscale = upplim
    reflected generalized topp leone kolm smir goodness of fit y
    .
    bootstrap reflected generalized topp leone plot y
        
    The following output is generated:

    plot generated by sample program plot generated by sample program

                       KOLMOGOROV-SMIRNOV GOODNESS-OF-FIT TEST
      
     NULL HYPOTHESIS H0:      DISTRIBUTION FITS THE DATA
     ALTERNATE HYPOTHESIS HA: DISTRIBUTION DOES NOT FIT THE DATA
     DISTRIBUTION:            REFLECTED GENERALIZED TOPP AND LEONE
        NUMBER OF OBSERVATIONS              =      200
      
     TEST:
     KOLMOGOROV-SMIRNOV TEST STATISTIC      =   0.3394580E-01
      
        ALPHA LEVEL         CUTOFF              CONCLUSION
                10%       0.086*              ACCEPT H0
                          0.085**
                 5%       0.096*              ACCEPT H0
                          0.095**
                 1%       0.115*              ACCEPT H0
                          0.114**
      
         *  - STANDARD LARGE SAMPLE APPROXIMATION  ( C/SQRT(N) )
        ** - MORE ACCURATE LARGE SAMPLE APPROXIMATION  ( C/SQRT(N + SQRT(N/10)) )
        
    plot generated by sample program

Date created: 9/10/2007
Last updated: 9/17/2007
Please email comments on this WWW page to alan.heckert@nist.gov.