Skip to content

Statistics module written in Reason

License

Notifications You must be signed in to change notification settings

aaronshaf/stats.re

Repository files navigation

Statistics module written in Reason. Inspired by simple-statistics. Help me add more functions :-)

Usage

yarn install stats.re
// in bsconfig.json
"bs-dependencies": ["stats"]
let array = [|1.2, 2.3, 3.4, 4.5|];
let result = ArrayStats.mean(array); /* 2.85 */

The best example are the tests. See ArrayStatsTests.re and ListStatsTests.re.

ArrayStats (mirrors ListStats)

/* basics */
ArrayStats.min(x: array(float)) => float;
ArrayStats.max(x: array(float)) => float;
ArrayStats.sum_simple(x: array(float)) => float;
ArrayStats.mode(x: array(float)) => float;
ArrayStats.quantile(quantile: float, x: array(float)) => float;
ArrayStats.product(x: array(float)) => float;

/* sorted */
ArrayStats.sort(x: array(float)) => array(float);
ArrayStats.min_sorted(x: array(float)) => float;
ArrayStats.mode_sorted(x: array(float)) => float;
ArrayStats.quantile_sorted(quantile: float, x: array(float)) => float;

/* measures of central tendency */
ArrayStats.mean(x: array(float)) => float;
ArrayStats.median(x: array(float)) => float;
ArrayStats.root_mean_squared(x: array(float)) => float;
ArrayStats.geometric_mean(x: array(float)) => float;
ArrayStats.harmonic_mean(x: array(float)) => float;
ArrayStats.sample_skewness(x: array(float)) => float;

/* measures of dispersion */
ArrayStats.variance(x: array(float)) => float;
ArrayStats.sample_variance(x: array(float)) => float;
ArrayStats.standard_deviation(x: array(float)) => float;
ArrayStats.sample_standard_deviation(x: array(float)) => float;
ArrayStats.interquartile_range(x: array(float)) => float;
ArrayStats.sum_nth_power_deviations(x: array(float), n: float) => float;

Utils

Stats.Utils.add_to_mean(mean: float, listLength: float, newValue: float) => float;

Dev

yarn start
# open http://localhost:1234
# edit src/Stats.re

See more here.

See also

  • owl - "numerical library: dense and sparse matrix, linear algebra, regressions, maths and stats functions"

About

Statistics module written in Reason

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published