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

LPOPDF

Name:
    LPOPDF (LET)
Type:
    Library Function
Purpose:
    Compute the Lagrange-Poisson probability mass function.
Description:
    Given a single queue with random arrival times of customers at constant rate l, constant service time beta, and k initial customers, the Borel-Tanner distribution is the distribution of the total number of customers served before the queue vanishes. The distribution is parameterized with lambda = lbeta.

    If the Borel-Tanner distribution is shifted to start at X = 0 and is reparameterized with

      theta = klambda

      lambda = lambda

    the resulting distribution is referred to as the Lagrange-Poisson distribution (or the Consul generalized Poisson distribution).

    This distribution has probability mass function

      p(x;lambda,theta) = theta*(theta+x*lambda)**(x-1)*
EXP(-theta-x*lambda)/x!    x = 0, 1, ...; 0 < ;lambda < 1; theta > 0

    with theta and lambda denoting the shape parameters.

    Consul has studied this distribution extensively. In particular, he has studied the effect of allowing lambda to be negative. At this time, Dataplot does not support negative values of lambda.

    The moments of the Lagrange-Poisson distribution are

      • mean
      = theta/(1-lambda)
      • variance
      = theta/(1-lambda)^3
      • skewness
      = (1+2*lambda)^2/(theta*(1-lambda))
      • kurtosis
      = 3 + (1+8*lambda+6*lambda^2)/(theta*(1-lambda))

Syntax:
    LET <y> = LPOPDF(<x>,<lambda>,<theta>)>
                            <SUBSET/EXCEPT/FOR qualification>
    where <x> is a positive integer variable, number, or parameter;
                <lambda> is a number or parameter in the range (0,1) that specifies the first shape parameter;
                <theta> is a positive number or parameter that specifies the second shape parameter;
                <y> is a variable or a parameter where the computed Lagrange-Poisson pdf value is stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET A = LPOPDF(3,0.5,3)
    LET Y = LPOPDF(X1,0.3,2)
    PLOT LPOPDF(X,0.3,2) FOR X = 0 1 20
Note:
    For a number of commands utilizing the Lagrange-Poisson distribution, it is convenient to bin the data. There are two basic ways of binning the data.

    1. For some commands (histograms, maximum likelihood estimation), bins with equal size widths are required. This can be accomplished with the following commands:

        LET AMIN = MINIMUM Y
        LET AMAX = MAXIMUM Y
        LET AMIN2 = AMIN - 0.5
        LET AMAX2 = AMAX + 0.5
        CLASS MINIMUM AMIN2
        CLASS MAXIMUM AMAX2
        CLASS WIDTH 1
        LET Y2 X2 = BINNED

    2. For some commands, unequal width bins may be helpful. In particular, for the chi-square goodness of fit, it is typically recommended that the minimum class frequency be at least 5. In this case, it may be helpful to combine small frequencies in the tails. Unequal class width bins can be created with the commands

        LET MINSIZE = <value>
        LET Y3 XLOW XHIGH = INTEGER FREQUENCY TABLE Y

      If you already have equal width bins data, you can use the commands

        LET MINSIZE = <value>
        LET Y3 XLOW XHIGH = COMBINE FREQUENCY TABLE Y2 X2

      The MINSIZE parameter defines the minimum class frequency. The default value is 5.

