## FitDist


Fit distributions using sim-tools and compare samples to real data.


Usage

``` python
FitDist(
    data,
    metric_name,
)
```


## Attributes


`data: pd.Series`  
Time data to fit distribution to.

`metric_name: str`  
Name of metric, used for plot titles.

`mean: float`  
Mean of `data`.

`stdev: float`  
Standard deviation of `data`.

`min: float`  
Minimum value of `data`.

`max: float`  
Maximum value of `data`.

`mode: float`  
Mode of `data`. If there are several modes, it chooses the middle one.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Create instance of FitDist. |
| [fit()](#fit) | Create a sim-tools distribution instance. |
| [fit_and_compare()](#fit_and_compare) | Fit distributions and compare. |

------------------------------------------------------------------------


#### \_\_init\_\_()


Create instance of FitDist.


Usage

``` python
__init__(data, metric_name)
```


##### Parameters


`data: pd.Series`  
Time data to fit distribution to.

`metric_name: str`  
Name of metric, used for plot titles.


------------------------------------------------------------------------


#### fit()


Create a sim-tools distribution instance.


Usage

``` python
fit(dist, seed)
```


##### Parameters


`dist: str`  
Lower case name of distribution object in sim-tools to create.

`seed: int`  
Random seed.


------------------------------------------------------------------------


#### fit_and_compare()


Fit distributions and compare.


Usage

``` python
fit_and_compare(dists=DISTRIBUTIONS, xmax=200, seed=42, n_plots=None)
```


##### Parameters


`dists: str | list = DISTRIBUTIONS`\  
Distribution name/s.

`xmax: int = ``200`  
Max for x axis in plot to help view easier with long tails.

`seed: int = ``42`  
Random seed.

`n_plots: int = None`  
Number of plots to show (e.g., if 3, will show plots for top 3 distributions). If none specified, will show all.


##### Returns


`figs: list of matplotlib.figure.Figure`  
Figures generated for the top `n_plots` distributions (histogram and Q-Q plot pairs).

`ks_table: pd.DataFrame`  
Table of KS statistics and percentile/max comparisons, sorted by best fit first.
