plot_2d_smooth()

Contents

plot_2d_smooth()#

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

Plots a posterior summary for a two-dimensional smooth function.

Parameters:
  • term (StrctInteractionTerm | StrctTensorProdTerm | StrctTerm) – The term to plot.

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

  • newdata (Position (dict[str, Any]) | None | Mapping[str, Array | ndarray | bool | number | bool | int | float | complex], default: None) – Optional dictionary of covariate data at which to plot the term. If None, a grid will be created internally, using the minimum and maximum observed values of this term’s input covariates. The ngrid argument refers to the number of grid elements used in the marginal grids, so the total grid length will be ngrid**k, where k is the number of terms.

  • 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') – Which quantities to plot. Can be a list of multiple values.

  • quantiles (Sequence[float], default: (0.05, 0.5, 0.95)) – Probability levels that should be available for selection in which. For example, if quantiles=0.5, you can select which="q_0.5.

  • hdi_prob (float, default: 0.9) – The probability level at which to include a highest posterior density interval if which contains "hdi".

  • 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.