Repository navigation
Description
the sandbox multicomp module has to many items, including outdated, junk and experimental code
aside:
According to the first commit, I started to work on multicomp including multiple testing correction in 2010.
So, it's really old code (and survived pretty well)
main objects for tukey-hsd and other pairwise comparisons
GroupsStats
MultiComparison
TukeyHSDResults
simultaneous_ci
tukeyhsd
get_tukeyQcrit2
get_tukey_pvalue
get_tukeyQcrit not clear, is it used?
studentized_range scipy, scipy compat
tukey_pvalues calls multicontrast_pvalues with appropriate corr matrix
multicontrast_pvalues numerical integration for p-values
qcrit table as string, not used anymore, create variables like cv001, cv005
superseded by qsturng and scipy
helper functions for variance computation
which ones are used or useful?
varcorrection_pairs_unbalanced used by tukey-hsd
varcorrection_pairs_unequal used by tukey-hsd (fixed by PR)
varcorrection_unbalanced looks like for oneway, not used in module
varcorrection_unequal looks like for oneway, not used in module and not in other stats modules, similar might be in oneway
Is this the variance of a sum/mean of k sample means? It looks like it. docstring doesn't say for which statistic this is the variance.
The varcorrection_pairs function are just vectorized versions of two sample standard and "Welch" functions.
helper functions for contrasts
contrast_all_one
contrast_allpairs
contrast_diff_mean
a copy of those is included in statsmodels\sandbox\stats\contrast_tools.py (which has more contrasts and a TwoWay ? class)
unclear helper functions
catstack helper function, hstacking list of data and labels
compare_ordered unfinished, does not yet do what it should
distance_st_range pairwise distance matrix, outsourced from tukeyhsd, reusable ?
It includes the same case for unequal var as tukey_hsd function
This function is called by StepDown class
theoretical experiments (trying to figure out some theoretical articles
multitest functions were originally written as part of multicomp
I don't think I will ever go back to these (multitest code written after this is much simpler)
rejectionline
fdrcorrection_bak
maxzero
maxzerodown
StepDown tree step-down method, maybe can still be finished and used.
R book has something along those lines but I never figured that out.
This was all written before I found the R book.
mcfdr Monte Carlo for FDR
randmvn : random draws from equi-correlated multivariate normal
trying to figure out subset of similar groups
similar to "letter" assignment
Problem: Initially I wanted to get a partition, but we can have overlapping membership
We still need to merge the (overlapping) letter code and related helper functions
homogeneous_subsets
set_partition
set_remove_subs
checking homogenous_subset: needs 1 dim list of values on a line (real values)
step down method as in Newman-Keuls and Ryan procedures
Those methods only work if each point has the same variance, e.g. same group size and equal variance.
Otherwise, neighboring points would need to take standard errors into account, e.g. each point corresponds to an interval with different interval length (e.g. ci_simultaneous in Games-Howell or tukey-hsd)
rank based multiple comparison
We still need to get rank based methods.
Needs checking whether this is useful when we add the features
rankdata a different implementation of scipy.stats.rankdata
tiecorrect
unused kruskal method in MultiComparison class
additional experimental code in __main__
junk
some code written by others, was never used
Tukeythreegene
Tukeythreegene2
Todo
-
Rank methods and letter codes (subsets) should be elevated priority.
-
pvalue computation needs to be organized as options for user
-
Stepdown into subsets (tree) version might be useful, but I currently don't have any applications in mind.
(It might be interesting to use tukey-hsd sturng as step-down p-values, i.e. sequentially reduce the number of remaining tests.
This might be like
"Holm" but for the specific all pair comparison. (I never looked for the literature for this)
Actually, this is what the class intends to do based on the class docstring. It mentions several references/authors but without giving any full references.
Again, compared to the standard literature using an unequal variance version, should make it more robust than tukey-hsd based versions.
Disadvantage is that it works based on rejection decision and does not provide p-values, as was the case in most of the older multiple testing literature.
The mentioned SAS reference is likely related to https://documentation.sas.com/doc/en/statug/latest/statug_glm_details29.htm section on Multiple-Stage Tests, last part is REGWQ step-down method (option in GLM MEANS)
Activity
josef-pkt commentedon Jan 24, 2025
most likely old fashioned and outdated
unit test module test_pairwise
Why are we working with strings as binary? like
b'physical', b'medical', b'mental'Most likely because of string encoding problems in ancient numpy (and python 2)
I guess we can switch to default unicode strings.
josef-pkt commentedon Jan 26, 2025
studentized range distribution
we need a single access function with choice between scipy and tables/qsturng, and possible the mvt brute force integration in
tukey_pvaluesWe don't have critical values based on brute force integration, not needed for tukey, but for other comparisons like Dunnett's test)
Tables are still needed for performance #9476 .
also #5046