Expand description

Basic Unit root tests for time series data.

Examples

use unit_root::prelude::distrib::dickeyfuller::constant_no_trend_critical_value;
use unit_root::prelude::distrib::AlphaLevel;
use unit_root::prelude::nalgebra::DVector;
use unit_root::prelude::*;

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

let report = tools::dickeyfuller::constant_no_trend_test(&y);

let critical_value = constant_no_trend_critical_value(report.size, AlphaLevel::OnePercent);
assert_eq!(report.size, 10);

let t_stat = report.test_statistic.unwrap();
println!("t-statistic: {}", t_stat);
assert!((t_stat - -1.472691f32).abs() < 1e-6);
assert!(t_stat > critical_value);

References

Modules

The public API. unit_root is a library for testing for unit roots in time series. This is the public API. Enjoy!

Enums

The error type for this crate.