You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH/SUMM ranked data regression, hypothesis test versus nonparametric, rank based test #6523
todo:
check kruskal in statsmodels.sandbox.stats.multicomp.MultiComparison again and see how far we can get with using standard methods with rank data.
#6960 reference to Vargha, András, and Harold D. Delaney. 2000
They compare tests for stochastic equality with Welch t-test and Welch Anova based on rank data.
main reference for those are articles by Zimmerman and Zumbo 1992, 1993
e.g. Vargha and Delaney mention that rank based t-test is equivalent to Mann-Whitney in large samples (asymptotically ?).
aside: fligner in scipy is a test on equality of variances or dispersion, not median like Fligner-Policello
Fligner-Policello is a rank test allowing for heteroscedasticity. (interpretation for median comparison relies on equal distribution except for shift. otherwise we only get stochastic equality as null)
#6960 is a good starting point for adding general rank based methods to statsmodels.stats.
for oneway anova, I added data transformation to get Levene, ... test for equality of variances or dispersion. That is implemented as general function that could take rank transformation i.e. rankdata from scipy.stats.
This assumes we want to convert each sample separately into ranks, it doesn't work for ranking in total sample.
I also read small parts of
Zimmerman, Donald W., and Bruno D. Zumbo. 1993. “Rank Transformations and the Power of the Student t Test and Welch t’ Test for Non-Normal Populations with Unequal Variances.” Canadian Journal of Experimental Psychology/Revue Canadienne de Psychologie Expérimentale 47 (3): 523–39. https://doi.org/10.1037/h0078850.
No formulas but a Monte Carlo, comparing t and welch-t on original data with t and welch-t on rank data
Welch-t works well with non-normal distribution, unequal sample sizes and unequal variances, maybe a bit liberal but better than the others in those cases.
aside:
when ranking in total sample, then it is more convenient to work in long format, i.e. stacked data plus groups indicator.
Main requirement for usability here is some function to transform to required ranks, and have the inference function using the same structure, i.e. list of arrays or stacked array plus groups.
I haven't checked yet:
We can replicate many standalone tests with regression/OLS (maybe without small sample adjustments)
The same will apply if we use ranks as data instead of the original data.
However, AFAIU, the rank transform will change the null hypothesis for arbitrary distributions.
i.e. we get something like P(x1 > x2) instead of mean(x1) = mean(x2) or median(x1) = median(x2) or trimmed_mean(x1) = trimmed_mean(x2)
e.g. are outliers outliers or part of the distribution.
H0: statistic(x1) = statistic(x2) but allowing for F(x) != G(x) where F is distribution of x1 and G is distribution of x2.
Activity
josef-pkt commentedon Aug 11, 2020
#6960 reference to Vargha, András, and Harold D. Delaney. 2000
They compare tests for stochastic equality with Welch t-test and Welch Anova based on rank data.
main reference for those are articles by Zimmerman and Zumbo 1992, 1993
e.g. Vargha and Delaney mention that rank based t-test is equivalent to Mann-Whitney in large samples (asymptotically ?).
aside:
flignerin scipy is a test on equality of variances or dispersion, not median like Fligner-PolicelloFligner-Policello is a rank test allowing for heteroscedasticity. (interpretation for median comparison relies on equal distribution except for shift. otherwise we only get stochastic equality as null)
#6960 is a good starting point for adding general rank based methods to statsmodels.stats.
josef-pkt commentedon Aug 16, 2020
starting point to look at it, I partially read Conover, Iman 1981a
e.g. they show that the test statistic of the standard t-test on ranked data is a nonlinear transformation of the MW rank test statistic.
Conover, W. J., and Ronald L. Iman. 1981a. “Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics.” The American Statistician 35 (3): 124–29. https://doi.org/10.2307/2683975.
———. 1981b. “[Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics]: Rejoinder.” The American Statistician 35 (3): 132–33. https://doi.org/10.2307/2683978.
Conover, W. Jay. 2012. “The Rank Transformation—an Easy and Intuitive Way to Connect Many Nonparametric Methods to Their Parametric Counterparts for Seamless Teaching Introductory Statistics Courses.” Wiley Interdisciplinary Reviews: Computational Statistics 4 (5): 432–438. https://doi.org/10.1002/wics.1216.
Fligner, Michael A. 1981. “[Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics]: Comment.” The American Statistician 35 (3): 131–32. https://doi.org/10.2307/2683977.
Noether, Gottfried E. 1981. “[Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics]: Comment.” The American Statistician 35 (3): 129–30. https://doi.org/10.2307/2683976.
for oneway anova, I added data transformation to get Levene, ... test for equality of variances or dispersion. That is implemented as general function that could take rank transformation i.e.
rankdatafrom scipy.stats.This assumes we want to convert each sample separately into ranks, it doesn't work for ranking in total sample.
I also read small parts of
Zimmerman, Donald W., and Bruno D. Zumbo. 1993. “Rank Transformations and the Power of the Student t Test and Welch t’ Test for Non-Normal Populations with Unequal Variances.” Canadian Journal of Experimental Psychology/Revue Canadienne de Psychologie Expérimentale 47 (3): 523–39. https://doi.org/10.1037/h0078850.
No formulas but a Monte Carlo, comparing t and welch-t on original data with t and welch-t on rank data
Welch-t works well with non-normal distribution, unequal sample sizes and unequal variances, maybe a bit liberal but better than the others in those cases.
aside:
when ranking in total sample, then it is more convenient to work in long format, i.e. stacked data plus groups indicator.
Main requirement for usability here is some function to transform to required ranks, and have the inference function using the same structure, i.e. list of arrays or stacked array plus groups.
I haven't checked yet:
We can replicate many standalone tests with regression/OLS (maybe without small sample adjustments)
The same will apply if we use ranks as data instead of the original data.
josef-pkt commentedon Aug 16, 2020
However, AFAIU, the rank transform will change the null hypothesis for arbitrary distributions.
i.e. we get something like P(x1 > x2) instead of mean(x1) = mean(x2) or median(x1) = median(x2) or trimmed_mean(x1) = trimmed_mean(x2)
e.g. are outliers outliers or part of the distribution.
H0: statistic(x1) = statistic(x2) but allowing for F(x) != G(x) where F is distribution of x1 and G is distribution of x2.