Skip to main content

functional_acf

Function functional_acf 

Source
pub fn functional_acf(
    data: &FdMatrix,
    argvals: &[f64],
    max_lag: Option<usize>,
    n_sim: usize,
    ci: f64,
    seed: u64,
) -> Result<FacfResult, FdarError>
Expand description

Functional autocorrelation and partial autocorrelation of a curve series.

Computes the L2-norm functional ACF at lags 1..=max_lag following the fdaACF convention (Mestre et al. 2021), the scalar Durbin-Levinson fPACF, and Monte-Carlo strong-white-noise confidence bands.

§Arguments

  • data — Time-ordered functional observations (N × m, column-major). Rows are curves ordered from earliest to latest.
  • argvals — Evaluation points on the common grid (length m).
  • max_lag — Maximum lag to compute. None uses min(20, N/4).
  • n_sim — Monte-Carlo replications for the white-noise band (default 999).
  • ci — Confidence level for the upper band (default 0.95).
  • seed — Deterministic RNG seed for the MC band.

§Errors

§Algorithm

  1. Compute the sample mean curve and Simpson quadrature weights.
  2. Compute the m×m lag-0 sample autocovariance operator C_0 (normalised by 1/N).
  3. For each h = 1..=max_lag, compute C_h and ρ_h = sqrt(‖C_h‖²_HS) / normalization where normalization = ∫ C_0(t,t) dt (trace integral, trapezoidal).
  4. Eigendecompose C_0 via nalgebra::SymmetricEigen; truncate eigenvalues with λ_j / λ_max < 1e-4.
  5. Run n_sim MC draws of Q = Σ_{j,k} λ_j λ_k χ²_1(j,k) to obtain the ci-quantile; upper_band[h] = sqrt(q_ci) / normalization.
  6. Apply scalar Durbin-Levinson to acf to obtain pacf.

§Divergence from R fdaACF

White-noise band: fdaACF offers both an exact Imhof band (via the CompQuadForm R package) and a Monte-Carlo path. This implementation provides the Monte-Carlo approximation only — no pure-Rust Imhof equivalent exists without adding a new crate dependency. The MC path converges as n_sim → ∞; the default n_sim = 999 matches fdars’ permutation-test convention (use 10 000 for publication-quality bands).

fPACF: see functional_pacf for the Durbin-Levinson divergence note.