Add return_sig and decouple significance compute from display#134
Open
lshpaner wants to merge 2 commits into
Open
Add return_sig and decouple significance compute from display#134lshpaner wants to merge 2 commits into
return_sig and decouple significance compute from display#134lshpaner wants to merge 2 commits into
Conversation
return_sig and decouple significance compute from display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends
flex_corr_matrixwith p-value return support and fixes two significance-related behavior bugs. All changes are backward compatible at default arguments.Changes
return_sigto return the pairwise p-value matrix as a DataFrame, mirroringreturn_corr. When bothreturn_corrandreturn_sigare set, returns a(corr_matrix, pval_matrix)tuple. Return annotation loosened toOptional[Union[pd.DataFrame, Tuple[pd.DataFrame, pd.DataFrame]]]._starssignificance gate. The star gate was hardcoded atp >= 0.05, sosignificance_levelhad no effect in "stars" mode despite the docstring claiming otherwise. Now gates onsignificance_level, so stars and mask share one threshold. Identical output at the 0.05 default._need_pvaluestrigger (show_significance or filter_significance is not None or return_sig) so p-values are computed whenever any consumer needs them, while the stars/mask overlay stays gated onshow_significance.show_significanceauto-enable.filter_significanceno longer overrides an explicitshow_significance=False. It now filters variables without forcing the overlay, sofilter_significance=0.05, show_significance=Falseproduces a plain filtered heatmap.return_corrorreturn_sigsuppresses the plot by default;show_plot=Truere-enables.return_sigentry, correctedsignificance_level/filter_significance/show_plotdescriptions, updatedReturnsfor the three-way return.Add p_adjust, return_n, show_n to flex_corr_matrix
p_adjust: bonferroni / fdr_bh, corrected over unique pairs (m = k(k-1)/2), applied beforestars,mask,filter_significanceandreturn_sigconsume p-valuesreturn_n: pairwise sample-size matrix; n_format; toggles counts vs percent of frameshow_n: plots the n matrix as a coverage heatmap; mutually exclusive with show_significancecmap/vmin/vmax/cbar_labelnow resolve by modefilter_significancedropped the -0.00 zeroing_stars significance_leveltest viagcf().axesTests
Added coverage for
return_sig(single return, tuple return, plot suppression, diagonal, filter/threshold reflection). Note: the_stars-gate regression test was pulled pending a fix to axis-annotation readback, so the gate behavior is currently unpinned.