This function evaluates the statistical significance of co-association
of cell states within each SE. It computes within-SE average association scores
and compares them to a null distribution generated by permutation.
Diagonal values are ignored if they are all equal to 1 or NA.
Usage
CoassociationTest(mat, nperm = 1000)
Arguments
- mat
A numeric matrix of co-association or colocalization indices between states.
Row and column names should encode cell state labels (e.g. SE1_CD4T).
- nperm
Integer. Number of permutations used to estimate the null distribution.
Default is 1000.
Value
A named numeric vector of two-sided P-values for each SE,
representing the significance of within-SE co-association. The signed
Z-scores underlying these P-values are attached as the `"Zscore"`
attribute (`attr(result, "Zscore")`).