summarise_1d_smooth_clustered()

summarise_1d_smooth_clustered()#

liesel_gam.summarise_1d_smooth_clustered(clustered_term, samples, newdata=None, which='mean', quantiles=(0.05, 0.5, 0.95), hdi_prob=0.9, labels=None, ngrid=20, newdata_meshgrid=False)[source]#

Summarises a clustered smooth or linear function.

Intended for terms, as 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 (Mapping[str, Array | ndarray | bool | number | bool | int | float | complex]) – Dictionary of posterior samples. Must contain samples for the term’s coefficient.

  • newdata (Mapping[str, Array | ndarray | bool | number | bool | int | float | complex] | None, 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.

  • which (Literal['mean', 'sd', 'var', 'hdi_low', 'hdi_high', 'q_0.05', 'q_0.5', 'q_0.95'] | Sequence[Literal['mean', 'sd', 'var', 'hdi_low', 'hdi_high', 'q_0.05', 'q_0.5', 'q_0.95']], default: 'mean') – Sequence of strings, indicating the summary quantities to include.

  • quantiles (Sequence[float], default: (0.05, 0.5, 0.95)) – Probability levels of quantiles to include.

  • hdi_prob (float, default: 0.9) – Probability level for highest posterior density interval.

  • labels (CategoryMapping | None | Sequence[str], 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.