> > : Does anyone have an algorithm (computer code) for calculating percentiles.
> >
I found a description of such an algorithm in
http://wwwdmorll.er.usgs.gov/nwis_doc/qw/qwgraph.html
and implemented it in QBasic.
Regards,
kh
DIM a(1000)
FOR i = 1 TO 11: a(i) = i: n = i: NEXT: 'an example of array (must be
sorted!)
' "n" is the number of items in the array
INPUT "calculate percentile ", p
' ****** here is the routine calculating percentiles
k = (p * (n + 1)) / 100
WholeNumber = k - FIX(k): 'should be zero if k is an integer
IF WholeNumber = 0 THEN
answer = k
ELSE
k1 = FIX(k)
answer = (a(k1) + (k - k1)) * ((a(k1 + 1) - a(k1)))
END IF
PRINT "answer="; answer
PRINT
END
=================================================================
Instructions for joining and leaving this list and remarks about
the problem of INAPPROPRIATE MESSAGES are available at
http://jse.stat.ncsu.edu/
=================================================================