plot_forest()

Contents

plot_forest()#

liesel_gam.plot_forest(term, samples, newdata=None, labels=None, ymin='hdi_low', ymax='hdi_high', ci_quantiles=(0.05, 0.95), hdi_prob=0.9, show_unobserved=True, highlight_unobserved=True, unobserved_color='red', indices=None)[source]#

Forest plot summary of a linear or discrete effect.

Parameters:
  • term (RITerm | MRFTerm | LinTerm | StrctLinTerm) – 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) – If the plotted term is a linear term, this is ignored. Otherwise, dictionary of covariate data at which to plot the term. If None, plots the term for the unique clusters known to the term.

  • labels (CategoryMapping | None, default: None) – If the plotted term is a linear term, this is ignored. Otherwise, custom mapping to use for mapping between string labels and integer codes.

  • ymin (str, default: 'hdi_low') – Which quantities to use for the plotted interval.

  • ymax (str, default: 'hdi_high') – Which quantities to use for the plotted interval.

  • ci_quantiles (tuple[float, float], default: (0.05, 0.95)) – Probability levels that should be available for selection in ymin, ymax. For example, if ci_quantiles=(0.05, 0.95), you can select ymin="q_0.05.

  • hdi_prob (float, default: 0.9) – The probability level to use if ymin,max are "hdi_low", "hdi_high".

  • show_unobserved (bool, default: True) – If the plotted term is a linear term, this is ignored. Otherwise, if True, clusters without observations are included, and if False, they are not included.

  • highlight_unobserved (bool, default: True) – If the plotted term is a linear term, this is ignored. Otherwise, if True, unobserved clusters are marked by a cross of color unobserved_color.

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

  • indices (Sequence[int] | None, default: None) – Sequence of integers, selects coefficients or clusters to be included in the plot. If None, all coefficients/clusters are plotted.

Return type:

ggplot