diff --git a/basis/math/statistics/statistics-docs.factor b/basis/math/statistics/statistics-docs.factor index a4cb761c31..8f953c2bf3 100644 --- a/basis/math/statistics/statistics-docs.factor +++ b/basis/math/statistics/statistics-docs.factor @@ -294,7 +294,7 @@ ARTICLE: "math.statistics" "Statistics" ABOUT: "math.statistics" -{ var population-var sample-var } related-words -{ std population-std sample-std } related-words -{ ste population-ste sample-ste } related-words -{ corr population-corr sample-corr } related-words +{ var var-ddof population-var sample-var } related-words +{ std std-ddof population-std sample-std } related-words +{ ste ste-ddof population-ste sample-ste } related-words +{ corr corr-ddof population-corr sample-corr } related-words diff --git a/basis/math/statistics/statistics.factor b/basis/math/statistics/statistics.factor index c94565482f..838241061e 100644 --- a/basis/math/statistics/statistics.factor +++ b/basis/math/statistics/statistics.factor @@ -371,6 +371,10 @@ ALIAS: corr sample-corr [ dup mean v-n ] [ std ] bi dup zero? [ drop ] [ v/n ] if ; +: standardize-2d ( u -- v ) + flip dup [ [ mean ] [ std ] bi 2array ] map + [ [ first v-n ] 2map ] keep [ second v/n ] 2map flip ; + : differences ( u -- v ) [ 1 tail-slice ] keep [ - ] 2map ;