{"id":13424484,"url":"https://github.com/Nephos/stats","last_synced_at":"2025-03-15T18:35:11.125Z","repository":{"id":77063539,"uuid":"62059060","full_name":"Nephos/stats","owner":"Nephos","description":"An expressive crystal implementation of statistical distributions and usual math functions. :bar_chart: ","archived":false,"fork":false,"pushed_at":"2020-05-20T00:02:39.000Z","size":103,"stargazers_count":31,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-26T23:55:17.111Z","etag":null,"topics":["statistical-distributions","statistics"],"latest_commit_sha":null,"homepage":"https://git.sceptique.eu/Sceptique/stats","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nephos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-06-27T13:41:14.000Z","updated_at":"2024-07-19T06:30:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"749636fa-94d4-4aa3-a9bd-e73702514bae","html_url":"https://github.com/Nephos/stats","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nephos%2Fstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nephos%2Fstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nephos%2Fstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nephos%2Fstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nephos","download_url":"https://codeload.github.com/Nephos/stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243775856,"owners_count":20346277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["statistical-distributions","statistics"],"created_at":"2024-07-31T00:00:55.038Z","updated_at":"2025-03-15T18:35:06.091Z","avatar_url":"https://github.com/Nephos.png","language":"Crystal","funding_links":[],"categories":["Crystal","Science and Data analysis"],"sub_categories":[],"readme":"**Migrated to \u003chttps://git.sceptique.eu/Sceptique/stats\u003e**\n\n# stats\n\nAn expressive implementation of statistical distributions.\nCompatible with crystal v0.27.0.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  stats:\n    git: https://git.sceptique.eu/Sceptique/stats\n```\n\n\n## Usage\n\n### Include it\n\n```crystal\nrequire \"stats\"\ninclude Stats\n```\n\n### Normal distribution\n\n```crystal\nNormaleDistribution.between # less_than, greater_than\n  standard_deviation: 15,\n  esperance: 100,\n  min: 85,\n  max: 115\n  # =\u003e 0.6826894921370859\n```\n\n### Binomial distribution\n\n```crystal\nMath.binomial_distribution(\n  tries: 3,\n  probability: 0.5,\n  success: 1)\n  # =\u003e 0.375\n```\n\n### Binomial coefficient\n\n```crystal\nMath.coef_binomial(5, 2) # =\u003e 10\n```\n\n### Factorial\n\n```crystal\nMath.factorial(4) # =\u003e 24\n```\n\n### Radian and degree\n\n```crystal\n90.radian # =\u003e (Math::PI / 2)\n(Math::PI / 4) # =\u003e 45.0\n```\n\n### Series \u0026 Statistics\n\n```crystal\n[1, 2, 3].mean # =\u003e 2.0\n[1, 2, 3].variance # =\u003e 0.6667\n[1, 2, 3].standard_deviation # =\u003e 0.8165\n[1, 2, 3].quadratic_mean # =\u003e 2.16\n[2, 32].geometric_mean # =\u003e 8.0\n[40, 60].harmonic_mean # =\u003e 48.0\n[1,2,3,2,1].macd 3 # =\u003e [2.0, 2.333, 2.0]\n```\n\n### Correlations\n\n```crystal\n[1,2,3,4].covariance [4,2,1,0] # =\u003e -1.625\n[1,2,3,4].correlation_coef [1,2,3,3] + 1 \u003e 1.5 # =\u003e true\n[1,2,3,4].correlation_coef [-14,14,101,-100] + 1 \u003e 1.5 # =\u003e false\n```\n\n### Median\n\n```crystal\n[1, 2, 5].median # =\u003e 2.0\n[42, 1337].median # =\u003e 685.5\n```\n\n### Quartiles \u0026 Boxplot\n\n*Note: not big compatible yet*\n\n```crystal\n[1, 3, 5].first_quartile  # =\u003e 2.0 (alias of lower_quartile)\n[1, 3, 5].second_quartile # =\u003e 3.0 (alias of median)\n[1, 3, 5].third_quartile  # =\u003e 4.0 (alias of upper_quartile)\n[1, 3, 5].quartiles       # =\u003e [2.0, 3.0, 4.0] ([Q1, Q2, Q3])\n```\n\n```crystal\narr = [-23, -5, 2, 5, 5, 6, 7, 8, 14, 15, 42, 1337]\n\narr.first_quartile  # =\u003e 3.5  (Q1)\narr.second_quartile # =\u003e 6.5  (Q2)\narr.third_quartile  # =\u003e 14.5 (Q3)\narr.interquartile_range # =\u003e 11.0 (alias of iqr) (IQR = Q3 - Q1)\n\n# Tukey's fences with k = 1.5 (default parameter value)\narr.lower_fence # =\u003e -13.0 (Q1 - 1.5 * IQR)\narr.upper_fence # =\u003e 31    (Q3 + 1.5 * IQR)\narr.lower_outliers # =\u003e [-23]\narr.upper_outliers # =\u003e [42, 1337]\n\n# Tukey's fences with k = 3 for \"far out\" outliers\narr.upper_fence(3)    # =\u003e 47.5 (Q3 + 3 * IQR)\narr.upper_outliers(3) # =\u003e [1337]\n```\n\n### Frequency\n\n```crystal\n[0, 1, 2, 3].frequency_of(0) # =\u003e 0.25 (amount of X in the population, by the size of the population)\n[0, 0, 1, 2, 3].all_frequencies # =\u003e { 0 =\u003e 0.4, 1 =\u003e 0.2, 2 =\u003e 0.2, 3 =\u003e 0.2}\n```\n\n## Development\n\n- The lib should take care of \"big\" numbers\n\n## Contributing\n\n1. Fork it ( https://github.com/Nephos/stats/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Nephos](https://github.com/Nephos) Arthur Poulet - creator, maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNephos%2Fstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNephos%2Fstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNephos%2Fstats/lists"}