https://github.com/f0i/statistics
Statistic functions for elm
https://github.com/f0i/statistics
elm libraries statistics
Last synced: 6 months ago
JSON representation
Statistic functions for elm
- Host: GitHub
- URL: https://github.com/f0i/statistics
- Owner: f0i
- License: bsd-3-clause
- Created: 2020-05-29T09:44:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-25T18:40:23.000Z (almost 4 years ago)
- Last Synced: 2025-01-21T19:48:36.105Z (over 1 year ago)
- Topics: elm, libraries, statistics
- Language: HTML
- Size: 112 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fast Statistic functions for Lists of Float and Int
This package provides functions to get common statistic functions over lists of numbers.
If you need a function that is currently not included,
please let me know by creating an [Issue in Github](https://github.com/f0i/statistics/issues/new)
or send me an email at [elm-statistics@f0i.de](mailto:elm-statistics@f0i.de?subject=github:f0i/statistics).
Same thing for performance improvements, ideas, sponsoring and job offers.
Performance tests and comparision to other libraries can be found in the benchmark directory or at [f0i.de/projects/elm-statistics](https://f0i.de/projects/elm-statistics).
## Install
```bash
elm install f0i/statistics
```
## Examples
```elm
$ elm repl
> import List.Statistics as Stats
-- This is the test data for the following examples:
> data = [1, 1, 2, 2, 4, 8, 8, 9]
[1,1,2,2,4,8,8,9]
> data |> Stats.avg
Just 4.375 : Maybe Float
> data |> Stats.mean -- alias for avg
Just 4.375 : Maybe Float
> data |> Stats.occurrences
Dict.fromList [(1,2),(2,2),(4,1),(8,2),(9,1)]
: Dict.Dict number Int
> data |> Stats.minmax
Just (1,9) : Maybe ( number, number )
> data |> Stats.stdDeviation
Just 3.1991209730174317 : Maybe Float
-- Get the element 25% into the list (interpolated between closest values)
> data |> Stats.percentile 0.25
Just 1.75 : Maybe Float
-- Some functions have a separate implementation for list of Int
> data |> Stats.percentileInt 0.75
Just 8 : Maybe Int
>
```
The complete list of function definitions can be found in
[the package documentation](https://package.elm-lang.org/packages/f0i/statistics/latest/List-Statistics)
## Development
This package uses elm-test and elm-benchmark.
There are make inside the [makefile](makefile) to run these tests whenever a file changes.
## Alternatives
There are some other libraries which provide statistics functions:
*
*
*
See for performance comparision.