All Projects → JimmyMAndersson → StatKit

JimmyMAndersson / StatKit

Licence: other
A collection of statistical analysis tools for your Swift programs.

Programming Languages

swift
15916 projects
shell
77523 projects

Projects that are alternatives of or similar to StatKit

Datadoubleconfirm
Simple datasets and notebooks for data visualization, statistical analysis and modelling - with write-ups here: http://projectosyo.wix.com/datadoubleconfirm.
Stars: ✭ 24 (-63.64%)
Mutual labels:  statistical-analysis
Ee Outliers
Open-source framework to detect outliers in Elasticsearch events
Stars: ✭ 172 (+160.61%)
Mutual labels:  statistical-analysis
scCODA
A Bayesian model for compositional single-cell data analysis
Stars: ✭ 109 (+65.15%)
Mutual labels:  statistical-analysis
Pycm
Multi-class confusion matrix library in Python
Stars: ✭ 1,076 (+1530.3%)
Mutual labels:  statistical-analysis
Gitinspector
📊 The statistical analysis tool for git repositories
Stars: ✭ 2,058 (+3018.18%)
Mutual labels:  statistical-analysis
Scikit Posthocs
Multiple Pairwise Comparisons (Post Hoc) Tests in Python
Stars: ✭ 186 (+181.82%)
Mutual labels:  statistical-analysis
Pymc3
Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Aesara
Stars: ✭ 6,214 (+9315.15%)
Mutual labels:  statistical-analysis
webmc3
A web interface for exploring PyMC3 traces
Stars: ✭ 46 (-30.3%)
Mutual labels:  statistical-analysis
Data Science Toolkit
Collection of stats, modeling, and data science tools in Python and R.
Stars: ✭ 169 (+156.06%)
Mutual labels:  statistical-analysis
Miller
Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Stars: ✭ 4,633 (+6919.7%)
Mutual labels:  statistical-analysis
Ggstatsplot
Enhancing `ggplot2` plots with statistical analysis 📊🎨📣
Stars: ✭ 1,121 (+1598.48%)
Mutual labels:  statistical-analysis
Hdrhistogram rust
A port of HdrHistogram to Rust
Stars: ✭ 130 (+96.97%)
Mutual labels:  statistical-analysis
Morpheus Core
The foundational library of the Morpheus data science framework
Stars: ✭ 203 (+207.58%)
Mutual labels:  statistical-analysis
Uc Davis Cs Exams Analysis
📈 Regression and Classification with UC Davis student quiz data and exam data
Stars: ✭ 33 (-50%)
Mutual labels:  statistical-analysis
statisticalHypothesisTests
統計的仮説検定&信頼区間推定用スクリプトまとめ
Stars: ✭ 19 (-71.21%)
Mutual labels:  statistical-analysis
Dataframe
C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types, continuous memory storage, and no pointers are involved
Stars: ✭ 828 (+1154.55%)
Mutual labels:  statistical-analysis
Volbx
Graphical tool for data manipulation written in C++/Qt
Stars: ✭ 187 (+183.33%)
Mutual labels:  statistical-analysis
srqm
An introductory statistics course for social scientists, using Stata
Stars: ✭ 43 (-34.85%)
Mutual labels:  statistical-analysis
loon
A Toolkit for Interactive Statistical Data Visualization
Stars: ✭ 45 (-31.82%)
Mutual labels:  statistical-analysis
Tablesaw
Java dataframe and visualization library
Stars: ✭ 2,785 (+4119.7%)
Mutual labels:  statistical-analysis

StatKit


Platform Support

Twitter: @jimmymandersson Sponsor this project

Swift PM Compatible


Welcome to StatKit, a collection of statistical analysis tools for Swift developers.

Builtin Statistics

StatKit adds relevant functionality for statistical analysis for the types you use every day. With StatKit, you will be able to calculate a variety of useful statistics such as:

  • Central Tendency
    Calculate modes, means, and medians of your data sets.

  • Variability
    Compute variances and standard deviations.

  • Correlation
    Find linear tendencies and covariance of measurements.

  • Distributions
    Make computations using several common distribution types.

A simple example would be to calculate the modes of an integer array, which can be done easily with the following piece of code:

print(mode(of: [1, 2, 3, 3, 2, 4], variable: \.self))

// Prints [3, 2]

In this case, mode(of:variable:) takes a KeyPath argument which specifies the variable inside the array that you are interested in. In the example above, we specify the \.self keypath, which points to the array element itself (in this case, the integers).

The pattern of specifying one or more variables to investigate is common throughout the StatKit library. It allows you to calculate similar statistics for a variety of different types using the same syntax. For example, both of the below examples produce valid results, even though the types under investigation are completely disparate:

Calculating the mode of all characters in a String:

print(mode(of: "StatKit", variable: \.self))

// Prints ["t"]

Calculating the mode of CGPoint y-values in an array:

import CoreGraphics

let points = [CGPoint(x: 0, y: 1), 
              CGPoint(x: 1, y: 3), 
              CGPoint(x: 3, y: 1)]

print(mode(of: points, variable: \.y))
// Prints [1.0]

Computing statistics for collections of complex custom types

As the examples in the previous section showed, calculating statistics is easy when using collections of types that are readily available. However, most of us work with custom data structures in our projects. Luckily, StatKit provides support for arbitrary custom types thanks to the extensive use of generics.

Let us look at a custom data structure that keeps track of collected data points for a specific brand of cars, and how we can use StatKit to wasily calculate the mean and standard deviation of their fuel consumption:

struct FuelConsumption {
  let modelYear: String
  let litersPer10Km: Double
}

let measurements: [FuelConsumption] = [...]

mean(of: measurements, variable: \.litersPer10Km, strategy: .arithmetic)
standardDeviation(of: measurements, variable: \.litersPer10Km, from: .sample)

As you can see, using KeyPath's makes the StatKit API easy to use and reusable across completely arbitrary custom structures.

Distributions

StatKit provides multiple discrete and continuous distribution types for you to work with. These allow you to compute probabilities, calculate common moments such as the skewness and kurtosis, and sample random numbers from a specific data distribution.

let normal = NormalDistribution(mean: 0, variance: 1)
print(normal.cdf(x: 0))
// Prints 0.5

let normalRandomVariables = normal.sample(10)
// Generates 10 samples from the normal distribution

Documentation

StatKit is documented using Swift-DocC, which means that the documentation pages can be built by Xcode and viewed in the Developer Documentation panel. Build it by clicking Product > Build Documentation or hitting Shift + Ctrl + Cmd + D.

System Requirements

To use StatKit, make sure that your system has Swift 5.5 (or later) installed. If you’re using a Mac, also make sure that xcode-select points at an Xcode installation that includes a valid version of Swift and that you’re running macOS Catalina (10.15) or later.

IMPORTANT
StatKit does not officially support any beta software, including beta versions of Xcode and macOS, or unreleased versions of Swift.

Installation

Swift Package Manager

To install StatKit using the Swift Package Manager, add it as a dependency in your Package.swift file:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/JimmyMAndersson/StatKit.git", from: "0.5.0")
    ],
    ...
)

Then import StatKit where you would like to use it:

import StatKit

Contributions and support

StatKit is a young project that is under active development. Our vision is to create the go-to statistics library for Swift developers, much like SciPy and NumPy are for the Python language.

❤️ Consider becoming a sponsor to support the development of this library.
You could cover an afternoon coffee or a meal to keep my neurons firing.

Thank you for your contribution, and enjoy using StatKit!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].