pingouin.plot_shift

pingouin.plot_shift(x, y, n_boot=1000, percentiles=array([10, 20, 30, 40, 50, 60, 70, 80, 90]), ci=0.95, seed=None, show_median=True, violin=True)[source]

Shift plot.

The shift plot is described in Rousselet, Pernet and Wilcox (2017).

Parameters
x, yarray_like

First and second set of observations. x and y must be independent.

n_bootint

Number of bootstrap iterations. The higher, the better, the slower.

percentiles: array_like

Sequence of percentiles to compute, which must be between 0 and 100 inclusive. Default set to [10, 20, 30, 40, 50, 60, 70, 80, 90].

ci: float

Confidence level (0.95 = 95%).

seedint or None

Random seed for generating bootstrap samples, can be integer or None (default).

show_median: boolean

If True, show the median with black lines. Defaut set to True.

violin: boolean

If True, plot the density of X and Y distributions. Defaut set to True.

Returns
figmatplotlib Figure instance

Matplotlib Figure. To get the individual axes, use fig.axes.

Notes

This function will estimate the bootstrap CI for the percentile difference between x (fixed) and y (resampled). Note that if \(N\) is small, the CI of x -> y and y -> x can vary.

Warning

The current implementation of this function is a simplified (beta) version of the original R/Matlab function. Expect important changes in this function in future releases of Pingouin.

References

1

Rousselet, G. A., Pernet, C. R. and Wilcox, R. R. (2017). Beyond differences in means: robust graphical methods to compare two groups in neuroscience. Eur J Neurosci, 46: 1738-1748. doi:10.1111/ejn.13610

2

https://garstats.wordpress.com/2016/07/12/shift-function/

Examples

Default shift plot

>>> import numpy as np
>>> import pingouin as pg
>>> np.random.seed(42)
>>> x = np.random.normal(5.5, 2, 50)
>>> y = np.random.normal(6, 1.5, 50)
>>> fig = pg.plot_shift(x, y)
../_images/pingouin-plot_shift-1.png

With different options

>>> import numpy as np
>>> import pingouin as pg
>>> np.random.seed(42)
>>> x = np.random.normal(5.5, 2, 50)
>>> y = np.random.normal(6, 1.5, 50)
>>> fig = pg.plot_shift(x, y, n_boot=2000, percentiles=[5, 55, 95],
...                     show_median=False, seed=456, violin=False)
../_images/pingouin-plot_shift-2.png