statsmodels.stats.power.TTestPower.plot_power

TTestPower.plot_power(dep_var='nobs', nobs=None, effect_size=None, alpha=0.05, ax=None, title=None, plt_kwds=None, **kwds)

plot power with number of observations or effect size on x-axis

Parameters:
  • dep_var (string in ['nobs', 'effect_size', 'alpha']) – This specifies which variable is used for the horizontal axis. If dep_var=’nobs’ (default), then one curve is created for each value of effect_size. If dep_var=’effect_size’ or alpha, then one curve is created for each value of nobs.
  • nobs (scalar or array_like) – specifies the values of the number of observations in the plot
  • effect_size (scalar or array_like) – specifies the values of the effect_size in the plot
  • alpha (float or array_like) – The significance level (type I error) used in the power calculation. Can only be more than a scalar, if dep_var='alpha'
  • ax (None or axis instance) – If ax is None, than a matplotlib figure is created. If ax is a matplotlib axis instance, then it is reused, and the plot elements are created with it.
  • title (string) – title for the axis. Use an empty string, '', to avoid a title.
  • plt_kwds (None or dict) – not used yet
  • kwds (optional keywords for power function) – These remaining keyword arguments are used as arguments to the power function. Many power function support alternative as a keyword argument, two-sample test support ratio.
Returns:

fig

Return type:

matplotlib figure instance

Notes

This works only for classes where the power method has effect_size, nobs and alpha as the first three arguments. If the second argument is nobs1, then the number of observations in the plot are those for the first sample. TODO: fix this for FTestPower and GofChisquarePower

TODO: maybe add line variable, if we want more than nobs and effectsize