README.md

# Chi2fitNb

Tool for fitting particular probability distributions to empirical cumulative distribution functions.
Distributions supported are Weibull, Wald (Inverse Gauss), Normal, Exponential, Poisson, Erlang, and Skewed Exponential.

It uses the Chi-squared Pearson statistic as the likelihood function for fitting. This statistic applies to
empirical data that is categorial in nature.

It provides various options for controlling the fitting procedure and assignment of errors. It supports asymmetrical
errors in fitting the data.

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `chi2fit` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:chi2fit_nb, "~> 0.1"}
  ]
end
```

Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/chi2fit_nb](https://hexdocs.pm/chi2fit_nb).

## Docker & Jupyter Notebooks

`Chi2fitNb` can be used together with Jupyter Notebooks. The easiest way is to create a docker image and run it.
The docker image is based on [IElixir](https://github.com/pprzetacznik/IElixir).

The image is built using:

```shell
$ mix docker.build
```

Run the image with the command:

```shell
$  mix docker.run
```

In Jupyter use one of the provided example notebooks to learn how Chi2fit is set-up from within a notebook.

## Basic usage: jupyter notebook

The repository contains the notebooks:

* `Analysis-cycle-time-data.ipynb`
* `Analysis-throughput-data.ipynb`
* `Example-multi-modal.ipynb`
* `Example-multi-plot.ipynb`
* `Guide-parameter-fitting-3d.ipynb`
* `Forecasting-bootstrapping.ipynb`
* `Forecasting-cycle-times.ipynb`
* `Forecasting-empirical-data.ipynb`
* `Forecasting-fit-to-known-distribution.ipynb`
* `Forecasting-non-equilibrium.ipynb`
* `Template-cycle-times.ipynb`
* `Template-empirical-data.ipynb`
* `Template-throughput-analysis.ipynb`

Plots are supported using the package [:gnuplot](https://hex.pm/packages/gnuplot).
On MacOS execute the following command from the shell to display the GnuPlot window:

```shell
$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
```

On a Mac using MacPorts the tool `socat` is installed by the command:

```shell
$ sudo port install socat
```  
## Documentation

For detailed documentation please visit [https://hexdocs.pm/chi2fit_nb](https://hexdocs.pm/chi2fit_nb).