> For the complete documentation index, see [llms.txt](https://time-series-features.gitbook.io/catch22/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://time-series-features.gitbook.io/catch22/information-about-catch22/feature-descriptions/distribution-shape.md).

# Distribution shape

The DN\_HistogramMode features measure properties of the shape of the distribution of time-series values.

*catch22* contains two features involving the `DN_HistogramMode` function in *hctsa:*

* `mode_5` (long name `DN_HistogramMode_5`, the *hctsa* feature of the same name), computed in *hctsa* as `DN_HistogramMode(x_z,5,true,false)`
* `mode_10` (long name `DN_HistogramMode_10`, the *hctsa* feature of the same name), computed in *hctsa* as `DN_HistogramMode(x_z,10,true,false)`

From v1.0, both features match these *hctsa* calls exactly.

{% hint style="info" %}
**Changes in v1.0**: The names are unchanged, but the bin edges now follow *hctsa* (see Step 2 below). Before v1.0, the edges lay exactly at equal steps from the minimum to the maximum, and each value was assigned to a bin by truncating its distance from the minimum in units of the bin width, so a value lying exactly on an edge could fall in either neighbouring bin through rounding error. Because the bin centres have moved by $$10^{-6}$$ of a bin width, most values differ from earlier versions in about the sixth decimal place. Larger differences are rare and occur when values lie exactly on bin edges (e.g., integer-valued data), which can change the most populated bin.
{% endhint %}

## What it does

These functions involve computing the mode of the z-scored time-series through the following steps:

1. z-score the input time series.
2. Compute a histogram using a given number of equal-width bins spanning the range of the data (from its minimum to its maximum), e.g., 5 bins for `mode_5` and 10 bins for `mode_10`. As in *hctsa*, the interior bin edges are lowered (and the two outer edges widened) by $$10^{-6}$$ of a bin width, so that a value lying exactly on an edge always falls in the upper bin.
3. Return the centre of the bin with the most counts (if several bins tie for the most counts, the average of their centres is returned).

Because the bin edges are set by the minimum and maximum values, the output takes only a small number of possible values and depends on the most extreme values in the time series.

A constant time series cannot be *z*-scored, so by default (with masking) both features return 0 for it (earlier versions returned `NaN`).

## What these features measure

Being distributional properties, these features are completely insensitive to the time-ordering of values in the time series. Instead, they capture how the most probable time-series values are positioned relative to the mean.

{% tabs %}
{% tab title="Example 1: Gaussian-distributed noise " %}
Time series with a **symmetric** distribution, with a central peak, will have a mode near the center, and value close to zero. Here is an example of [Gaussian-distributed noise](https://www.comp-engine.org/#!visualize/5dc3827a-3873-11e8-8680-0242ac120002):

<figure><img src="https://650896658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Or28XkZfNq0bJ4X4zXE%2Fuploads%2FmB6xgj5eWZJa7EoigJag%2Fimage.png?alt=media&amp;token=a2456dd4-a750-4841-ba02-f0b9eb7333be" alt=""><figcaption></figcaption></figure>

### <mark style="color:red;">Feature output:</mark> <mark style="color:red;">`-0.36`</mark>

{% endtab %}

{% tab title="Example 2: Chirikov Map" %}
Time series with a **symmetric** distribution but with density far from the origin, like this [Chirikov map ](https://www.comp-engine.org/#!visualize/41411951-3871-11e8-8680-0242ac120002)obtain high (positive or negative) values:

<figure><img src="https://650896658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Or28XkZfNq0bJ4X4zXE%2Fuploads%2FybVSd2iAHQGrxnxusdrd%2Fimage.png?alt=media&amp;token=5af055f4-9d77-4f7f-92aa-51a896e77764" alt=""><figcaption></figcaption></figure>

### <mark style="color:red;">Feature output:</mark> <mark style="color:red;">`1.26`</mark>

{% endtab %}

{% tab title="Example 3: Beta-distributed noise" %}
Time series with **positively** skewed distributions, like this example of [beta-distributed noise ](https://www.comp-engine.org/#!visualize/20320f55-3872-11e8-8680-0242ac120002)obtain negative values as shown below:

<figure><img src="https://650896658-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3Or28XkZfNq0bJ4X4zXE%2Fuploads%2FLAOJKEwlzN77wXuNVBV5%2Fimage.png?alt=media&amp;token=b4de22a3-2eb6-4be8-89e1-d3deab3b1629" alt=""><figcaption></figcaption></figure>

### <mark style="color:red;">Feature output:</mark> <mark style="color:red;">`-0.805`</mark>

*Similarly, a **negatively** skewed distribution will yield positive values.*
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://time-series-features.gitbook.io/catch22/information-about-catch22/feature-descriptions/distribution-shape.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
