From d291f096c2e6be289233e7c849836ba5fefa8bec Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 5 Nov 2012 08:43:46 -0800 Subject: [PATCH] math.statistics: Rename full-* to population-*. Full, while somewhat descriptive of using the entire dataset, is not a technical term, while population is used in Mathematica and stats books. --- basis/math/statistics/statistics-docs.factor | 8 ++++---- basis/math/statistics/statistics.factor | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) 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 ;