TukeyHSDResults.plot_simultaneous()

statsmodels.sandbox.stats.multicomp.TukeyHSDResults.plot_simultaneous

TukeyHSDResults.plot_simultaneous(comparison_name=None, ax=None, figsize=(10, 6), xlabel=None, ylabel=None) [source]

Plot a universal confidence interval of each group mean

Visiualize significant differences in a plot with one confidence interval per group instead of all pairwise confidence intervals.

Parameters:

comparison_name : string, optional

if provided, plot_intervals will color code all groups that are significantly different from the comparison_name red, and will color code insignificant groups gray. Otherwise, all intervals will just be plotted in black.

ax : matplotlib axis, optional

An axis handle on which to attach the plot.

figsize : tuple, optional

tuple for the size of the figure generated

xlabel : string, optional

Name to be displayed on x axis

ylabel : string, optional

Name to be displayed on y axis

Returns:

fig : Matplotlib Figure object

handle to figure object containing interval plots

Notes

Multiple comparison tests are nice, but lack a good way to be visualized. If you have, say, 6 groups, showing a graph of the means between each group will require 15 confidence intervals. Instead, we can visualize inter-group differences with a single interval for each group mean. Hochberg et al. [1] first proposed this idea and used Tukey?s Q critical value to compute the interval widths. Unlike plotting the differences in the means and their respective confidence intervals, any two pairs can be compared for significance by looking for overlap.

References

[R18] Hochberg, Y., and A. C. Tamhane. Multiple Comparison Procedures. Hoboken, NJ: John Wiley & Sons, 1987.

Examples

>>> from statsmodels.examples.try_tukey_hsd import cylinders, cyl_labels
>>> from statsmodels.stats.multicomp import MultiComparison
>>> cardata = MultiComparison(cylinders, cyl_labels)
>>> results = cardata.tukeyhsd()
>>> results.plot_simultaneous()
<matplotlib.figure.Figure at 0x...>

This example shows an example plot comparing significant differences in group means. Significant differences at the alpha=0.05 level can be identified by intervals that do not overlap (i.e. USA vs Japan, USA vs Germany).

>>> results.plot_simultaneous(comparison_name="USA")
<matplotlib.figure.Figure at 0x...>

Optionally provide one of the group names to color code the plot to highlight group means different from comparison_name.

doc_statsmodels
2017-01-18 16:21:27
Comments
Leave a Comment

Please login to continue.