COMPUTATION -- Errors in flow-duration-curve computations 

In Reply Refer To: 
Mail Stop 415                                 July 20, 2000 



OFFICE OF SURFACE WATER TECHNICAL MEMORANDUM NO. 2000.02 

Subject: COMPUTATION -- Errors in flow-duration-curve computations 

This memorandum identifies solutions to two problems recently reported in 
computation of flow-duration curves.   The problems were detected as a 
result of re-computation of monthly flow-duration curves for a 
discontinued gage.  The first problem that was noticed was that, although 
the station had been discontinued, and no new data had been obtained, the 
duration-curve percentiles computed by the Adaps DVSTAT program differed 
from those computed several years before by the Watstore A969 (DVSTAT) 
program.   The differences were small but noticeable and larger than 
seemed reasonable given that there had been no change in the underlying 
data.  It also was noticed that in several duration curves the computed 
percentiles were all equal for several adjacent percentage values (e.g., 
in one case, the 40th, 45th, and 50th percentiles all were equal to 2.0).  
The number of such cases seemed larger than might be expected.  Inspection 
of the computed duration tables (tables of class-limit flow values, class 
counts, and exceedance counts and percentages) and manual interpolation 
confirmed that the computed percentiles were incorrect and, in fact, equal 
to the lower limit of the class interval.  The computed percentiles had 
been used by a cooperator for low-flow permitting, and some of the values 
had been contested.  The Office of Surface Water was asked to investigate. 

The problems were investigated primarily by careful reading of the Fortran 
computer codes for the Watstore and Adaps programs.   The investigation 
showed that the first problem affects duration curves computed by the old 
(now obsolete) Watstore program A969 (DVSTAT); the second affects duration 
curves computed by the current Adaps program DVSTAT.  Both errors affect 
only the interpolated duration-curve percentiles; the computed duration 
tables appear to be correct.  The errors are relatively minor in 
magnitude, and do not seem likely to materially affect the use or 
interpretation of the computed results or to require a general revision of 
published results.  Additional information on the two errors is given 
below so that Districts can decide on a case-by-case basis when 
recomputation or revision is necessary.  The obsolete Watstore program 
will not be corrected.  The error in the Adaps DVSTAT program has been 
corrected as of NWIS release 3_2 Patch 5, released July 2000. 

Both the Watstore A969 and Adaps DVSTAT programs compute the 
duration-curve percentiles by linear interpolation between class limits in 
the duration table, using forms of the following equation: 

      y  =  y0 + ( (p-p0)/(p1-p0) )*(y1-y0) 
         =  y0 + ( (p*N - N0)/(N1-N0) )*(y1-y0) 

in which y and p are the flow and percentage values at the specified 
percentile, N is the total number of observations, and y0, y1, N0, N1, p0, 
and p1 are the flows, exceedance counts, and percentages at the adjacent 
class limits of the duration table.   The first form of the equation is 
recognizable as the standard formula for linear interpolation in the curve 
defined by the flow and percentage values at the class limits.  The second 
form is mathematically equivalent to the first, involving only  
multiplication of all percentages in the numerator and denominator of the 
fraction by the common factor N.   Both errors are the result of incorrect 
use of integer arithmetic in evaluating this formula. 

The Watstore computation used the second form of the equation, involving 
exceedance counts, and incorrectly rounded off the p*N term to the nearest 
integer value.  The resulting error in p*N can be as much as 0.5, which 
results in an error in the interpolated percentile y of 

      delta y  =  (0.5/ni)*(y1-y0) 

where ni (=(N1-N0)) is the number of observations in the class and (y1-y0) 
is the width of the class interval.   If the number of observations in the 
class is very small, the error may be a substantial fraction of the class 
interval width, and if the class interval is wide, the error may be 
noticeable.   In most cases, however, the record lengths, total number of 
daily flows, and standard percentile percentages are such that the number 
of observations in the class will be relatively large and the error 
correspondingly small.  The main exceptions are likely to occur for very 
short records or for monthly duration curves (in which the total number of 
observations is only 1/12 that for an annual curve).   In fact, the 
problem was noted in monthly duration curves for a 13-year record; the 
errors ranged from about 0.2 cfs at about 4 cfs (95 pct exceedance) to 
about 2 cfs at 100 cfs (5 pct exceedance).  For long records and/or annual 
duration curves, the effects of the rounding in N*p should be minor if not 
imperceptible. 

The Adaps DVSTAT program used the first form of the interpolation equation 
but incorrectly truncated the class width (y1-y0) to the next lower 
integer, INT(y1-y0).   Thus, if the class width was less than 1, the lower 
class limit, y0, was returned as the computed value of the interpolated 
percentile.  If the class width was between 1 and 2, the value 1 was used 
in the interpolation, and so on.  The truncated value may be in error by 
as much as 1 unit.  Thus, the interpolated percentile may be in error by 
as much as the class width when the class width is less than 1, by 1/2 
class width when the width is between 1 and 2, by 1/3 class width when the 
width is between 2 and 3, and so on.  The error is relatively small when 
the class width is much greater than 1.  Thus, the error is of most 
significance at the lower tail of the duration curve.  In all cases, the 
erroneous computation yields lower values of the percentage points than 
the correct computation.  Thus, the error seems unlikely to adversely 
affect the reliability of designs and plans based on the computed low-flow 
percentage points.  Nonetheless, it is recommended that any future 
requests for flow-duration percentiles be satisfied by recomputing the 
duration curves using the corrected DVSTAT program. 



                                                 (signed) 

                               Thomas H. Yorke 
                               Chief, Office of Surface Water 

Distribution:  A, B, FO, PO 



Thomas H. Yorke
Chief, Office of Surface Water
U. S. Geological Survey
415 National Center
Reston, VA 20192

Voice: 703-648-5305
Fax: 703-648-5722