depictr.interaction_plot#

depictr.interaction_plot(model, x, group, conf_level=0.95, n=100, band=True, title=None)#

Predicted response across x for each level of a categorical group.

One coloured line per group shows how the predicted response changes with x within that group, so a fan of non-parallel lines is the visible mark of an interaction. The remaining predictors are held at their mean (numeric) or reference level (categorical).

Parameters:
  • model (statsmodels results object) – A fitted OLS/GLM result from a formula and a DataFrame.

  • x (str) – The numeric predictor on the x-axis.

  • group (str) – The categorical predictor whose levels are drawn as separate lines.

  • conf_level (float) – Confidence level for the bands.

  • n (int) – Number of points across the x range, per group.

  • band (bool) – Whether to draw a confidence ribbon behind each line.

  • title (str, optional) – Plot title.

Return type:

plotnine.ggplot