module Stats

Overview

Core module containing common statistics methods

Extended Modules

Defined in:

stats.cr

Instance Method Summary

Instance Method Detail

def mean(input : Array(Int | Float32 | Float64)) : Float64 #

Returns a Float64 averaged value from a given Array(Int | Float32 | Float64)

Stats.mean [1,2,3,4]      # => 2.5

[View source]
def median(input : Array(Int | Float32 | Float64)) : Float64 #

Returns a Float64 median value from a given Array(Int | Float32 | Float64)

Stats.median [1,3,8,9]      # => 5.5

[View source]
def mode(input : Array(Int | Float32 | Float64)) : Float64 #

Returns the most frequent value as a Float64 from a given Array(Int | Float32 | Float64)

Stats.mode [1,3,8,9,3]      # => 3.0

TODO Use generics to return value cast to original type

TODO Return multiple results on case of draw


[View source]