plot_1d_smooth_clustered()

plot_1d_smooth_clustered()#

liesel_gam.plot_1d_smooth_clustered(clustered_term, samples, newdata=None, labels=None, color_scale='viridis', ngrid=20, newdata_meshgrid=False)[source]#

Plots a clustered smooth or linear function.

For effects as those returned by TermBuilder.rs().

Parameters:
  • clustered_term (Var) – The term to plot. Must be a weak liesel.model.Var with named inputs "x" (the function) and "cluster" (the cluster).

  • samples (dict[str, Array | ndarray | bool | number | bool | int | float | complex]) – Dictionary of posterior samples. Must contain samples for the term’s coefficient.

  • newdata (None | dict[str, Array | ndarray | bool | number | bool | int | float | complex], default: None) – Dictionary of covariate data at which to plot the term. If None, plots the term for the unique clusters known to the term, and uses a grid of length ngrid between the minimum and maximum observed value in the clustered function’s covariate.

  • labels (CategoryMapping | None, default: None) – Custom mapping to use for mapping between string labels and integer codes.

  • ngrid (int, default: 20) – Number of covariate values in the grid used for plotting, if newdata=None.

  • newdata_meshgrid (bool, default: False) – If True, then the function will create a large grid of all combinations of covariate values in newdata that correspond to this term.