plot_regions()

Contents

plot_regions()#

liesel_gam.plot_regions(term, samples, newdata=None, which='mean', polys=None, labels=None, quantiles=(0.05, 0.5, 0.95), hdi_prob=0.9, show_unobserved=True, observed_color='none', unobserved_color='red')[source]#

Plot a summary map of a discrete spatial effect.

Supports effects represented by RITerm or MRFTerm.

Parameters:
  • term (RITerm | MRFTerm | 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) – Dictionary of covariate data at which to plot the term. If None, plots the term for the unique regions known to the term.

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

  • polys (Mapping[str, Array | ndarray | bool | number | bool | int | float | complex] | None, default: None) – If None, tries to use MRFTerm.polygons. Dictionary of arrays. The keys of the dict are the region labels. The corresponding values define the region by defining polygons. The neighborhood structure can be inferred from this polygon information.

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

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

  • show_unobserved (bool, default: True) – If show_unobserved=True, then all regions will be plotted with color based on the column named in which. If show_unobserved=False, color filling will be applied only to observed regions.

  • observed_color (str, default: 'none') – Border color for observed regions.

  • unobserved_color (str, default: 'red') – Border color for unobserved regions.

Return type:

ggplot