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
a case for pairwise variances in pairwise comparisons (run t_test on pairs)
Franz, Volker H., and Geoffrey R. Loftus. 2012. “Standard Errors and Confidence Intervals in Within-subjects Designs: Generalizing Loftus and Masson (1994) and Avoiding the Biases of Alternative Accounts.” Psychonomic Bulletin & Review 19 (3) (June 1): 395–404. doi:10.3758/s13423-012-0230-1.
So Josef, what the results class looks like for the tukeyhsd() function is very much up to you. I have, out of necessity, added a few attrs that allow the hochberg intervals to be calculated and consolidated the returned variables to be part of the MultiComparison class itself, but not done a lot else.
As for the 'AllPairsResults' class, it might be very useful for performing p-tests of multiple groups, but not so much for Tukey. I honestly don't know enough about statistical testing to really know how best to organize and structure this whole module, so I would gladly accept suggestions or changes from you on that front.
My purpose has been to clean up the usage and output of the tukeyhsd method, and to create a matplotlib figure of the tukey results with single confidence intervals. As i mentioned on your blog, I'm anticipating the general use case to be:
fromstatsmodels.stats.multcompimportMultiComparisondata=some_numpy_vector_of_rawdatalabels=some_numpy_vector_of_groupsmc=MultiComparison(data, labels) # all tukey computations can be made on mc instanceresults_string=mc.tukeyhsd() # can print table if you wantfig=mc.plot_tukey_intervals(groupname_to_compare_against)
I'm not really sure what the purpose and use case of statsmodels.stats.multicomp.pairwise_tukey is -- it's just a wrapper for MultiComp.tukeyhsd() but I guess it doesn't require you to instantiate a MultiComparison instance. But then again, that could just be solved by making tukeyhsd() a classmethod...either way I think the usage in my example should be preferred, so that the MultiComparison object is created and later computations/plotting can be done using it.
I'm going to start merging my wrapper class with the statsmodels MultiComparsion class today, will reference this issue. I'm happy for you to reorganize it however you like, I am just psyched about the tukey plotting functionality.
@josef-pkt, how is this looking to you? Are you ok with the general structure of things?
The only issues I would raise with this implementation are the way in which the outputs of tukeyhsd() are stored within the MultiComparison instance. They're a little hard to get at unless you know precisely what attribute names you're looking for, or are comfortable with a little introspection.
the purpose and use case of statsmodels.stats.multicomp.pairwise_tukey
two reasons I added this: one is that users have a function instead of working with a class (scipy style), the second is that it is the only part that has verified unit tests, so I was reluctant to advertise the full class
You could open a pull request against statsmodels master. I will go over the details but my first impression is that it looks good. Since it's in the sandbox, we can merge it even if we reorganize later.
(Two things I saw: numpy docstandard for docstrings, and my guess is plot_hochberg needs a more explicit name to signal it's on multicomparison of means)
my current AllPairsResult is so far only for p-value correction, it doesn't have information about means, and confidence intervals. So there need to be expansion there to be able to present results like TukeyHSD.
Also, if you think that MultiComparison is usable, then we can start to move it out of the sandbox.
I can manage the statistics part and know reasonably well where I would like to be general to expand into other areas of multiple comparisons, but I really appreciate the help with the user interface and additional functions like plots, and the feedback from someone who used similar functions before.
One additional result: based on some SPSS examples, I looked at "homogenous subset", looking at the cases where the pairwise difference is not rejected and put them in sets. I have a function somewhere but it's not exposed and doesn't have any corresponding plot. (IIRC)
Sorry, I just saw now some of your earlier messages. I'm using internet explorer today and it doesn't seem to auto-update.
The only issues I would raise with this implementation are the way in which the outputs of tukeyhsd() are stored within the MultiComparison instance. They're a little hard to get at unless you know precisely what attribute names you're looking for, or are comfortable with a little introspection.
Then a Results class that collects all relevant attributes and methods will really be better, and we can have a nice __str__ for printing the full results, besides the plot.
Leave pairwise_tukey in multicomp to allow different workflows. I suggest changing the docs to reflect the use cases.
Move MultiComparison out of the sandbox and into statsmodels.stats.multicomp. I think it's usable.
Either expand AllPairsResult to be more general for Tukey usage, or create my own Results class for specific Tukey applications. I would be happy to do the latter, but the former should really be done by you as I don't have any clue what else AllPairsResult is being used for. I will start on my own Results class, can merge later.
More explicit name for plot_hochberg
Happy to help, will make pull request later today or tomorrow.
My suggestion for the next step, (forget about any generalized results classes.)
Start a new class in sandbox.muticomp TukeyHSDResults, instantiate it in the tukey method, and attach all necessary attributes to the result instance, move the current string to a TukeyHSDResults.summary method. Plot might also fit better into the results class.
(We might need to attach any necessary information about the group instance, or keep a reference to the MultiComparison instance).
return the results instance in the tukey method of MultiComparison
This way users have all results nicely together.
(And I worry about code reuse later, since that will be mainly internal reorganization or introducing inheritance.)
Activity
josef-pkt commentedon Apr 25, 2013
a case for pairwise variances in pairwise comparisons (run t_test on pairs)
Franz, Volker H., and Geoffrey R. Loftus. 2012. “Standard Errors and Confidence Intervals in Within-subjects Designs: Generalizing Loftus and Masson (1994) and Avoiding the Biases of Alternative Accounts.” Psychonomic Bulletin & Review 19 (3) (June 1): 395–404. doi:10.3758/s13423-012-0230-1.
tyleha commentedon Apr 25, 2013
So Josef, what the results class looks like for the
tukeyhsd()function is very much up to you. I have, out of necessity, added a few attrs that allow the hochberg intervals to be calculated and consolidated the returned variables to be part of theMultiComparisonclass itself, but not done a lot else.As for the 'AllPairsResults' class, it might be very useful for performing p-tests of multiple groups, but not so much for Tukey. I honestly don't know enough about statistical testing to really know how best to organize and structure this whole module, so I would gladly accept suggestions or changes from you on that front.
My purpose has been to clean up the usage and output of the tukeyhsd method, and to create a matplotlib figure of the tukey results with single confidence intervals. As i mentioned on your blog, I'm anticipating the general use case to be:
I'm not really sure what the purpose and use case of
statsmodels.stats.multicomp.pairwise_tukeyis -- it's just a wrapper forMultiComp.tukeyhsd()but I guess it doesn't require you to instantiate a MultiComparison instance. But then again, that could just be solved by makingtukeyhsd()a classmethod...either way I think the usage in my example should be preferred, so that the MultiComparison object is created and later computations/plotting can be done using it.I'm going to start merging my wrapper class with the statsmodels
MultiComparsionclass today, will reference this issue. I'm happy for you to reorganize it however you like, I am just psyched about the tukey plotting functionality.Added attributes to MultiComparison init to allow later hochberg inte…
adding matplotlib function for hochberg intervals, importing matplotl…
issue statsmodels#789, typo with old _group_rmse name
issue statsmodels#789, incorrect res index calling fixed. Tested on m…
tyleha commentedon Apr 25, 2013
@josef-pkt, how is this looking to you? Are you ok with the general structure of things?
The only issues I would raise with this implementation are the way in which the outputs of
tukeyhsd()are stored within the MultiComparison instance. They're a little hard to get at unless you know precisely what attribute names you're looking for, or are comfortable with a little introspection.tyleha commentedon Apr 25, 2013
If it's helpful, here's a basic dataset that shows off the functionality of
MultiComparison.plot_tukeyhsd_intervalsjosef-pkt commentedon Apr 25, 2013
two reasons I added this: one is that users have a function instead of working with a class (scipy style), the second is that it is the only part that has verified unit tests, so I was reluctant to advertise the full class
You could open a pull request against statsmodels master. I will go over the details but my first impression is that it looks good. Since it's in the sandbox, we can merge it even if we reorganize later.
(Two things I saw: numpy docstandard for docstrings, and my guess is plot_hochberg needs a more explicit name to signal it's on multicomparison of means)
my current AllPairsResult is so far only for p-value correction, it doesn't have information about means, and confidence intervals. So there need to be expansion there to be able to present results like TukeyHSD.
Also, if you think that
MultiComparisonis usable, then we can start to move it out of the sandbox.I can manage the statistics part and know reasonably well where I would like to be general to expand into other areas of multiple comparisons, but I really appreciate the help with the user interface and additional functions like plots, and the feedback from someone who used similar functions before.
One additional result: based on some SPSS examples, I looked at "homogenous subset", looking at the cases where the pairwise difference is not rejected and put them in sets. I have a function somewhere but it's not exposed and doesn't have any corresponding plot. (IIRC)
josef-pkt commentedon Apr 25, 2013
Sorry, I just saw now some of your earlier messages. I'm using internet explorer today and it doesn't seem to auto-update.
Then a Results class that collects all relevant attributes and methods will really be better, and we can have a nice
__str__for printing the full results, besides the plot.josef-pkt commentedon Apr 25, 2013
Oh, and github is slow in notification, because I'm receiving 2000 scipy tickets that are being moved to github.
jseabold commentedon Apr 25, 2013
It's not just you...oops
https://status.github.com/
tyleha commentedon Apr 25, 2013
Ok. So it sounds like:
pairwise_tukeyin multicomp to allow different workflows. I suggest changing the docs to reflect the use cases.MultiComparisonout of the sandbox and intostatsmodels.stats.multicomp. I think it's usable.AllPairsResultto be more general for Tukey usage, or create my own Results class for specific Tukey applications. I would be happy to do the latter, but the former should really be done by you as I don't have any clue what elseAllPairsResultis being used for. I will start on my own Results class, can merge later.plot_hochbergHappy to help, will make pull request later today or tomorrow.
josef-pkt commentedon Apr 25, 2013
My suggestion for the next step, (forget about any generalized results classes.)
Start a new class in sandbox.muticomp
TukeyHSDResults, instantiate it in the tukey method, and attach all necessary attributes to the result instance, move the current string to a TukeyHSDResults.summary method. Plot might also fit better into the results class.(We might need to attach any necessary information about the group instance, or keep a reference to the
MultiComparisoninstance).return the results instance in the tukey method of
MultiComparisonThis way users have all results nicely together.
(And I worry about code reuse later, since that will be mainly internal reorganization or introducing inheritance.)
fixed inaccurate color coding for fully overlapping intervals, zero c…
7 remaining items
issue statsmodels#789, incorrect res index calling fixed. Tested on m…
fixed inaccurate color coding for fully overlapping intervals, zero c…
oops, now actually have zero cases issue statsmodels#789
moved hochberg computations & plotting to TukeyHSDResults class issue s…
cleaned up TukeyHSDResults class, modified function names to be somew…
Added attributes to MultiComparison init to allow later hochberg inte…
adding matplotlib function for hochberg intervals, importing matplotl…
issue statsmodels#789, typo with old _group_rmse name
issue statsmodels#789, incorrect res index calling fixed. Tested on m…
fixed inaccurate color coding for fully overlapping intervals, zero c…
oops, now actually have zero cases issue statsmodels#789
moved hochberg computations & plotting to TukeyHSDResults class issue s…
cleaned up TukeyHSDResults class, modified function names to be somew…
Merge pull request statsmodels#849 from josef-pkt/tyler_tukeyhsd_rebased