math.statistics: minor style cleanup.
parent
f932ca2090
commit
0c5f895371
|
@ -94,7 +94,7 @@ PRIVATE>
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: kth-object ( seq k quot: ( x y -- ? ) -- elt )
|
: kth-object ( seq k quot: ( x y -- ? ) -- elt )
|
||||||
[ [ nth ] [ exchange ] ] dip (kth-object) ; inline
|
[ [ nth ] [ exchange ] ] dip (kth-object) ; inline
|
||||||
|
|
||||||
: kth-objects ( seq kths quot: ( x y -- ? ) -- elts )
|
: kth-objects ( seq kths quot: ( x y -- ? ) -- elts )
|
||||||
[ clone ] 2dip
|
[ clone ] 2dip
|
||||||
|
@ -142,8 +142,7 @@ PRIVATE>
|
||||||
bi kth-smallests first2 ;
|
bi kth-smallests first2 ;
|
||||||
|
|
||||||
: median ( seq -- x )
|
: median ( seq -- x )
|
||||||
dup length odd?
|
dup length odd? [ lower-median ] [ medians + 2 / ] if ;
|
||||||
[ lower-median ] [ medians + 2 / ] if ;
|
|
||||||
|
|
||||||
! quantile can be any n-tile. quartile is n = 4, percentile is n = 100
|
! quantile can be any n-tile. quartile is n = 4, percentile is n = 100
|
||||||
! a,b,c,d parameters, N - number of samples, q is quantile (1/2 for median, 1/4 for 1st quartile)
|
! a,b,c,d parameters, N - number of samples, q is quantile (1/2 for median, 1/4 for 1st quartile)
|
||||||
|
|
Loading…
Reference in New Issue