STL Rust
Seasonal-trend decomposition for Rust
Installation
Add this line to your application’s Cargo.toml under [dependencies]:
= "0.2"
Getting Started
Decompose a time series
let series = vec!;
let period = 7; // period of the seasonal component
let res = params.fit.unwrap;
Get the components
res.seasonal;
res.trend;
res.remainder;
Robustness
Use robustness iterations
let res = params.robust.fit.unwrap;
Get robustness weights
res.weights;
Parameters
Set parameters
params
.seasonal_length // length of the seasonal smoother
.trend_length // length of the trend smoother
.low_pass_length // length of the low-pass filter
.seasonal_degree // degree of locally-fitted polynomial in seasonal smoothing
.trend_degree // degree of locally-fitted polynomial in trend smoothing
.low_pass_degree // degree of locally-fitted polynomial in low-pass smoothing
.seasonal_jump // skipping value for seasonal smoothing
.trend_jump // skipping value for trend smoothing
.low_pass_jump // skipping value for low-pass smoothing
.inner_loops // number of loops for updating the seasonal and trend components
.outer_loops // number of iterations of robust fitting
.robust // if robustness iterations are to be used
Strength
Get the seasonal strength
res.seasonal_strength;
Get the trend strength
res.trend_strength;
Credits
This library was ported from the Fortran implementation.
References
- STL: A Seasonal-Trend Decomposition Procedure Based on Loess
- Measuring strength of trend and seasonality
History
View the changelog
Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development: