glambox.plots

plot_behaviour_aggregate(bar_data, line_data=None, line_labels=None, fontsize=7, value_bins=7, gaze_bins=7, limits={'corrected_p_choose_best': (-1, 1), 'p_choose_best': (0, 1), 'rt': (0, None)})

Create a group-level aggregate plot with the following four metrics: A) RT ~ (max value - max value others) B) P(choose best) ~ (item value - max value others) C) P(choose best) ~ (item gaze - max gaze others) D) Corrected P(choose best) ~ (item gaze - max gaze others) For further details on these measures, see the manuscript

Parameters
  • bar_data (pandas.DataFrame) – response data to plot as bars

  • line_data (list of pandas.DataFrames, optional) – response data to plot as colored lines

  • line_labels (array_like, strings, optional) – legend labels for line_data

  • fontsize (int, optional) – fontsize for plotting, defaults to 7

  • value_bins (int or array_like, optional) – x-axis bins for panels A - B if an int is given, this many bins will be created, defaults to 7

  • gaze_bins (int or array_like, optional) – x-axis bins for panels A - B if an int is given, this many bins will be created, defaults to 7

  • limits (dict, optional) – dict containing one entry for: [‘rt’, ‘p_choose_best’, ‘corrected_p_choose_best’] each entry is a tuple, defining the y-limits for the respective metrics

Returns

matplotlib figure and axes object

Return type

Tuple

plot_behaviour_associations(data, nbins=20, fontsize=7, regression=True, annotate=True, figsize=(7.086614173228346, 2.7559055118110236), limits={'gaze_influence': (None, None), 'p_choose_best': (0, 1), 'rt': (0, None)})

Plot individual differences on the following three panels: D) p(choose best) ~ response time E) gaze influence score ~ response time F) gaze influence score ~ p(choose best)

In addition to each correlation plot, distributions of the three underlying behavioural measures are given in panels A-C: A) Response time B) P(choose best) C) Gaze influence score

For further details on these measures, see the manuscript

Parameters
  • data (pandas.DataFrame) – response data

  • nbins (int, optional) – defining the number of bins to use for the marginal histograms

  • fontsize (int, optional) – defining the plotting fontsize, defaults to 7

  • regression (bool, optional) – whether to compute and plot a linear regression fit, defaults to True

  • annotate (bool, optional) – whether to add pearson’s r correlation coefficient and p-value to plot, defaults to True

  • figsize (tuple, optional) – size of of plotting figure

  • limits (dict, optional) – dict containing one entry for: [‘rt’, ‘p_choose_best’, ‘corrected_p_choose_best’] each entry is a tuple, defining the y-limits for the respective metrics

Returns

matplotlib figure object, axs

Return type

Tuple

plot_individual_fit(observed, predictions, prediction_labels=None, colors=None, fontsize=7, alpha=1.0, figsize=None, limits={'gaze_influence': (None, None), 'p_choose_best': (0, 1), 'rt': (0, None)})

Plot individual observed vs predicted data on three metrics: A) response time B) p(choose best) C) gaze influence score For details on these measures, see the manuscript

Parameters
  • observed (pandas.DataFrame) – observed response data

  • predictions (list of pandas.DataFrame) – predicted response datasets

  • prediction_labels (array_like, strings, optional) – legend labels for predictions

  • colors (array_like, strings, optional) – colors to use for predictions

  • fontsize (int, optional) – plotting fontsize

  • alpha (float, optional) – alpha level for predictions should be between [0,1]

  • figsize (tuple, optional) – matplotlib figure size

  • limits (dict, optional) – dict containing one entry for: [‘rt’, ‘p_choose_best’, ‘corrected_p_choose_best’] each entry is a tuple, defining the y-limits for the respective metrics

Returns

matplotlib figure object, axs

Return type

Tuple

compare_parameters(model, parameters=['v', 's', 'gamma', 'tau'], comparisons=None, **kwargs)

Plot posterior distributions of parameters and differences between groups or conditions.

Parameters
  • model (glambox.GLAM instance) – A fitted GLAM instance.

  • parameters (list of str, optional) – A list of parameters to be plotted. Defaults to all model parameters.

  • comparisons (List of tuples, optional) – List of pairwise comparisons between groups or conditions to be plotted. Each comparison must be given as a tuple of two conditions (e.g., [(‘A’, ‘B’), (‘A’, ‘C’)])

Returns

matplotlib figure object, axs

Return type

Tuple

traceplot(trace, varnames='all', combine_chains=False, ref_val={})

A traceplot replacement, because arviz is broken. This is tested for traces that come out of individual and hierarchical GLAM fits.

Parameters
  • trace (PyMC.MultiTrace)) – a trace object.

  • varnames (str, optional) – list of variables to include

  • combine_chains (bool, optional) – toggle concatenation of chains.

  • ref_val (dict, optional)) – reference values per parameter.

Returns

matplotlib figure and axes objects

Return type

Tuple