Directional Statistics and Filtering Using libDirectional

Gerhard Kurz, Igor Gilitschenski, Florian Pfaff, Lukas Drude, Uwe D. Hanebeck, Reinhold Haeb‐Umbach, Roland Siegwart

Abstract

In this paper, we present libDirectional, a MATLAB library for directional statistics and directional estimation. It supports a variety of commonly used distributions on the unit circle, such as the von Mises, wrapped normal, and wrapped Cauchy distributions. Furthermore, various distributions on higher-dimensional manifolds such as the unit hypersphere and the hypertorus are available. Based on these distributions, several recursive filtering algorithms in libDirectional allow estimation on these manifolds. The functionality is implemented in a clear, well-documented, and object-oriented structure that is both easy to use and easy to extend.

1. Introduction

Standard statistical tools are typically designed for Euclidean space—the "flat" world where values range from negative to positive infinity. However, many real-world variables are periodic or directional, such as the heading of a robot, the orientation of a satellite, or the phase of a signal. Applying linear statistics to these "circular" variables leads to significant errors; for instance, the arithmetic mean of 1° and 359° is 180°, whereas the correct directional average is 0°.

While directional statistics is a well-established field, existing software often suffers from limited scope, a lack of recursive estimation tools, and fragmented implementations. libDirectional addresses these gaps by providing a unified, object-oriented framework for directional statistics and recursive filtering on non-Euclidean manifolds like circles, tori, and hyperspheres.

2. Methods and Implementation

The library is implemented in MATLAB with C++ cores for performance-critical operations. It treats manifolds as first-class citizens through an abstract base class structure.

2.1 Distribution Support

libDirectional implements a wide array of distributions:

  • Circular Distributions: Wrapped normal (WN), von Mises, wrapped Cauchy, and Fourier-based distributions.
  • Higher-Dimensional Manifolds: Bingham and Watson distributions for hyperspheres, and distributions for the hypertorus (multiple angles).
  • Rigid Body Motions: Support for SE(2), combining rotation and translation.

2.2 Recursive Filtering

A core strength of the library is its support for recursive estimation. It includes specialized filters such as the WN-assumed filter, Fourier filters, and adapted versions of the Unscented Kalman Filter (UKF) designed specifically for circular constraints. These filters utilize deterministic sampling schemes to pick representative points that preserve distributional moments, offering superior performance over traditional particle filters in many scenarios.

3. Visualization and Validation

The library includes robust visualization tools to help researchers understand distribution behavior on different manifolds. Figure 1 demonstrates how a circular probability density function (PDF) can be represented both on a linear axis and on the unit circle manifold.

Extracted figure from page 6 of Directional Statistics and Filtering Using <b>libDirectional</b>

To ensure correctness, the authors provide extensive unit tests comparing analytical solutions for trigonometric moments against high-precision numerical integration.

4. Key Insights

  • Abstraction: The AbstractCircularDistribution class allows users to extend the library with new PDFs while automatically inheriting plotting, entropy calculation, and sampling functionality.
  • Signal Processing Applications: Support for complex-valued directional statistics facilitates tasks like source separation in microphone arrays where phase differences are critical.
  • Robustness: The library prioritizes analytical solutions for speed but includes transparent numerical fallbacks when an analytical solution does not exist for a specific distribution.

5. Results and Future Work

The paper demonstrates that libDirectional successfully tracks circular states through nonlinear dynamics and measurements where traditional linear filters fail. For example, a WN-assumed filter can accurately track a state through transitions involving squared cosines and sine-based measurements.

Future developments for the library include adding complex angular central Gaussian and Bingham mixture models for advanced audio processing, as well as expanding specialized filtering capabilities for high-dimensional hypertoroidal manifolds.

Summary updated

BibTeX
@article{kurz2019directional,
  author = {Gerhard Kurz and Igor Gilitschenski and Florian Pfaff and Lukas Drude and Uwe D. Hanebeck and Reinhold Haeb‐Umbach and Roland Siegwart},
  title = {{Directional Statistics and Filtering Using <b>libDirectional</b>}},
  journal = {Journal of Statistical Software},
  year = {2019},
  doi = {10.18637/jss.v089.i04},
}
Figure