Skip to content

Add proportion-standardized Pillai separation estimates - #5

Merged
berrygrant merged 1 commit into
mainfrom
dev_imbalance
Aug 9, 2026
Merged

Add proportion-standardized Pillai separation estimates#5
berrygrant merged 1 commit into
mainfrom
dev_imbalance

Conversation

@berrygrant

Copy link
Copy Markdown
Owner

Add proportion-standardized Pillai separation estimates

Summary

This PR adds opt-in proportion-standardized Pillai estimates to pillai_overlap() through the new argument:

proportion_standardized = TRUE

The existing default behavior is unchanged. In particular, $pillai remains present and retains its existing value.

When enabled, the function additionally returns:

  • realized class counts (n1, n2) and harmonic mean (H);
  • the plug-in squared Mahalanobis separation estimate (d2_plugin);
  • the unbiased estimate given by Lachenbruch and Mickey (1968) (d2_unbiased);
  • Becker’s (1986) proportion-standardized Pillai score (pillai_eq);
  • explicit fallback and minority-fragility diagnostics.

Fallback behavior

When d2_unbiased < 0, the result is explicitly flagged:

  • pillai_eq is NA;
  • pillai_eq_fallback is TRUE;
  • the fallback separation estimate is returned separately as d2_fallback;
  • its known bias term is reported as bias_2p_over_H.

The fallback is never silently reported as a proportion-standardized Pillai score.

Scope and definedness

The new estimator chain:

  • applies only to exactly two classes;
  • assumes multivariate normality and a common within-class covariance;
  • requires at least two observations per class and invertible within-class scatter;
  • returns undefined new fields with a warning when nu_e - p - 1 <= 0;
  • flags minority classes with fewer than p + 1 observations as fragile;
  • does not add covariate or multiclass support.

Documentation

The function documentation, README, and NEWS have been updated with:

  • definitions and interpretation of the new estimates;
  • model assumptions and definedness conditions;
  • fallback semantics;
  • the distinction between raw Pillai and the standardized score;
  • the relevant Becker (1986) and Lachenbruch and Mickey (1968) attributions.

Testing

Added tests covering:

  • all supplied numerical test vectors;
  • fallback and near-boundary behavior;
  • undefined and fragile cases;
  • exactly-two-class enforcement;
  • backward compatibility of the default return value;
  • agreement with base R’s manova() Pillai statistic;
  • end-to-end estimator-chain calculations.

Validation completed under R 4.3.3:

  • focused tests: passed;
  • complete testthat suite: passed;
  • R CMD build --no-manual: passed;
  • R CMD check --no-manual: status OK;
  • R CMD check --as-cran --no-manual: 0 errors and 0 warnings (one environment-related clock note).

@berrygrant
berrygrant merged commit c1a135d into main Aug 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants