Skip to content

Commit

Permalink
Prepare for release 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyMAndersson committed Feb 5, 2021
1 parent baa9595 commit 4660126
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ StatKit extends the Swift standard library to include relevant functionality for
* **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:

```swift
Expand Down Expand Up @@ -82,11 +85,18 @@ measurements.standardDeviation(of: \.litersPer10Km, from: .sample)

As you can see, using KeyPath's makes the StatKit API easy to use and reusable across completely arbitrary custom structures. This example also exposes two other recuring patterns.

## Specifying calculation methods and bias functions
## 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.

Firstly, the possibility to pick between different calculation methods that is seen in the `mean(_:of:)` method. Since there are often multiple methods of calculating the same type of statistic, StatKit provides parameters for you to choose which method you would like to use. If deemed a better fit for the problem at hand, the `.arithmetic` argument could be exchanged for `.geometric`. This change, rather obviously, results in computation of the geometric mean, instead of the arithmetic mean.
```swift
let normal = NormalDistribution(mean: 0, variance: 1)
print(normal.cdf(x: 0))
// Prints 0.5

Secondly, the possibility of specifying whether your data constitues an entire population or whether it should be considered a sample. Since many estimators use different techniques to reduce the bias of their results, you are able to provide the library with important hints about the data sets composition to get better calculations. In the fuel consumption example, the `standardDeviation(of:from:)` method gives you the opportunity to specify whether your measurements consitute the entire population, or merely a sample of the population that is under investigation.
let normalRandomVariables = normal.sample(10)
// Generates 10 samples from the normal distribution
```

## System Requirements
To use StatKit, make sure that your system has Swift 5.2 (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.
Expand All @@ -103,7 +113,7 @@ To install StatKit using the [Swift Package Manager](https://swift.org/package-m
let package = Package(
...
dependencies: [
.package(url: "https://github.com/JimmyMAndersson/StatKit.git", from: "0.1.0")
.package(url: "https://github.com/JimmyMAndersson/StatKit.git", from: "0.3.0")
],
...
)
Expand All @@ -127,8 +137,9 @@ end

## Contributions and support

StatKit is a young project that is under active development, and is likely to have limitations. These limitations are most likely to be discovered and uncovered as more people starts using it, since use cases may vary greatly between developers.
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.

If you would like to see some missing feature in the library, feel free to open an issue and open a Pull Request. Every Pull Request - from documentation additions to advanced computational functionality - is welcome.
[:heart: Consider becoming a sponsor](https://github.com/sponsors/JimmyMAndersson) to support the development of this library.\
You could cover an afternoon coffee or a meal to keep my neurons firing.

Enjoy using **StatKit**!
Thank you for your contribution, and enjoy using **StatKit**!
3 changes: 1 addition & 2 deletions StatKit.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Pod::Spec.new do |spec|
spec.name = "StatKit"
spec.version = "0.2.0"
spec.version = "0.3.0"
spec.summary = "StatKit adds statistical analysis tools to your Swift projects."
spec.homepage = "https://github.com/JimmyMAndersson/StatKit"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "Jimmy M Andersson" => "[email protected]" }
spec.social_media_url = "https://twitter.com/JimmyMAndersson"
spec.ios.deployment_target = "13.0"
spec.osx.deployment_target = "10.15"
spec.watchos.deployment_target = "6.0"
spec.tvos.deployment_target = "13.0"
spec.swift_version = '5.2'
spec.source = { :git => "https://github.com/JimmyMAndersson/StatKit.git", :tag => "#{spec.version}" }
Expand Down

0 comments on commit 4660126

Please sign in to comment.