Statistics is imported by: Pfe0Cmds, Pfe3Metrics.

moduleStatisticswhereimportList(sortBy)importOpTypes(cmpBy)importChar(toUpper)importPrettyPrintimportArrayppStatisticsdescvdescu[]=emptyppStatisticsdescvdescuxs=capdescu<+>"count:"<+>n$$"Total"<+>descv<>":"<+>s$$"Average"<+>descv<+>"per"<+>descu<>":"<+>(s`div`n)$$"Median "<+>descv<+>"per"<+>descu<>":"<+>mediann(mapsndsxs)$$topbottom$$"Histogram:"<+>ppHistogram(mapsndxs)wheren=lengthxss=sum(mapsndxs)sxs=sortBy(cmpBysnd)xsppObs(n,x)=n<>":"<+>xtop=10topbottom=ifn<=2*top+5then"All :"<+>vcat(mapppObssxs)else"Top 10:"<+>vcat(mapppObs.taketop.reverse$sxs)$$"Bottom 10:"<+>vcat(mapppObs.taketop$sxs)cap(c:cs)=toUpperc:cscap[]=[] -- pre: n == length xsmediannxs=ifoddnthenxs!!(n`div` 2)elseletx1:x2:_=drop(n`div` 2-1)xsin(x1+x2) `div` 2ppHistogramxs=vcat(mapbarh)wherebarx="|"<>replicate(x*scale`div`m) '*'<+>(100*x`div`s)<>"%"h=histogramnxsm=maximumhscale=minm50s=sumhn=min10 (maximumxs) -- number of barshistogramnxs=elems$accumArray(+) 0 (0,n-1) [(x*n`div` (m+1),1)|x<-xs]wherem=maximumxs

Index

(HTML for this module was generated on 2006-08-12. About the conversion tool.)