l Moments

March 17, 2018 | Author: Javier Senent Aparicio | Category: Parameter (Computer Programming), Skewness, Cluster Analysis, Subroutine, Normal Distribution


Comments



Description

RC 20525 (90933) 8/5/96, revised 7/25/05 Mathematics 33 pagesResearch Report Fortran routines for use with the method of L-moments Version 3.04 J. R. M. Hosking IBM Research Division T. J. Watson Research Center Yorktown Heights, NY 10598 Research Division Almaden • Austin • Beijing • Haifa • T.J. Watson • Tokyo • Zurich Fortran routines for use with the method of L-moments Version 3.04 J. R. M. Hosking IBM Research Division P. O. Box 218 Yorktown Heights, NY 10598 Abstract. Hosking (J. R. Statist. Soc. B, 1990) and Hosking and Wallis (Regional frequency analysis: an approach based on L-moments, Cambridge University Press, 1997) have described L-moments and L-moment ratios, quantities useful in the summarization and estimation of probability distributions. This report contains details of Fortran routines that should facilitate the use of L-moment-based methods. The routines described in this Research Report are available on the electronic software repository StatLib, at the Internet location http://lib.stat.cmu.edu/general/lmoments. . Contents Introduction Routines for specific distributions Routines to compute L-moments Routines for regional frequency analysis Auxiliary routines Data files Links between routines Machine dependence Change history References 1 4 12 16 26 27 28 29 30 32 Index of routines Routine CDFEXP CDFGAM CDFGEV CDFGLO CDFGNO CDFGPA CDFGUM CDFKAP CDFNOR CDFPE3 CDFWAK CLUAGG CLUINF CLUKM DERF DIGAMD DLGAMA DURAND GAMIND LMREXP LMRGAM Page 6 6 6 6 6 6 6 6 6 6 6 17 19 20 26 26 26 26 26 8 8 Routine LMRGEV LMRGLO LMRGNO LMRGPA LMRGUM LMRKAP LMRNOR LMRPE3 LMRWAK PELEXP PELGAM PELGEV PELGLO PELGNO PELGPA PELGUM PELKAP PELNOR PELPE3 PELWAK QUAEXP Page 8 8 8 8 8 8 8 8 8 10 10 10 10 10 10 10 10 10 10 10 7 Routine QUAGAM QUAGEV QUAGLO QUAGNO QUAGPA QUAGUM QUAKAP QUANOR QUAPE3 QUASTN QUAWAK REGLMR REGTST SAMLMR SAMLMU SAMPWM SORT XCLUST XFIT XSIM XTEST Page 7 7 7 7 7 7 7 7 7 26 7 21 22 13 14 15 26 24 24 25 25 . . . ) is the r th shifted Legendre polynomial. Particularly useful special cases are the probability weighted moments αr = M1. 1979b) also considered “plotting-position” estimators of probability weighted moments. ≤ xn:n be the ordered sample..(j − r) xj :n ... br and r are unbiased estimators of αr . (n − 1)(n − 2)..0. The foregoing quantities are defined for a probability distribution.Introduction Probability weighted moments of a random variable X with cumulative distribution function F were defined by Greenwood et al.0 = E [X {F (X )}r ] . Hosking (1990) defined “L-moments” to be the quantities ∗ λr = E [XPr −1 {F (X )}] ∗ ( . Landwehr et al. L-moments and probability weighted where Pr moments are related by r λr+1 = k=0 p∗ r.k bk . n n (2) (3) r Then ar . (n − 1)(n − 2).r. k L-moment ratios are the quantities τr = λr /λ2 . Let ar = n−1 br = n− 1 r+1 = k=0 (n − j )(n − j − 1).s = E [X p {F (X )}r {1 − F (X )}s ] .(n − r) j =1 (j − 1)(j − 2). The estimator tr = r / 2 of τr is consistent but not unbiased. (1979a. Let pj :n be a plotting 1 . (1979) to be the quantities Mp.. βr and λr respectively.k βk (1) where r −k p∗ r.k = (−1) r k r+k . Let x1:n ≤ x2:n ≤ ..(n − r) j =1 p∗ r.r..(n − j − r + 1) xj :n .. but in practice must often be estimated from a finite sample.r = E [X {1 − F (X )}r ] and βr = M1.. to calculate the L-moments given the parameters and to calculate the parameters given the loworder L-moments. Auxiliary routines called by some of the earlier routines: mathematical functions. j =1 n ∗ Pr −1 (pj :n ) xj :n .e. Three routines are concerned with cluster analysis. Hosking (1990) and Hosking and Wallis (1997. τ ˜r = λ (4) (5) Plotting-position estimators are consistent. sec. One other routine calculates diagnostic statistics useful in deciding whether a set of samples may be regarded as having similar frequency distributions: these statistics are described more fully in Hosking and Wallis (1997.8). chap. routines to evaluate the cumulative distribution function and quantile function of the distribution. pr j :n xj :n . routines to calculate estimates of the probability weighted moments and L-moments of the distribution from which the sample was drawn. sec.position. 1995. 1997. Given a sample of data. a pseudo-random number generator and a routine to sort a data array into ascending order. Then αr . One routine calculates a weighted average of L-moment ratios estimated from data measured at different sites. for many distributions in common use. chaps. j =1 ˜r = n−1 β ˜ r = n−1 λ ˜ r /λ ˜2 . an essential part of L-moment-based index-flood procedures such as the regional L-moment algorithm described in Hosking and Wallis (1997. a distribution-free estimator of F (xj :n ). λr and τr are estimated respectively by n α ˜ r = n−1 j =1 n (1 − pj :n )r xj :n . For this reason double-precision arithmetic is used throughout.2). 3–5). 2) give expositions of the theory of L-moments and L-moment ratios. • • • • The routines are written in Fortran-77. 1997). Hosking and Wallis (1997. expressions for the L-moments of the distributions and algorithms for estimating the parameters of the distributions by equating sample and population L-moments (the “method of L-moments”). Programs to apply the regional L-moment algorithm and to calculate the diagnostic statistics for a regional data set. βr . i. The routines aim for accuracy of about 8 significant digits. This report contains details of Fortran routines that should facilitate the use of L-moment-based methods. Hosking and Wallis. Single precision may 2 . Routines useful in connection with index-flood procedures for regional frequency analysis (Hosking and Wallis. The following routines are included. • For each of the eleven distributions listed in Table 1 on page 5. 6. but can have large bias and cannot be generally recommended (Hosking and Wallis. 2. Appendix) give. and do not explicitly involve L-moments. Decreased accuracy is particularly likely when the shape parameter of the distribution is close to zero (less than 10−4 in absolute value). or when the shape parameter is large and positive. when the shape parameter is close to the end of the range of its permissible values. Caveat: Statements about the accuracy of individual routines are not unconditional guarantees. or is close to a value at which the mean of the distribution does not exist.be adequate on machines that use 60 bits to represent a single-precision floating-point number. but are valid over wide ranges of values of the input parameters including those most frequently encountered in practice. 3 . The relationship between these parameters and those of the gamma distribution is as follows. Calculates the parameters of the distribution given its L-moments. the standard deviation σ and the skewness γ . If γ > 0. 4 . For example the cumulative distribution function of the gamma distribution is FUNCTION CDFGAM. then X − µ + 2σ/γ has a gamma distribution with parameters α = 4/γ 2 . Let X be a random variable with a Pearson type III distribution with parameters µ. β = |σγ/2|. If γ = 0. The following routines are provided for each distribution. reflected gamma distributions (which have negative skewness) and the Normal distribution (which has zero skewness). When the L-moments are the sample L-moments of a set of data. Here xxx is the 3-letter code used to identify the distribution. then X has a Normal distribution with mean µ and standard deviation σ . The quantile function (inverse cumulative distribution function) of the distribution. ξ = ζ + eµ . β = σγ/2. The three-parameter lognormal distribution. then the resulting parameters are of course the “method of L-moments” estimates of the parameters. Most of these distributions are standard and are as defined in Hosking and Wallis (1997. Appendix). If γ < 0. α = σeµ . The Pearson type III distribution combines gamma distributions (which have positive skewness). is a generalized Normal distribution with parameters k = −σ .Routines for specific distributions Routines are provided for the eleven distributions listed in Table 1. We parametrize the Pearson type III distribution by its first three (conventional) moments: the mean µ. as given in Table 1. σ and γ . with cumulative distribution function F (x) = Φ[{log(x − ζ ) − µ}/σ ] . Calculates the L-moment ratios of the distribution given its parameters. The generalized Normal distribution combines lognormal distributions (which have positive skewness). FUNCTION CDFxxx FUNCTION QUAxxx SUBROUTINE LMRxxx SUBROUTINE PELxxx The cumulative distribution function of the distribution. reflected lognormal distributions (which have negative skewness) and the Normal distribution (which has zero skewness). then −X + µ − 2σ/γ has a gamma distribution with parameters α = 4/γ 2 . α) = {Γ(α)}−1 Φ(x) = (2π ) −1/2 x −∞ x α−1 −t t e 0 2 dt is the incomplete gamma integral. x(F ) F = 1 − exp{−(x − ξ )/α} x = ξ − α log(1 − F ) F = G(x/β. Number of Parameters parameters Distribution Code F (x). α) x(F ) not explicitly defined F = exp[−{1 − k (x − ξ )/α}1/k ] x = ξ + α{1 − (− log F )k }/k F = 1/[1 + {1 − k (x − ξ )/α}1/k ] x = ξ + α[1 − {(1 − F )/F }k ]/k F = Φ[−k −1 log{1 − k (x − ξ )/α}] x(F ) not explicitly defined F = 1 − {1 − k (x − ξ )/α}1/k x = ξ + α{1 − (1 − F )k }/k F = exp[− exp{−(x − ξ )/α}] x = ξ + α log(− log F ) F = [1 − h{1 − k (x − ξ )/α}1/k ]1/h x = ξ + α[1 − {(1 − F )h /h}k ]/k F = Φ{(x − µ)/σ } x(F ) not explicitly defined 2 γ >0 F = G (x − µ + 2σ/γ )/| 1 2 σγ |. exp(−t /2) dt is the standard Normal cumulative distribution function. 5 . 4/γ 2 . 4/γ . γ<0 x(F ) not explicitly defined Exponential EXP 2 ξα Gamma GAM 2 αβ Generalized GEV extreme-value Generalized logistic Generalized Normal Generalized Pareto Gumbel GLO 3 ξαk 3 ξαk GNO 3 ξαk GPA 3 ξαk GUM 2 ξα Kappa KAP 4 ξαkh Normal NOR 2 µσ Pearson type III PE3 3 µσγ Wakeby WAK 5 ξαβγδ F (x) not explicitly defined α γ x = ξ + {1 − (1 − F )β } − {1 − (1 − F )−δ } β δ G(x. 1 F = 1−G −(x−µ+2σ/γ )/| 2 σγ |.Table 1: Distributions for which L-moment subroutines are provided. solves the equation x(F ) = x0 for F using Halley’s method. supplied as the auxiliary routine DERF. given an argument x0 of the Wakeby cumulative distribution function.PARA) CDFWAK(X.PARA) CDFGAM(X.PARA) CDFGLO(X. Numerical method CDFGAM and CDFPE3 are calculated from the incomplete gamma integral. 1981. double-precision array of length equal to the number of parameters of the distribution] The parameters of the distribution.Cumulative distribution functions DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION CDFEXP(X. the second-order analogue of Newton-Raphson iteration (Churchhouse.PARA) CDFGPA(X.PARA) CDFPE3(X. 6 . Accuracy In principle (but see the caveat on page 3) all routines are accurate to at least 8 decimal places. auxiliary routine GAMIND. pp. double precision] The argument of the function.PARA) CDFGEV(X. 1986).PARA) CDFKAP(X.PARA) CDFGUM(X. [input. Huh. given in Table 1: the routines straightforwardly evaluate these expressions. CDFGNO and CDFNOR are calculated from the error function.PARA) CDFGNO(X.PARA) CDFNOR(X.PARA) Formal parameters X PARA [input. 151-152. The other cumulative distribution functions have explicit analytical expressions. Routine CDFWAK. Accuracy Let F be the argument of the quantile function.PARA) QUAGLO(F.PARA) QUAPE3(F.PARA) QUANOR(F. given in Table 1: the routines straightforwardly evaluate these expressions. and transform it to get the required quantile function. supplied as the auxiliary routine QUASTN. 7 . Numerical method Routine QUAGAM.PARA) Formal parameters F PARA [input.PARA) QUAGUM(F. In principle (but see the caveat on page 3) each routine returns a quantile x(F0 ) corresponding to an argument F0 that satisfies |F − F0 | ≤ 10−8 .PARA) QUAGPA(F. given an argument F0 of the Gamma quantile function. the error of the approximation is equivalent to a perturbation of no more than 10−8 in the argument of the function.PARA) QUAKAP(F. In other words.PARA) QUAGNO(F. Routines QUAGNO and QUANOR use the quantile function of the standard Normal distribution.PARA) QUAGEV(F. double-precision array of length equal to the number of parameters of the distribution] The parameters of the distribution.Quantile functions DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE DOUBLE PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION PRECISION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION FUNCTION QUAEXP(F.PARA) QUAGAM(F.PARA) QUAWAK(F. solves the equation G(x. double precision] The argument of the function. α) = F0 for x using Newton-Raphson iteration. The other quantile functions have explicit analytical expressions. [input. XMOM.XMOM..XMOM...NMOM) LMRPE3(PARA.7). Appendix A. .XMOM. [output. (9) of Hosking et al. In routines LMRGAM and LMRPE3.8). integer] The number of L-moments to be found. Each λk is then calculated from βk and the λj .NMOM) LMRGNO(PARA. NMOM may be at most 4.NMOM) LMRGPA(PARA. τ4 . rational-function approximations for τ3 and τ4 . λ2 .XMOM. [input. Appendix A.XMOM. Higher-order L-moment ratios are expressed as polynomials in the shape parameter k . Appendix A. using the formula k 2k (2j − 1)(2k )! λk+1 = βk − λj .NMOM) LMRGLO(PARA. k (k + j )! (k + 1 − j )! j =1 easily proved by induction using (1)..XMOM. (1985).XMOM.XMOM. The first two L-moments are calculated using the expressions in Hosking and Wallis (1997. in the order λ1 .NMOM) LMRGAM(PARA. j = 1.XMOM.NMOM) LMRWAK(PARA. . For k = 0.. Numerical method LMREXP LMRGAM L-moments and L-moment ratios are calculated using the expressions in Hosking and Wallis (1997.XMOM. . double-precision array of length NMOM] The L-moment ratios of the distribution. Probability weighted moments βk are calculated using eq. in the other routines it may be at most 20.L-moment ratios SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE LMREXP(PARA.9): analytic expressions for λ1 and λ2 .NMOM) LMRKAP(PARA.NMOM) LMRGUM(PARA.NMOM) LMRGEV(PARA. higher-order L-moment ratios are those 8 LMRGEV LMRGNO .NMOM) Formal parameters PARA XMOM NMOM [input. double-precision array of length equal to the number of parameters of the distribution] The parameters of the distribution. k − 1. τ3 .NMOM) LMRNOR(PARA. Appendix A. L-moments and L-moment ratios are calculated using expressions in Hosking and Wallis (1997. LMRGLO The first two L-moments are calculated using the expressions in Hosking and Wallis (1997.2). 341). L-moments are calculated from those of the gamma distribution. their accuracy for τr is at least 8 decimal places if r ≤ 12. of which the Pearson type III is a reparametrization.of the Normal distribution. Γ(1 − k )Γ(r + 1 + k ) which can be derived from the expression for αr given by Hosking and Wallis (1987.5). They are initialized in a data statement and copied into array XMOM as required. r ≥ 5) are computed from the general expression αΓ(1 + k )Γ(r − 1 − k ) λr = . Appendix A. Routines LMRGAM. LMRGLO. −∞ where Pr−1 ( . LMRGUM. the rth L-moment of the distribution. 514). The routine evaluates the explicit formulas given by Hosking and Wallis (1997. this integral is. 9 . Higher-order L-moment ratios are the same for all Gumbel distributions. Higher-order L-moment ratios are the same for all Normal distributions. apart from a linear transformation. The first two L-moments are calculated using the expressions in Hosking and Wallis (1997. Probability weighted moments βk are calculated using eq. Appendix A.11). at least 4 decimal places if r ≤ 18. Appendix A.3). LMRGNO and LMRPE3 are accurate to 6 decimal places. Γ(1 − β )Γ(r + 1 + β ) Γ(1 + δ )Γ(r + 1 − δ ) LMRGUM LMRKAP LMRNOR LMRPE3 LMRWAK which can be derived from the expression for αr given by Kotz et al. The first two L-moments are calculated using the expressions in Hosking and Wallis (1997. Higher-order L-moments (λr . p.4). higher-order L-moment ratios are found by numerical evaluation of the integral ∞ √ exp{−(x + k/ 2)2 }Pr−1 (erf x) dx . routines LMREXP. The numerical method is the same as that of routine LMRGAM. Higher-order L-moments (λr . LMRGPA. (1988. Accuracy In principle (but see the caveat on page 3) all routines are accurate to at least 8 significant digits for λ1 and λ2 . Appendix A. For higher-order L-moment ratios. ) is the (r − 1)th Legendre polynomial and erf is the error function. LMRGPA The routine evaluates the explicit formulas given by Hosking and Wallis (1997. The λk are calculated from the βk as in routine LMRGEV. For k = 0. Routines LMRGEV and LMRKAP become less and less accurate as the order of the L-moment ratio increases. LMRNOR and LMRWAK are accurate to at least 8 decimal places. (12) of Hosking (1994). p. They are initialized in a data statement and copied into array XMOM as required. r ≥ 5) are computed from the general expression λr = αΓ(1 + β )Γ(r − 1 − β ) γ Γ(1 − δ )Γ(r − 1 + δ ) + . PARA) PELKAP(XMOM. as a function of the L-CV τ = λ2 /λ1 . PELGAM PELGEV Rational approximation is used to express α. The method is as described by Hosking (1994). the routines evaluate expressions for the parameters in terms of the L-moments given in the appendix of Hosking and Wallis (1997).PARA) PELWAK(XMOM. If τ3 < −0.725h > −1 . Appendix A.IFAIL) PELNOR(XMOM. (13)): k > −1.PARA) PELGNO(XMOM. PELKAP 10 .PARA) PELGLO(XMOM.PARA. if h < 0 then hk > −1. double-precision array of length equal to the number of parameters of the distribution] The L-moment ratios λ1 .PARA) PELGUM(XMOM. τ4 . .8 ≤ τ3 < 1.PARA.PARA) PELGAM(XMOM. λ2 . . For −0. k and h. λ2 . Numerical method Except where indicated below. h > −1.6). [output.IFAIL) Formal parameters XMOM PARA IFAIL [input. the shape parameter k is estimated from rational-function approximations given by Donaldson (1996). k + 0. double-precision array of length equal to the number of parameters of the distribution] The parameters of the distribution. the parameter space is restricted as in Hosking (1994. To ensure a 1-1 relationship between parameters and L-moments. Donaldson’s approximation is further refined by Newton-Raphson iteration until similar accuracy is achieved. the shape parameter of the gamma distribution. [input.Parameters SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE SUBROUTINE PELEXP(XMOM. Newton-Raphson iteration is used to solve the equations that express τ3 and τ4 as functions of k and h. eq. For explanation see “Numerical method” below... τ3 . This approximation has absolute accuracy better than 3 × 10−7 .PARA) PELGPA(XMOM. integer] Used only by routines PELKAP and PELWAK. Parameters α and ξ are then calculated as in Hosking and Wallis (1997.PARA) PELGEV(XMOM. and α and ξ are calculated as functions of λ1 .PARA) PELPE3(XMOM.8. If this too is unsuccessful. On exit. (2. Newton-Raphson iteration did not converge. 11 . all five parameters estimated. parameter IFAIL is set as follows. as functions of the first five L-moments. or |τr | ≥ 1 for some r ≥ 3. Newton-Raphson iteration reached a point from which no further progress could be made. L-moments invalid: λ2 ≤ 0. then a generalized Pareto distribution is fitted instead. 3 4 5 6 PELWAK The basic method is that of Landwehr et al. the quantiles of the fitted distribution are usually still reliable to within an error equivalent to a perturbation of less than 10−6 in the argument of the quantile function. however. or σ ) has relative error approximately . The computations are given by Hosking and Wallis (1997. Accuracy For shape parameters. let = 10−8 . Iteration for h and k converged. 2 )/6. In such cases. but the distribution is differently parametrized and the calculations are expressed in terms of L-moments rather than probability weighted moments. PELGAM and PELPE3 have relative accuracy better than 5 × 10−5 . (1979b). routines PELGLO and PELGPA are accurate to at least 8 decimal places. For any of these routines. First a solution is sought in which all five parameters are estimated. Newton-Raphson iteration encountered numerical difficulties: overflow would have been likely to occur. parameter IFAIL is set as follows. 0 1 2 Successful exit. PELGEV is accurate to within 3 × 10−7 . Routine PELWAK is usually accurate to within 10−6 . L-moments invalid: λ2 ≤ 0. but overflow would have occurred while calculating ξ and α. 0 1 2 3 Successful exit. using the first three L-moments and the same method as routine PELGPA. Solution could only be found by setting ξ = 0. for routines PELGUM and PELNOR. If no solution is found. then the estimate of the scale parameter α (or β . let be the relative error of estimation of the shape parameter. or τ3 and τ4 do not lie within the set of feasible values given in Hosking and Wallis (1997. and the estimate of the location parameter ξ has absolute error approximately α. ξ is set equal to zero and a solution is sought in which the other four parameters are estimated as functions of the first four L-moments. Solution could only be found by fitting a generalized Pareto distribution. Appendix A.On exit.45)).5 × 10−6 . but can be much less accurate for certain combinations of input parameters. PELKAP is accurate to within 5 × 10−6 .11). This implies that the L-moments Routine was called with τ4 ≥ (1 + 5τ3 are inconsistent with a kappa distribution with parameters restricted as above. eq. PELGNO has relative accuracy better than 2. SUBROUTINE SAMLMR SUBROUTINE SAMLMU SUBROUTINE SAMPWM Calculates the sample L-moment ratios of a data set. Calculates the sample probability weighted moments of a data set. 12 .Routines for computing sample L-moments Three routines are provided for computing sample L-moments and probability weighted moments of a data sample. Calculates the “unbiased” sample L-moment ratios of a data set by a more direct method. indirectly via the probability weighted moments. B) Purpose Calculates the sample L-moment ratios of a data set. Otherwise plotting-position estimates are found. integer] The number of L-moments to be found. [output. (1985) for use with the generalized extreme-value distribution.SUBROUTINE SAMLMR(X. 2 .N. t4 . double-precision array of length NMOM] The sample L-moment ratios. [input. 13 . At most min(N. integer] Sample size.35D0 and B=0. .0D0 yields the estimates recommended by Hosking et al. double precision] Parameters of plotting position. in ascending order. Formal parameters X N XMOM NMOM A. For example. “unbiased” estimates of L-moments are found. A=-0. double-precision array of length N] The data. and from them the sample L-moments using (3) or (5).A..B [input. t3 . [input. based on the plotting position pj :n = (j + A)/(n + B) for the j th smallest of n observations. 20). in the order 1 .. .NMOM. If A and B are both set to zero.XMOM. Numerical method The routine explicitly computes probability weighted moments using (2) or (4). [input. whereas SAMLMR achieves similar accuracy for only the first 12 L-moment ratios. . Routine SAMLMU evaluates sample L-moments using this recurrence. n − 1). This routine is generally equivalent to SAMLMR. (r −2) this recurrence relation is equivalent to equation (9) of Neuman and Schonbach (1974). 2 . . double-precision array of length NMOM] The sample L-moment ratios. [output. and. double-precision array of length N] The data. and n r = n− 1 j =1 wj :n xj :n . for r ≥ 3. The routines require approximately the same amount of computing time. (r ) The weights wj :n are related to the “discrete Legendre polynomials” defined by Neuman and Schonbach (1974).XMOM. At most min(N. (r − 1)(n − r + 1)wj :n = (2r − 3)(2j − n − 1)wj :n (r ) (r −1) (2) (1) (r ) (r ) − (r − 2)(n + r − 2)wj :n . integer] The number of L-moments to be found. Numerical method From (2) and (3). The weights can be computed as wj :n = 1. wj :n = (−1)r−1 wn+1−j :n .. xn:n . in the order 1 . In Neuman and Schonbach’s notation. . .N. wj :n = 2(j − 1)/(n − 1) − 1. . and achieves additional (r ) (r ) efficiency by making use of the symmetry in the weights. t3 . t4 . but is particularly suitable when highorder L-moment ratios are to be calculated. integer] Sample size. [input. 100). but SAMLMU can be a little slower than SAMLMR when NMOM is large or odd. the weight wj :n is the discrete Legendre polynomial (−1)r Pr−1 (j − 1.NMOM) Purpose Calculates the “unbiased” sample L-moment ratios of a data set.. 14 . Routine SAMLMU is accurate to 8 decimal places for about the first 50 L-moment ratios. we can write r is a linear combination of the ordered sample values x1:n . in ascending order. .SUBROUTINE SAMLMU(X. [input. Formal parameters X N XMOM NMOM [input. B [input. or (if KIND=2) b0 . If KIND=2. double-precision array of length N] The data. . a1 . double precision] Parameters of plotting position. KIND 15 .NMOM. At most min(N. Formal parameters X N XMOM NMOM A.A. . [input. integer] Indicates the kind of probability weighted moments to be found. [input. (1985) for use with the generalized extreme-value distribution. [input. unbiased estimates of probability weighted moments are found.B.XMOM. in ascending order.. 20).KIND) Purpose Calculates the sample probability weighted moments of a data set. the routine estimates the probability weighted moments αr = E [X {1 − F (X )}r ].. double-precision array of length NMOM] The sample probability weighted moments.. . integer] Sample size.. in the order (if KIND=1) a0 . [input.SUBROUTINE SAMPWM(X. If KIND=1.. Otherwise plotting-position estimates are found.35D0 and B=0. b1 .N. based on the plotting position pj :n = (j + A)/(n + B) for the j th smallest of n observations. [output. If A and B are both set to zero. the routine estimates the probability weighted moments βr = E [X {F (X )}r ]. integer] The number of probability weighted moments to be found.0D0 yields the estimates recommended by Hosking et al. A=-0. For example. The statistics are described in more detail by Hosking and Wallis (1997. Calculates regional weighted averages of L-moment ratios. and do not explicitly involve L-moments. Three routines provide facilities for cluster analysis. and Ward’s procedure. • Goodness-of-fit measures. chaps. Performs cluster analysis by the K -means algorithm. Program to illustrate the use of routine REGTST. based on the regional average L-moment ratios. • Heterogeneity measures for a region. SUBROUTINE CLUAGG SUBROUTINE CLUINF SUBROUTINE CLUKM SUBROUTINE REGLMR SUBROUTINE REGTST Performs cluster analysis by one of several agglomerative hierarchical methods: single-link. Program to illustrate the use of routine REGLMR. PROGRAM XTEST PROGRAM XSIM 16 . The statistics are based on the at-site and regional average sample L-moments. These are intended to assess whether the sample L-moments at a site are markedly different from the regional average. PROGRAM XCLUST PROGRAM XFIT Program to illustrate the use of the cluster analysis routines. Program to illustrate the use of simulation to find the accuracy of estimates obtained from regional frequency analysis. • Discordancy measures for individual sites in a region. which combines the L-moments of data samples from different measuring sites to achieve improved estimates of the frequency distribution at each site. Calculates statistics useful in regional frequency analysis. Four driver programs are also provided: these illustrate the use of the regional frequency analysis routines by applying them to data sets used by Hosking and Wallis (1997).Routines for regional frequency analysis These routines implement the methods described by Hosking and Wallis (1997) for regional frequency analysis. The program performs frequency analysis of a regional data set using an index-flood procedure and the method of L-moments. Two routines implement the estimation and testing methods from Hosking and Wallis (1997. chaps. 3–6). complete-link. Obtains information about clusters arising from agglomerative hierarchical clustering. These are intended to assess whether the between-site variation in the sample L-moments is consistent with what would be expected of a homogeneous region. These are intended to assess whether any of five candidate distributions gives an adequate fit to the data. 3–5). Dispersion is defined differently for each method: see below. labeled 1 through N in the same order as the data points. [input.NX.I) are the labels of the clusters merged at the Ith stage. integer] Number of data points. After the Mth stage of clustering there are N − M clusters.N)] MERGE(1. integer] The first dimension of array X. [output.I) and MERGE(2. double-precision array of length NW] Work array. there are initially N clusters.X.WORK. double-precision array of length N] DISP(I) is a measure of the withincluster dispersion after the Ith merge. [input. complete-link.DISP. [local. Formal parameters METHOD X NX N NATT MERGE [input. 2 for complete-link clustering. The square of this distance is saved in the corresponding element of array DISP.SUBROUTINE CLUAGG(METHOD. Different methods correspond to different criteria for which clusters should be merged at each stage. DISP(N) is not used.N. use routine CLUINF.J) should contain the Jth attribute for the Ith data point. [local.NATT. 3 for Ward’s procedure. At each stage of clustering. Should be set to 1 for single-link clustering. Must be at least N*(N-1)/2. MERGE(1.N) and MERGE(2. [input. At each stage.N) are not used. [output.MERGE. integer array of dimension (2. Their labels are saved in the MERGE array.NW) Purpose Performs cluster analysis by one of several agglomerative hierarchical methods: single-link. integer] Length of array WORK. • Single-link clustering: the distance between two clusters A and B is defined to be the minimum of the Euclidean distances between pairs of points with one point in A and one in B . The smaller of the two labels is used as the label of the merged cluster. DISP IWORK WORK NW Method In agglomerative hierarchical clustering. integer] Defines which clustering method is used. The following methods are implemented. integer] Number of attributes for each data point. integer array of length N] Work array. two clusters are merged. [input. To find which data points belong to which clusters. double-precision array of dimension (NX. 17 .IWORK. as declared in the calling program.NATT)] X(I. [input. and Ward’s procedure. the two clusters separated by the smallest distance are merged. each containing one data point. 18 . DISP(I) is therefore the largest squared Euclidean distance between two points that are in the same cluster after the Ith merge. more efficient clustering programs may be preferred. This routine makes no claim to efficiency in either computing time or storage requirements. for Ward’s procedure. For large problems.. It is computationally practical for small and moderate-sized problems.edu/multi/hcon2. the hcon2 program of Murtagh (1985).g.• Complete-link clustering: the distance between two clusters A and B is defined to be the maximum of the Euclidean distances between pairs of points with one point in A and one in B . e. The square of this distance is saved in the corresponding element of array DISP.cmu. the two clusters separated by the smallest distance are merged. available from StatLib at http://lib. This sum of squares is saved in the corresponding element of array DISP.stat. At each stage. • Ward’s method: at each stage. the clusters that are merged are chosen to minimize the total within-cluster sum of squared deviations of each attribute about the cluster mean. N. and should be left unchanged after exit from that routine.SUBROUTINE CLUINF(NCLUST. This routine uses this list to construct arrays that explicitly show which cluster a given data point belongs to. but are uniquely defined: cluster 1 contains data point 1. 5. [input. Formal parameters NCLUST N MERGE [input.I) and MERGE(2. integer] Number of data points. [input. 2. IASSGN LIST NUM Cluster numbers used in arrays IASSGN. 3. [output. integer array of dimension (2. and which data points belong to a given cluster. [output. integer] Number of clusters. –8.MERGE. [output. cluster 2 contains points 3. 5 and 7. LIST and NUM range from 1 to NCLUST. where J=MERGE(2.NUM) Purpose Obtains information about clusters arising from agglomerative hierarchical clustering. Then the clusters are as follows: cluster 1 contains points 1 and 4. followed by the data points in cluster 2.LIST. cluster M (M ≥ 2) contains data point J. integer array of length N] Its Ith element is the number of the cluster to which the Ith data point belongs. –7. See the example below. –4. The last data point in each cluster is indicated by a negative number. 6. 19 .IASSGN. integer array of length NCLUST] Contains the number of data points in each cluster. etc. They are arbitrary. Data points in each cluster are listed in increasing order.N)] MERGE(1. and that the elements of the LIST array are 1. Suppose that there are 8 data points and 3 clusters. integer array of length N] Contains the data points in cluster 1. Example of the LIST array. 6 and 8. This is the array MERGE returned by routine CLUAGG. Agglomerative hierarchical clustering procedures typically produce a list of the clusters merged at each stage of the clustering. cluster 3 contains points 2.I) identify the clusters merged at the Ith step.N-M). NX. [local. integer] The first dimension of array X.SS. integer] Length of array RW. [input. LIST NUM SS MAXIT IWORK RW NW Method This routine is a front end to Applied Statistics Algorithm AS136 (Hartigan and Wong. a local optimum is sought such that no movement of a point from one cluster to another will reduce the within-cluster sum of squares.NATT. Must be at least (N+NCLUST)*(NATT+1)+2*NCLUST.NW) Purpose Performs cluster analysis by the K -means algorithm. [local. [input and output. it is not practical to require that the sum of squares is minimized over all possible partitions. [input.LIST. [input.SUBROUTINE CLUKM(X. [input. integer] Maximum number of iterations for the K -means algorithm. integer] Number of attributes for each data point. integer array of length N] On entry. [output. should contain the initial assignment of sites to clusters.IASSGN. [output. integer array of length NCLUST] Contains the number of data points in each cluster. 20 . Labels must be between 1 and NCLUST.MAXIT. but is available from StatLib at http://stat. integer] Number of clusters. [output.N. [input. integer array of length N] Contains the data points in cluster 1. real array of length NW] Work array.J) should contain the Jth attribute for the Ith data point. contains the final assignment. Except for very small data sets. etc.cmu.IWORK. integer] Number of data points.NATT)] X(I. and each of the values 1 through NCLUST must occur at least once. Algorithm AS136 is not included in this package.B. as declared in the calling program. 1979). The Ith element of the array contains the label of the cluster to which the Ith data point belongs. not double precision! [input. double precision] Within-group sum of squares of the final clusters. this array is of type real.RW.NCLUST. Formal parameters X NX N NATT NCLUST IASSGN [input. N. The last data point in each cluster is indicated by a negative number. On exit. Data points in each cluster are listed in increasing order. Instead. integer array of length NCLUST*3] Work array. The aim of the K -means algorithm is to partition a set of points into K clusters so that the within-cluster sum of squared distances from the points to their cluster centers is minimized. double-precision array of dimension (NX. followed by the data points in cluster 2.lib.edu/apstat/136.NUM. integer] The first dimension of array XMOM. Formal parameters NSITE NMOM NXMOM XMOM [input. Hosking and Wallis. 1997. [input. . where t(i) = 2 / 1 is the at-site L-CV. 6. . as in Hosking and Wallis (1997. t3 .. double-precision array of length NMOM] The regional weighted average R R R L-moment ratios R 1 . who set wi to be the record length at site i). t4 . sec. as defined below.NMOM. t4 . t4 . [output. as returned by a previous call to routine SAMLMR. 21 . . as declared in the calling program.. 2 . 6. and are defined by N R 1 N N N i) wi t( r i=1 i=1 (i) (i) (i) (i) = 1. r = 3.NSITE)] XMOM(K. .I) should contain the Kth L-moment ratio for site I.2).NXMOM. (cf. 2 .. as in Hosking and Wallis (1997.. t3 . [input.. tR = i=1 wi t(i) i=1 wi . tR r = wi . double-precision array of length NSITE] WEIGHT(I) should contain the relative weight of site I in the regional weighted average.. double-precision array of dimension (NXMOM. When the data are scaled by dividing by the mean.XMOM. (i) (i) (i) (i) the L-moment ratios become 1. It is recommended that. Let the weight allotted to site i be wi .. L-CV and L-moment ratios are the weighted averages of these at-site values.2).2... 6. WEIGHT RMOM Numerical method Let the number of sites be N and let the L-moment ratios at site i be 1 . [input. 4.WEIGHT. t(i) . sec. integer] The number of sites in the region. . t3 . sec. integer] The number of L-moments to be found. The regional weighted average mean. [input. .SUBROUTINE REGLMR(NSITE. the weights be proportional to the record lengths at each site.RMOM) Purpose Calculates regional weighted averages of L-moment ratios. heterogeneity and goodness-of-fit measures described by Hosking and Wallis (1997. [input. Formal parameters NSITES NAMES LEN XMOM [input.SUBROUTINE REGTST(NSITES. integer] Number of quantiles to be calculated for each distribution that gives a good fit to the data.NAMES.B SEED NSIM NPROB PROB KPRINT KOUT RMOM D VOBS .I) should contain the Kth L-moment ratio for site I.PARA) Purpose Calculates the discordancy. [input. [input. double-precision array of length 3] The observed values of three heterogeneity statistics. double precision] Parameters of plotting position. [input. in the order mean. [input. L-skewness. [output. Note that XMOM(2. double precision] Seed for random number generator. V(1) is the weighted standard deviation of the at-site L-CVs. V(3) is the weighted average distance from a site to the regional average on a graph of L-skewness vs. Should be the same as the values used to calculate the L-moments in the XMOM array. V(2) is the weighted average distance from a site to the regional average on a graph of L-CV vs. chaps. Should be set to zero to suppress printed output. 3–5).LEN.D.B.VSD. [input. [input. L-CV. integer] Number of sites in region. integer] Number of simulated worlds used in calculation of heterogeneity and goodness-of-fit measures. integer] Output flag. integer] Channel to which output is directed. double-precision array of length NSITES] Discordancy measure for each site. KPRINT.VOBS. double-precision array of length 5] Regional weighted average L-moment ratios.H. L-kurtosis. to 1 to produce printed output. not the usual 2! [input..VBAR.PROB.NSITES)] Contains the first 5 sample L-moment ratios for each site.Z. Elements XMOM(1. Should be a whole number in the range 2D0 to 2147483647D0.NSIM.) should contain L-CV. the routine will calculate only the discordancy measures. [input.SEED.KOUT. t5 . [input. [output. t3 . double-precision array of length NPROB] Probabilities for which quantiles are to be calculated. XMOM(K.. double-precision array of dimension (5.RMOM.NPROB. If NSIM is set to zero. CHARACTER*12 array of length NSITES] Site names. 22 A. t4 . double-precision array of length NSITES] Record lengths at each site.XMOM.A.) are not used by the routine. [output. 6)] Parameters of regional distributions fitted by the above five distributions. (3.7).5) but using V2 and V3 in place of V . double-precision array of dimension (5. (4. (4.VBAR VSD H Z [output. (5. PARA(I. (2) generalized extreme-value. [output. (3) generalized Normal (lognormal). plus (6) Wakeby.4). double-precision array of length 3] Heterogeneity measures for the region: H(J)=(VOBS(J)-VBAR(J))/VSD(J).J) contains the Ith parameter of the Jth distribution. 23 . heterogeneity statistic V(1) is V in eq. Computed quantities are as defined in the following equations in Hosking and Wallis (1997): discordancy measures are the Di in eq. heterogeneity measures H(2) and H(3) are computed analogously to H in eq. (4. (4) Pearson type III (3-parameter gamma). heterogeneity statistics V(2) and V(3) are V2 and V3 in eqs. [output. 3–5). (4. double-precision array of length 3] The standard deviations of the NSIM simulated values of the V statistics.5).6) and (4. [output.6). goodness-of-fit measures are Z DIST in eq. chaps. double-precision array of length 5] Goodness-of-fit measures for five distributions: (1) generalized logistic. double-precision array of length 3] The means of the NSIM simulated values of the V statistics. heterogeneity measure H(1) is H in eq. [output.3). and (5) generalized Pareto. PARA Numerical method The routine straightforwardly carries out the calculations described in the “Formal definition” subsections of Hosking and Wallis (1997. The cluster numbers in the output file are not those used by Hosking and Wallis (1997). Clusters are formed by Ward’s method.OUT respectively. information about these clusters is printed using routine CLUINF. all in the south-east of the U. and are taken from Simiu et al. and. Nonlinear transformations are applied to two of the attributes: a logarithmic transformation to drainage basin area and a square root transformation to gage elevation. An example data set and the results obtained by applying PROGRAM XCLUST to it are given in the files APPALACH. The clusters obtained by Ward’s method are adjusted using the K -means procedure (routine CLUKM). and close to the coast. An example data set and the results obtained by applying PROGRAM XFIT to it are given in files MAXWIND.S. (1979). All four attributes are then standardized by dividing by the standard deviation of their values at the 104 sites. 1993). PROGRAM XFIT Purpose This program is an example of how routine REGLMR and others can be used to perform frequency analysis on a regional data set using an index-flood procedure that fits a regional distribution using the method of L-moments. give a better correspondence between differences in site characteristics and the degree of hydrologic dissimilarity between different basins. gage latitude and gage longitude. were judged to constitute a homogeneous region suitable for the application of an index-flood procedure (Wallis. gage elevation. reducing the likelihood that a few sites will have site characteristics so far from the other sites that they will always be assigned to a cluster by themselves.2). The attributes for each site are drainage basin area.2). It should be easy to change the program to fit other distributions. Hosking and Wallis (1997) judged that seven clusters is an appropriate number.DAT and APPALACH. sec. The program fits a Wakeby distribution to the regional L-moments using the regional L-moment algorithm described by Hosking and Wallis (1997. who renumbered the clusters according to the average drainage area of the sites in each cluster. sec. These transformations give a more symmetric distribution of the values of the site characteristics at the 104 sites. These 12 sites. using routine CLUAGG.S.PROGRAM XCLUST Purpose This program illustrates the use of the cluster analysis routines. 9. The data are site characteristics for 104 streamflow gaging stations in central Appalachia. This yields clusters that are a little more compact in the space of transformed site characteristics. the drainage basin area variable is multiplied by 3 to give it an importance in the clustering procedure equal to that of the other variables together. Finally.DAT and MAXWIND. 6. in Hosking and Wallis’s judgement. 24 . The transformation and weighting of the variables involves subjective decisions whose ultimate justification is the physical plausibility of the regions that are ultimately obtained from the clustering procedure. This cluster analysis is described in Hosking and Wallis (1997.. The data are annual maximum wind speeds at 12 sites in the U.OUT respectively. The data are annual precipitations at 19 sites in the northwest U.0279. p.OUT respectively.64. and omitting the section between dashed lines near the end of the program. An example data set and the results obtained by applying PROGRAM XTEST to it are given in files CASCADES. 6.0978 at site 1 to 0.08” in Hosking and Wallis (1997.. 6. The regional average relative RMSE of the estimated growth curve is calculated from the simulations. The program implements the algorithm in Table 6. as discussed by Hosking and Wallis (1997. The region is set up as in Hosking and Wallis (1997. 10. These results are contained in the output from PROGRAM XSIM. sec. p. sec. 1997.19)).. 90% error bounds for the growth curve are computed as in Hosking and Wallis (1997. PROGRAM XSIM can also be used to find the average value taken by heterogeneity measures over different simulations of a given region.1 of Hosking and Wallis (1997.OUT. The intersite correlation is 0. The data set is given in Hosking and Wallis (1997. Table 3.PROGRAM XTEST Purpose This program is an example of the use of routine REGTST.OUT indicate that the region is acceptably close to homogeneous and can be well described by a lognormal or Pearson type III distribution.2) is used to fit a lognormal distribution to the data generated at each realization. 6. The results in CASCADES. The program reads a file of atsite sample L-moments for one or more regions and calls routine REGTST to calculate test statistics for the regions. and quantiles of the distribution of the regional average of the ratio of the estimated to the true at-site growth curve are computed from a histogram accumulated during the simulations.4). and each site has L-skewness τ3 = 0.S. eq. 25 . The region contains 19 sites with record lengths as for the North Cascades data. 3–6). eq. File XSIMH. PROGRAM XSIM Purpose This program illustrates the use of Monte Carlo simulation to derive the properties of estimated quantiles in regional frequency analysis.4) and used in the “Example” sections of Hosking and Wallis (1997. This is useful when assessing the accuracy of estimated quantiles in regional frequency analysis. the “North Cascades” region of Plantico et al.DAT and CASCADES. with inter-site correlation matrix taking the form of equal correlation between each pair of sites (Hosking and Wallis. The first of the AVERAGE HETEROGENEITY MEASURES in this output is the source of the statement “the average H value of simulated regions is 1. sec. The sites have lognormal frequency distributions with L-CV varying linearly from 0. (6. which is file XSIM. chaps.11)). and KPRINT=1.1228 at site 19. (6. NSIM=500. 1990).5). From these quantiles. 000 realizations of this region are made and the regional L-moment algorithm described by Hosking and Wallis (1997. the average intersite correlation for the North Cascades sites.OUT contains the output from running PROGRAM XSIM with parameter values DSEED=619145091D0. 95). Data were obtained from the Historical Climatology Network (Karl et al. 98). NREP=100. (1990). The numerical method is the same as that of Algorithm 5666 of Hart et al. It should be left unchanged between successive calls to the routine. 1988). double precision. 26 . of length N. The double-precision variable SEED is the seed for the random-number generator. with pseudo-random numbers uniformly distributed on the interval (0. 1988). Version 4. The three arguments of the routine are x. double precision. For example. Euler’s psi function. 1976). but on most computers it is more efficient to replace routine DURAND by a routine programmed in assembly language. α)—Hill’s approximation (Johnson et al. α) = {Γ(α)}−1 0 x tα−1 e−t dt .. except that a different approximation to G(x. double precision. 1966). FUNCTION DLGAMA SUBROUTINE DURAND(SEED.N. into ascending order. FUNCTION QUASTN Quantile function of standard Normal distribution. This routine is supplied for completeness and portability. (1968). (1969). The numerical method is the same as that of Algorithm AS239 (Shea. It should be initialized to an integer value between 2 and 2147483647 (231 − 1). of length N. double precision. 1994. double precision. (18. The function is defined to be G(x. FUNCTION GAMIND(X. ψ (x) = d{log Γ(x)}/dx. contains a routine.2. also called DURAND.N) Sorts the double-precision array X.G) Incomplete gamma integral. Natural logarithm of the gamma function. should be avoided.X) Fills the double-precision array X.Auxiliary routines FUNCTION DERF FUNCTION DIGAMD Error function. The routine uses the algorithm of Lewis et al. The numerical method is the same as that of Algorithm AS103 (Bernardo. The numerical method is the same as that of Algorithm AS241 (Wichura. SUBROUTINE SORT(X. though small values. The numerical method is the same as that of Algorithm ACM291 (Pike and Hill.A. less than 200000 say. the Engineering and Scientific Subroutine Library for AIX.35))—is used for large α. eq. on an IBM RS6000 44P model 170 workstation. α and log{Γ(α)}. 1). which has an identical specification to the one described here and is about 7 times as fast. MAXWIND. and the at-site sample L-moments 1 . Geological Survey’s WATSTORE data files.OUT 27 .S. which reproduce data from the U.Data files APPALACH. Sample L-skewness. Table 3.OUT MAXWIND. Sample L-kurtosis. The data in these columns. Example data set: L-moments of annual precipitation at 19 sites in the northwest U. t4 . NSIM=500. Drainage basin area. NREP=100.1) to identify the sites. area and elev are used by PROGRAM XCLUST. The columns in the table are the site identifier used by the Historical Climatology Network.DAT. t3 . t. a unique identifier. Output when PROGRAM XFIT is applied to the data in MAXWIND. t5 . in feet. long. and the streamflow data used to compute the sample L-moments.OUT XSIMH. 1 . siteid lat long area elev n l1 t t3 t4 t5 The site’s Hydrologic Unit Code. and other modifications as described on page 25.DAT Example data set: data for 104 streamflow gaging stations in central Appalachia. t5 .4. The columns of data are as follows.DAT. from Simiu et al. Sample mean.DAT Output when PROGRAM XCLUST is applied to the data in APPALACH.DAT CASCADES. Gage elevation. 1993). t4 . in degrees west of the Greenwich meridian. Sample size. were obtained from “Hydrodata” CD-ROMs (Hydrosphere. Output from PROGRAM XSIM with parameters DSEED=619145091D0.DAT. Example data set: annual maximum wind speeds at 12 sites in the southeast U. L-CV. (1979. Sample L-CV.OUT XSIM. Gage longitude. (1979). in degrees. Gage latitude. APPALACH. t3 . the record length. Sample 5th L-moment ratio. Only the four columns lat.S. Output from PROGRAM XSIM. Output when PROGRAM XTEST is applied to the data in CASCADES..OUT CASCADES. Numbers in parentheses are those used by Simiu et al. in square miles.S. PELKAP calls DLGAMA. QUASTN. 28 . LMRGEV calls DLGAMA.Links between routines The following functions and subroutines call other routines. LMRPE3 calls DLGAMA. QUAPE3 calls DERF. CDFPE3 calls DERF. QUAGNO calls QUASTN. QUAGAM calls DERF. DLGAMA. CDFNOR calls DERF. GAMIND. DLGAMA. QUANOR calls QUASTN. DLGAMA. REGTST calls most of the PELxxx. QUASTN. DIGAMD. PELPE3 calls DLGAMA. QUAxxx and auxiliary routines. LMRGNO calls DERF. LMRKAP calls DLGAMA. QUAGAM. PELGNO calls DERF. DLGAMA. CLUKM calls routines KMNS. GAMIND calls DERF. OPTRA and QTRAN from Hartigan and Wong (1979). LMRGAM calls DLGAMA. GAMIND. GAMIND. PELGAM calls DLGAMA. CDFGNO calls DERF. GAMIND. PELGEV calls DLGAMA. CDFGAM calls DERF. DIGAMD. CDFWAK calls QUAWAK. where d is the number of decimal digits in a double-precision constant. GAMIND). QUAGAM. CDFGNO. The value 10d/2 . constants EPS and MAXIT control the test for convergence of the iterations. The values assigned to these constants in the listings of the routines are appropriate for an IBM 390 computer using the FORTVS2 compiler. A number x such that the operation ex just does not cause underflow. CDFKAP] Should be as small as possible. LMRGNO. A number x such that the operation ex just does not cause underflow. In routines that use iterative methods (CDFWAK. A number x such that the operation ex just does not cause overflow. Routine Constant CDFxxx SMALL [used by routines CDFGEV. CDFGLO. PELGEV. The list below explains how the values of these constants should be chosen. A number x such that 1 log Γ(x) = (x − 2 ) log x − x + 1 2 log(2π ) CDFWAK LMRKAP PELKAP PELKAP QUAWAK DERF DLGAMA UFL OFL OFLEXP OFLGAM UFL X1 BIG to machine precision. A number x such that the operation Γ(x) just does not cause overflow. 29 . If an iterative procedure fails frequently. DLGAMA GAMIND TOOBIG UFL A number x such that the operation x2 just does not cause overflow. CDFGPA. so long as underflow or overflow conditions do not occur. PELKAP. A number x just large enough that erf x = 1 to machine accuracy. should be adequate. for which double-precision constants have precision of approximately 15 decimal digits and maximum magnitude approximately 1075 .Machine dependence Some constants initialized in data statements in some of the routines may need to be changed to give good results on different machines. it may be helpful to change the values of these constants. A number x such that the operation ex just does not cause overflow. A number x such that the operation ex just does not cause underflow. Minor changes to comments.Change history Initial release (July 1988) Routines: CDFGEV. LMRWAK. CDFPE3. SAMPWM. QUAEXP. LMRGUM. Minor bug fix. QUANOR. Removed initialization of an unused variable. CLUKM. QUAGPA. LMRKAP. LMREXP. QUAWAK. 30 XFIT XTEST DERF DLGAMA DURAND . ERFD. ERFD (by DERF). CDFGUM. PELGAM. PELWAK.95). QUAGEV. CDFGNO. CDFNOR. CDFWAK. Routine QUASTN no longer required. CDFGLO. REGTST. LMRGNO. CDFKAP. Iterative procedure modified to reduce the (already small) chance that it will fail to converge. SAMLMU. XSIM. In consequence. PELGUM. XTEST. LMRGLO. Minor changes to comments. QUASTN. GAMIND. LMRWAK. SAMXMP (by XTEST). QUAPE3. QUAGUM. PELKAP. DLGAMA. SAMLMR. LMRGPA. LMRGPA. SAMREG (by REGLMR). Placement of IMPLICIT statement corrected: this can cause minor changes in the simulation results returned by the routine. Minor bugs and inconsistencies removed. Version 2 (August 1991) Routines added: CDFGAM. PELNOR. PELPE3. Modified to reduce the chance of numeric overflow. QUAGAM. PELGPA. Version 3 (August 1996) Routines added: CDFEXP. Removed initialization of an unused variable. Routines modified: all except CDFGUM. Minor changes to comments. Minor bug fixes. Routines modified: CDFGUM CDFWAK LMRKAP PELGEV PELGNO PELKAP REGTST Removed initialization of an unused variable. PELGLO. LMRGEV. SAMXMP. SORT. PELGEV. Corrected error when argument of function was exactly zero. LMRNOR. XFIT. two new values of the IFAIL parameter are possible. Changed critical values for discordancy measure. SAMREG. CDFGPA. QUAGNO. Routines replaced: ALGAMD (by DLGAMA). CLUAGG. PELGNO. LMRPE3. Returns α = −1 if τ3 is too large (|τ3 | ≥ 0. QUAGLO. DERF. More accurate numerical approximation. Minor bug fixes. Speed increased. LMRGAM. QUAKAP. Simpler and more accurate numerical approximation. Minor bug fix. CLUINF. DIGAMD. XCLUST. Order in which output is printed was changed: table of parameters now printed before table of quantiles. PELEXP. ALGAMD. REGLMR. Minor changes to comments.7000) statement to be consistent with FORMAT statement 7000.Version 3. Added validity check for parameters. Removed declarations of unused variables. as a consequence of the change to PROGRAM XCLUST made at Version 3.01 (December 1996) Routines modified: XSIM Replaced call to nonexistent function CDFSTN by call to DERF. Print flagged values of discordancy measure even when there is only one.03 (June 2000) Routines modified: REGTST XTEST XSIM QUASTN CHARACTER variable declarations changed to conform to Fortran-77 standard. Minor change to FORMAT statement 6080. in consequence of the changes to XCLUST and XSIM. Set XMOM(1) to sample mean.02 (March 1997) Routines modified: CLUAGG CLUINF XCLUST XSIM Implemented single-link and complete-link clustering. Changed WRITE(6.04 (July 2005) Routines modified: PELWAK SAMLMU REGTST XCLUST XSIM Minor bug fix in test for validity of L-moments. when all data values are equal. Version 3.02. Version 3. CHARACTER variable declarations changed to conform to Fortran-77 standard. The file APPALACH. not zero.OUT was also changed. The file XSIM. RETURN statements replaced by STOP. Removed declarations of unused variables. Version 3. Changed random number seed. 31 .OUT was also changed. Landwehr. Hosking. J. C. M. 28. England: Cambridge University Press. Encyclopedia of statistical sciences.. L-moments: analysis and estimation of distributions using linear combinations of order statistics. and Read. J.. 100–108.. R. Wallis. Technometrics. et al. 3. New York: Wiley. R. C. (1997). (eds. F. J. R. and Wood. Hosking. J. (1985). Hart. Water Resources Research. and Wallis. Carbon Dioxide Information Analysis Center. Handbook of applicable mathematics. Probability weighted moments: definition and relation to parameters of several distributions expressable in inverse form. R. (1976). Water Resources Research.. New York: Wiley. E. and Wallis. 15. Oak Ridge National Laboratory. N. New York: Wiley. M. Churchhouse. Williams. T.References Bernardo. ORNL/CDIAC-30 NDP-019/R1. Matalas.. 27. 31. J. Estimation of the generalized extreme-value distribution by the method of probability-weighted moments. Parameter and quantile estimation for the generalized Pareto distribution. (1994). 1191–1198.. (1979a). and Wallis. J. Hosking. R. Johnson. (1994).. extreme-value. vol. 38. New York: Wiley. Boulder.) (1981). A. M. 1. (1987). Donaldson. T. 1049–1054. J. (ed. and Wong.. R. J. J.. Communications in Statistics— Simulation and Computation. 105–124. J. T. Colo. N. Applied Statistics. Algorithm AS 103: psi (digamma) function.. W. Regional frequency analysis: an approach based on L-moments. vol. log-normal. Continuous univariate distributions. and log-logistic distributions. 741–747. Water Resources Research. Tenn. 32 . 251–261. R. N. skew and PWM functions for Pearson-3.. M. R. Matalas. M. S. Hydrodata CD-ROMs. M. Series B. (1979). N. Computer approximations. A. Hosking.. Technometrics. Kotz. L. 2nd edn. (1996). Hydrosphere Data Products. (1990). Cambridge. M. 4. R. United States historical climatology network (HCN) serial temperature and precipitation data. J.. IBM Journal of Research and Development. 315–317. B. 52. R. Johnson. vol. M. J. M. 29. J. Numerical methods. Huh. R. (1986). 9. Hartigan. Karl.) (1988). Kotz. (1995). 2019–2025. and Wallis. Hosking.0: USGS peak values. A.. R. C. and Wallis. M. (1979).. L. Computation of percentage points. Communications in Statistics—Simulation and Computation. S. and Balakrishnan. Applied Statistics. J. N. J. Y. J. A comparison of unbiased and plottingposition estimators of L-moments. (1990). Hosking. A. Calculating inverse CV. C. and Boden. Probability weighted moments compared with some traditional techniques in estimating Gumbel parameters and quantiles. F. J. F. Algorithm AS 136: A K -means clustering algorithm. (1968). Hydrosphere (1993). 339–349.. Landwehr.. 25. M.. J. F. 251–258. R. 25. 15. Greenwood. vol.. The four-parameter kappa distribution. R. Oak Ridge. 1055–1064. Quinlan. N. Journal of the Royal Statistical Society. 15. R. Wallis.... F. Murtagh. (1979). N. I. Algorithm AS 239: chi-squared and incomplete gamma integral.. Applied Statistics. Multidimensional clustering algorithms. 466–473. P. Washington. 15. (1985). (1979b). (1974). Communications of the Association for Computing Machinery. Correction: Water Resources Research. E. and Gavin.: Pergamon. Berlin: Springer. 9. 33 . Shea. Matalas. IBM Systems Journal. (1988). S. Oxford. J. Neuman. 16617–16637. B. Applied Statistics. Extreme wind speeds at 129 stations in the contiguous United States. 8. 743–770. Algorithm 291: logarithm of the gamma function. R. R. Discrete (Legendre) orthogonal polynomials: a survey. National Bureau of Standards. C. J. Water Resources Research. 684. J. E. R. 15 (1979).K. A. U. J. Is recent climate change across the United States related to rising levels of anthropogenic greenhouse gases? Journal of Geophysical Research. C. and Filliben. Lewis. L.. 1672. P. D. (1993). International Journal for Numerical Methods in Engineering. 37. (1966). J. M. and Hill. 1361–1379. M. 8. A pseudorandom number generator for the System/360. Wichura. M.Landwehr. M. J. M. J. 37. 136–146. (1969). Kukla. Regional frequency studies using L-moments.C. Karl. Chanery. J. 477–484... C.. In Concise encyclopedia of environmental systems. and Schonbach. Simiu. Building Science Series 118. and Wallis. ed. C... D. T. G. M. (1990). and Miller. A. Algorithm AS 241: the percentage points of the normal distribution. Pike. 95. I.. Plantico. Estimation of parameters and quantiles of Wakeby distributions. Goodman. 468–476. W. (1988). Young. P. D.
Copyright © 2024 DOKUMEN.SITE Inc.