math.statistics: adding z-score.
parent
924cc23ed0
commit
1ae04f1247
|
@ -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
|
||||
|
|
|
@ -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 ;
|
||||
|
|
Loading…
Reference in New Issue