This code is an extension to a function we released previously for fitting a mixture model  to errors on working memory tasks. The new method is described in . The MATLAB code can be downloaded here [zip].
This code is released under a GNU General Public License: feel free to use and adapt these functions as you like, but credit should be given if they contribute to your work, by citing:
Schneegans S & Bays PM. No fixed item limit in visuospatial working memory. Cortex 83: 181-193 (2016)
If you refer to this code directly, please also include the URL of this webpage, or my homepage bayslab.com.
The new CO16_fit function operates identically to the previous JV10_fit function (described here) except it returns an additional output W:
[B LL W] = CO16_fit(X, T, NT)
W is an (n×3) matrix of trial-by-trial posterior probabilities that responses are drawn from each of the three mixture components. Each row corresponds to a separate trial and is of the form [wT wN wU], corresponding to the probability that the response on that trial came from the target, non-target or uniform response distributions, respectively.