Unit root tests in Rust

Build

Description

Stationarity tests for time-series data in Rust.

At the moment: Dickey-Fuller test and Augmented Dickey-Fuller test with a constant but no trend.

License

This project is licensed under the terms of the Apache License 2.0.

Usage

Augmented Dickey-Fuller test:

```rust use unitroot::prelude::distrib::AlphaLevel; use unitroot::prelude::nalgebra::DVector; use unit_root::prelude::*;

fn main() { let y = DVector::fromrowslice(&[ -0.89642362, 0.3222552, -1.96581989, -1.10012936, -1.3682928, 1.17239875, 2.19561259, 2.54295031, 2.05530587, 1.13212955, -0.42968979, ]);

let lag = 2;

// compute the test statistic
let report = tools::adf::constant_no_trend_test(&y, lag).unwrap();

// critical values for the model with a constant but no trend:
let critical_value = distrib::dickeyfuller::constant_no_trend_critical_value(
    report.size,
    AlphaLevel::OnePercent,
);
assert_eq!(report.size, 10);

// comparison
let t_stat = report.test_statistic;
println!("t-statistic: {}", t_stat);
println!("critical value: {}", critical_value);

} ```

See examples for more.