tsorder-core 0.1.0

Order selection for time-series models: classical information criteria and Fine–Hwang threshold estimators (dependency-free core)
Documentation
//! Prints, as JSON, the studentized PACF path and threshold used by the
//! landing page chart (site/index.html), so the figure is reproducible:
//!
//! ```text
//! cargo run --example pacf_path
//! ```
//!
//! Series: AR(2) with phi = (1.2, -0.6), n = 400, generated by the crate's
//! own `sim` module (seed 42) — the same generator as the integration tests.

use tsorder_core::sim::arma;
use tsorder_core::*;

fn main() {
    let x = arma(&[1.2, -0.6], &[], 400, 42);
    let fh = fh_order(&x, FhConfig::default()).unwrap();
    let bic = ic_order(&x, Criterion::Bic, None).unwrap();
    let path: Vec<String> = fh
        .studentized
        .iter()
        .map(|t| format!("{:.3}", t.abs()))
        .collect();
    println!(
        "{{\"n\": 400, \"p_n\": {}, \"tau\": {:.3}, \"order\": {}, \"bic_order\": {}, \"abs_studentized_pacf\": [{}]}}",
        fh.p_n,
        fh.tau,
        fh.order,
        bic.order,
        path.join(", ")
    );
}