math.statistics: adding z-score.

db4
John Benediktsson 2013-02-07 15:50:34 -08:00
parent 924cc23ed0
commit 1ae04f1247
2 changed files with 7 additions and 0 deletions

View File

@ -267,6 +267,10 @@ HELP: collect-index-by
}
} ;
HELP: z-score
{ $values { "seq" sequence } { "n" number } }
{ $description "Calculates the Z-Score for " { $snippet "seq" } "." } ;
ARTICLE: "histogram" "Computing histograms"
"Counting elements in a sequence:"
{ $subsections

View File

@ -388,3 +388,6 @@ ALIAS: std sample-std
[ values ] map [ 0 [ length + ] accumulate nip ] [ ] bi zip
] [ length f <array> ] bi
[ '[ first2 [ _ set-nth ] with each ] each ] keep ;
: z-score ( seq -- n )
dup [ mean ] [ sample-std ] bi '[ _ - _ / ] map ;