Mixture model analysis of analogue report data (Bays et al., *Journal of Vision*, 2009)

In 2008, Zhang & Luck proposed that errors in visual working memory continuous report tasks could be described by a mixture of two kinds of response: (1) those with von Mises distributed error centred on the correct answer, and (2) uniformly-distributed random guesses. On this basis they argued for a fixed limit on the number of items that can be stored at one time. However, our work (Bays et al., 2009) subsequently revealed that a large proportion of the responses Zhang & Luck had described as random guesses were in fact "swap" errors: responses based on one of the items in the memory array other than the one that was probed. To demonstrate this, we added a third component to the mixture model: (3) responses with von Mises distributed error centred on each of the other feature values in the display. We showed that, once these swap errors were taken into account, the estimated frequency of guessing was greatly reduced, and inconsistent with a fixed item limit of any size. The code made available here can be used to fit the two- or three-component mixture model to recall data.

Trial-by-trial estimates of mixture component probabilities (Schneegans & Bays, *Cortex*, 2016)

This code is a simple extension to the mixture model fitting code described above: it returns a posterior estimate for each trial of how likely the response is to have come from each of the three mixture components (i.e. to be an on-target response, a random guess or a swap).

Neural resource model of perception and working memory (Bays, *Journal of Neuroscience*, 2014)

The Zhang & Luck (2008) model (and by extension the Bays et al., 2009 model) assumed that non-swap responses were either von Mises or uniformly distributed. However, this assumption, and in particular the choice of a von Mises distribution, is not grounded in knowledge of the underlying neural system. In 2014, I proposed a new model based on the way in which information about simple visual features is encoded in populations of neurons. I showed (Bays, 2014) that this neural resource model provides a substantially better fit to recall data than a model based on a fixed item limit (Zhang & Luck's "slot+averaging" model). Subsequent work (Schneegans & Bays, 2017) has shown that, when extended to both the report and probe features of a task, the model also accurately predicts the presence and frequency of swap errors. Bays (2016) showed that, in addition to working memory, the model can be used to predict perceptual errors when visual contrast is low. The code presented here can be used to fit the Bays (2014) model, including swap errors, to continuous report data.

Non-parametric (NP) estimation of swap errors in analogue report (Bays, *Scientific Reports*, 2016)

Both of the methods described above, when used to estimate the frequency of swap (i.e. non-target report) errors, rely on fitting models of the recall process to data. Although some models fit the data better than others, the question of which is the correct model remains controversial. Critically, if the model of recall is wrong, swap estimates will also be incorrect. Bays (2016) presented a set of model-agnostic non-parametric methods that could estimate swap frequency and other parameters of the data without assuming any particular model of how responses are generated, and without a fitting procedure. The code made available here can be used to estimate swap frequency and also to reveal the underlying distribution of responses that would be obtained in the absence of swap errors.