Skip to main content

scb_two_sample_test

Function scb_two_sample_test 

Source
pub fn scb_two_sample_test(
    data_a: &FdMatrix,
    data_b: &FdMatrix,
    argvals: &[f64],
    bandwidth: f64,
    nb: usize,
    confidence: f64,
    multiplier: MultiplierDistribution,
) -> Result<TestResult, FdarError>
Expand description

Two-sample mean-equality test via a simultaneous confidence band for the mean difference (SCBmeanfd-style).

Forms the paired difference matrix d[i] = data_a[i] − data_b[i] (over the first min(n_a, n_b) rows) and reuses the Degras multiplier bootstrap (scb_mean_degras) to produce a simultaneous band for the mean difference. The null of equal means is rejected when that band excludes zero at any grid point.

The returned TestResult encodes the decision:

  • statistic is the maximum standardized excursion of the difference band from zero, max_t (|center(t)| / half_width(t)); it exceeds 1.0 exactly when the band excludes zero somewhere (i.e. when the null is rejected).
  • p_value is 0.0 when the null is rejected (band excludes zero) and 1.0 otherwise — a conservative encoding of the simultaneous-band decision at the requested confidence (there is no finer p-value from a single band). n_perm is 0.

§Arguments

  • data_a - First sample (n_a x m).
  • data_b - Second sample (n_b x m).
  • argvals - Evaluation points (length m).
  • bandwidth - Kernel bandwidth (> 0).
  • nb - Number of bootstrap replicates (>= 1).
  • confidence - Confidence level in (0, 1).
  • multiplier - Multiplier distribution.

§Errors

Returns FdarError::InvalidDimension if the two samples have unequal or zero column counts or an argvals length mismatch. Forwards scb_mean_degras validation errors otherwise (including the >= 3 rows requirement on the difference matrix, bandwidth > 0, nb >= 1, confidence in (0, 1)).