Tests whether a dataset has excess zeros beyond what the chosen distribution predicts, and recommends a zero-inflation mode.
Value
A list with:
- excess_zero_rate
Fraction of zeros exceeding the expected count
- has_zi
Logical: TRUE if excess_zero_rate > threshold
- zi_mode
Recommended mode: "none", "row", or "col"
- row_excess
Per-row excess zero rates
- col_excess
Per-col excess zero rates
Details
Computes the expected number of zeros under the fitted distribution (Poisson approximation: \(P(X=0) \approx e^{-\mu}\)), compares to the observed zero count, and recommends ZI if the excess is large.
ZI granularity is determined by whether per-row and per-col excess rates have high variance (suggesting different rows/cols have different ZI levels).