robustrolling¶
High-performance rolling-window statistics for R and Python — six algorithms implemented in C++17, exposed through idiomatic bindings in both languages, with O(1) or O(log n) updates per element.
API Reference
Algorithm overview¶
C++ class |
Algorithm |
Complexity |
R function(s) |
Python function(s) |
|---|---|---|---|---|
|
Welford online variance (ring buffer) |
O(1) |
|
|
|
Monotonic deque maximum |
O(1) amortised |
|
|
|
Monotonic deque minimum |
O(1) amortised |
|
|
|
|
O(log n) |
|
|
|
Terriberry 4th-moment online algorithm |
O(1) |
|
|
|
2-D Welford online covariance |
O(1) |
|
|
Install for R¶
# Requires a C++17 compiler (GCC ≥ 7, Clang ≥ 5, MSVC ≥ 2017)
install.packages("remotes")
remotes::install_github("IgorPtak/rolling_window")
Install for Python¶
# Requires Python ≥ 3.8 and a C++17 compiler
pip install git+https://github.com/IgorPtak/rolling_window.git#subdirectory=py_package
# Or clone and install locally:
git clone https://github.com/IgorPtak/rolling_window.git
pip install rolling_window/py_package/