> For the complete documentation index, see [llms.txt](https://time-series-features.gitbook.io/time-series-analysis-tools/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/time-series-analysis-tools/time-series-analysis-methods/rad.md).

# RAD

The Rescaled Auto-Density (RAD) is a noise-robust metric for inferring the distance to criticality (the DTC). It aims to perform well in settings where the noise level varies between time series.

### 📕 Original Paper

📙 B. Harris, L. Gollo, B.D. Fulcher. "Tracking the distance to criticality in systems with unknown noise", [*Physical Review X* **14**: 031021 (2024)](https://doi.org/10.1103/PhysRevX.14.031021).

### ❓ What is RAD?

In the original paper, we use a data-driven approach to develop theory on how to infer the DTC in the variable-noise setting. This theory relies on two key time-series properties: i) the distribution of values; and ii) the scale of fast fluctuations. Combining these two properties, such as by curve-fitting the distribution and solving the Fokker--Planck equation, partials-out the noise strength to give a noise-robust estimate of the shape of the potential function (and hence the control parameter). RAD implements these key algorithmic steps in a simplified way, efficiently estimating the DTC from data using elementary time-series operations. In RAD, the two algorithmic elements are captured by standard deviations above and below the median value (measuring the distribution) and the standard deviation of lag-1 differences (measuring fast fluctuations). Our RAD feature is given by:

$$
f\_\textrm{RAD} = \sigma(\Delta \mathbf{x}) \left\[\frac{1}{\sigma(U)} - \frac{1}{\sigma(L)} \right],,
$$

where $$\mathbf{x}$$ is the input time series, $$\Delta$$is the lag-1 difference operator, $$\sigma(\cdot)$$ is the standard deviation, and:

$$
U = {x\_t: x\_t \geq \tilde{x}},,\L = {x\_t: x\_t < \tilde{x}},,
$$

where $$\tilde{x}$$ is the median value of $$\mathbf{x}$$.

### 🏃 Running RAD in Matlab, Julia, and Python

Code for implementing RAD is available in **Matlab**, **Julia**, and **Python** is collected in this [RAD Github repository](https://github.com/DynamicsAndNeuralSystems/RAD).

RAD is also available through existing toolboxes in both Matlab and Julia:

* **Matlab**: in *hctsa* (as of `v1.08`), as the `CR_RAD()`master function, and `CR_RAD_1`, `CR_RAD_2`, and `CR_RAD_tau` operations
* **Julia**: in the `TimeseriesFeatures.jl` package (`StatsBase.jl` extension), as the `CR_RAD::Feature`

### ⚠️ Usage Guide

RAD is best suited to univariate, regularly-sampled time-series data. The sampling period should be constant between time series, and if the time series are excessively smooth or over-sampled then the `tau` parameter should be set to a value greater than 1 (a suitable `tau` can often be inferred by inspecting the autocorrelation function of a time series).

RAD also includes an optional centering step (`doAbs`), which should be enabled if the time series do not represent radial values (e.g., enable `doAbs` if the distribution is approximately symmetric or 'two-sided').


---

# 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/time-series-analysis-tools/time-series-analysis-methods/rad.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.