Note:
    You can generate Lagrange-Poisson random numbers, probability plots, and chi-square goodness of fit tests with the following commands:

      LET N = VALUE
      LET THETA = <value>
      LET LAMBDA = <value>
      LET Y = LAGRANGE POISSON RANDOM NUMBERS FOR I = 1 1 N

      LAGRANGE POISSON PROBABILITY PLOT Y
      LAGRANGE POISSON PROBABILITY PLOT Y2 X2
      LAGRANGE POISSON PROBABILITY PLOT Y3 XLOW XHIGH
      LAGRANGE POISSON CHI-SQUARE GOODNESS OF FIT Y LAGRANGE POISSON CHI-SQUARE GOODNESS OF FIT Y2 X2 LAGRANGE POISSON CHI-SQUARE GOODNESS OF FIT Y3 XLOW XHIGH

    To obtain the method of moments, the method of zero frequency and the mean, and the weighted discrepancies estimates of lambda and theta, enter the command

      LAGRANGE POISSON MAXIMUM LIKELIHOOD Y LAGRANGE POISSON MAXIMUM LIKELIHOOD Y2 X2

    The method of moments estimates are

      thetahat = SQRT(xbar^3/s^2)

      lambdahat = thetahat*SQRT(s^2/xbar^3) - 1/xbar

    with xbar and s2 denoting the sample mean and sample variance, respectively.

    The mean and zero frequency estimates are

      thetahat = LOG(1/(f0/N))

      lambdahat = 1 - thetahat/xbar

    with xbar and f0 denoting the sample mean and sample frequency at x = 0, respectively.

    The method of weighted discrepancies (a modification of the maximum likelihood estimates) are the solution to the following equations:

      SUM[x=1 to xmax][(f(x) - P(x)]*
{x*(theta+lambda)/(theta*(theta+lambda*x)) - 1} = 0

      SUM[x=1 to xmax][(f(x) - P(x)]*{x*(x-1)/(theta+lambda*x)) - x} = 0

    with f(x) and P(x) denoting the frequency at x and the Lagrange-Poisson probaility mass function value at x, respectively.

    If you have raw data, Dataplot will automatically bin the data (you can use the CLASS LOWER, CLASS UPPER and CLASS WIDTH commands to specify the binning algorithm).

    You can generate estimates of lambda and theta based on the maximum ppcc value or the minimum chi-square goodness of fit with the commands

      LET THETA1 = <value>
      LET THETA2 = <value>
      LET LAMBDA1 = <value>
      LET LAMBDA2 = <value>
      LAGRANGE POISSON KS PLOT Y
      LAGRANGE POISSON KS PLOT Y2 X2
      LAGRANGE POISSON KS PLOT Y3 XLOW XHIGH
      LAGRANGE POISSON PPCC PLOT Y
      LAGRANGE POISSON PPCC PLOT Y2 X2
      LAGRANGE POISSON PPCC PLOT Y3 XLOW XHIGH

    The default values of lambda1 and lambda2 are 0.05 and 0.95, respectively. The default values of theta1 and theta2 are 0.5 and 10, respectively. Due to the discrete nature of the percent point function for discrete distributions, the ppcc plot will not be smooth. For that reason, if there is sufficient sample size the KS PLOT (i.e., the minimum chi-square value) is typically preferred. However, it may sometimes be useful to perform one iteration of the PPCC PLOT to obtain a rough idea of an appropriate neighborhood for the shape parameters since the minimum chi-square statistic can generate extremely large values for non-optimal values of the shape parameter. Also, since the data is integer values, one of the binned forms is preferred for these commands.

Default:
    None
Synonyms:
    None
Related Commands:
    LPOCDF = Compute the Lagrange-Poisson cumulative distribution function.
    LPOPPF = Compute the Lagrange-Poisson percent point function.
    BTAPDF = Compute the Borel-Tanner probability mass function.
    LOSPDF = Compute the lost games probability mass function.
    POIPDF = Compute the Poisson probability mass function.
    HERPDF = Compute the Hermite probability mass function.
    BINPDF = Compute the binomial probability mass function.
    NBPDF = Compute the negative binomial probability mass function.
    GEOPDF = Compute the geometric probability mass function.
    INTEGER FREQUENCY TABLE = Generate a frequency table at integer values with unequal bins.
    COMBINE FREQUENCY TABLE = Convert an equal width frequency table to an unequal width frequency table.
    KS PLOT = Generate a minimum chi-square plot.
    MAXIMUM LIKELIHOOD = Perform maximum likelihood estimation for a distribution.
Reference:
    Johnson, Kotz, and Kemp (1992), "Univariate Discrete Distributions", Second Edition, Wiley, pp. 394-400.

    Felix Famoye and Carl M. -S. Lee (1992), "Estimation of Generalized Poisson Distribution", Communications in Statistics -- Simulation, 21(1), pp. 173-188.

    P. C. Consul (1989), "Generalized Poisson Distributions", Dekker, New York.

Applications:
    Distributional Modeling
Implementation Date:
    2006/6
Program:
     
    let theta = 0.4
    let lambda = 0.8
    let y = lagrange poisson random numbers for i = 1 1 500
    .
    let y3 xlow xhigh = integer frequency table y
    class lower 1.5
    class width 1
    let amax = maximum y
    let amax2 = amax + 0.5
    class upper amax2
    let y2 x2 = binned y
    .
    let k = minimum y
    lagrange poisson mle y
    relative histogram y2 x2
    limits freeze
    pre-erase off
    line color blue
    plot lpopdf(x,lambdawd,thetawd) for x = 0 1 amax
    limits
    pre-erase on
    line color black
    let lambda = lambdawd
    let theta = thetawd
    lagrange poisson chi-square goodness of fit y3 xlow xhigh
    case asis
    justification center
    move 50 97
    text Lambda = ^lambdawd, Theta = ^thetawd
    move 50 93
    text Minimum Chi-Square = ^minks, 95% CV = ^cutupp95
    .
    label case asis
    x1label Lambda
    y1label Minimum Chi-Square
    let theta1 = 0.1
    let theta2 = 5
    let lambda1 = 0.5
    let lambda2 = 0.95
    lagrange poisson ks plot y3 xlow xhigh
    let lambda = shape1
    let theta = shape2
    lagrange poisson chi-square goodness of fit y3 xlow xhigh
    case asis
    justification center
    move 50 97
    text Lambda = ^lambda, Theta = ^theta
    move 50 93
    text Minimum Chi-Square = ^minks, 95% CV = ^cutupp95
        

    plot generated by sample program

                       CHI-SQUARED GOODNESS-OF-FIT TEST
      
     NULL HYPOTHESIS H0:      DISTRIBUTION FITS THE DATA
     ALTERNATE HYPOTHESIS HA: DISTRIBUTION DOES NOT FIT THE DATA
     DISTRIBUTION:            LAGRANGE-POISSON
      
     SAMPLE:
        NUMBER OF OBSERVATIONS      =      500
        NUMBER OF NON-EMPTY CELLS   =       13
        NUMBER OF PARAMETERS USED   =        2
      
     TEST:
     CHI-SQUARED TEST STATISTIC     =    7.672152
        DEGREES OF FREEDOM          =       10
        CHI-SQUARED CDF VALUE       =    0.339174
      
        ALPHA LEVEL         CUTOFF              CONCLUSION
                10%       15.98718               ACCEPT H0
                 5%       18.30704               ACCEPT H0
                 1%       23.20925               ACCEPT H0
      
           CELL NUMBER, LOWER BIN POINT, UPPER BIN POINT, OBSERVED FREQUENCY, AND EXPECTED FREQUENCY
           WRITTEN TO FILE DPST1F.DAT
        
    plot generated by sample program
                       CHI-SQUARED GOODNESS-OF-FIT TEST
      
     NULL HYPOTHESIS H0:      DISTRIBUTION FITS THE DATA
     ALTERNATE HYPOTHESIS HA: DISTRIBUTION DOES NOT FIT THE DATA
     DISTRIBUTION:            LAGRANGE-POISSON
      
     SAMPLE:
        NUMBER OF OBSERVATIONS      =      500
        NUMBER OF NON-EMPTY CELLS   =       13
        NUMBER OF PARAMETERS USED   =        2
      
     TEST:
     CHI-SQUARED TEST STATISTIC     =    7.517390
        DEGREES OF FREEDOM          =       10
        CHI-SQUARED CDF VALUE       =    0.324138
      
        ALPHA LEVEL         CUTOFF              CONCLUSION
                10%       15.98718               ACCEPT H0
                 5%       18.30704               ACCEPT H0
                 1%       23.20925               ACCEPT H0
      
           CELL NUMBER, LOWER BIN POINT, UPPER BIN POINT, OBSERVED FREQUENCY, AND EXPECTED FREQUENCY
           WRITTEN TO FILE DPST1F.DAT
        

Date created: 6/20/2006
Last updated: 6/20/2006
Please email comments on this WWW page to alan.heckert@nist.gov.