Skip to main content
Social Sci LibreTexts

6.11: Exercise - Combining Bins

  • Page ID
    108211
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    In the previous exercise, we took our original Rare and Frequent epochs and subdivided them according to whether the previous trial was Rare or Frequent, yielding four bins instead of two. We should be able to reconstruct our original two bins from the four new bins. However, there is a little trick that you need to know about.

    Let’s start by thinking about how to reconstruct the original Rare bin, in which the preceding trial could be either Rare or Frequent. We could simply take Bin 1 (Rare preceded by Rare) and average it with Bin 2 (Rare preceded by Frequent). In ERP Bin Operations, we could implement this with the following equation:

    bin5 = (bin1 + bin2) / 2 Label Rare preceded by Rare or Frequent

    However, this would not give us the same waveforms that we obtained in our original analysis that disregarded whether the previous trial was Rare or Frequent. Can you figure out why?

    The reason is that this equation gives Bins 1 and 2 equal weight in the new bin, but there were 6 trials with Bin 1 and 22 trials with Bin 2 (which you can see by typing ERP.ntrials in the Matlab Command Window). The equation above assumes that there were equal numbers of trials in each bin. To give each trial equal weight (which is what happened when the identity of the previous trial was disregarded by BINLISTER), we would need the following equation in ERP Bin Operations:

    bin5 = (6*bin1 + 22*bin2) / 28 Label Rare preceded by Rare or Frequent

    However, the exact equation would depend on how many trials were in Bins 1 and 2, which might vary across participants. To make this easier, ERP Bin Operations contains a function called wavgbin for performing weighted averaging, in which each bin is automatically weighted by the number of trials.

    Let’s see how these different methods of averaging work. Make sure that the dataset from the previous exercise is loaded (12_P3_Sequential). Select EEGLAB > ERPLAB > ERP Operations, ERP Bin Operations. In the equations panel, clear out any previous equations and enter the three following equations:

    bin5 = (bin1 + bin2) / 2 Label Rare preceded by Rare or Frequent, equal weight

    bin6 = (6*bin1 + 22*bin2) / 28 Label Rare preceded by Rare or Frequent, manually weighted

    bin7 = wavgbin(bin1, bin2) Label Rare preceded by Rare or Frequent, automatically weighted

    Make sure that the Mode is set to Modify existing ERPset, because we’re going to add these three bins to the four existing bins. Then click RUN.

    Now plot Bins 5, 6, and 7. You can’t actually see the waveforms for Bin 6, because it’s identical to Bin 7, and the Bin 7 waveform exactly covers up the Bin 6 waveform. This shows that the wavgbin function is working properly. However, the P3b is slightly larger for these bins than for Bin 5. Why is that? You should be able to figure it out given what you know about the amplitude of the P3b in Bins 1 and 2 and the nature of the equations used for Bins 5, 6, and 7.

    An obvious question is whether you should use unweighted averaging (as in Bin 5) or weighted averaging (as in Bins 6 and 7) when combining bins together. There isn’t a single answer to this question. If you’re trying to create something equivalent to what you would have gotten if you hadn’t subdivided the trials to begin with, then you’ll want to use weighted averaging. But beyond that, the answer will depend on the logic of your experimental design and your scientific questions.


    This page titled 6.11: Exercise - Combining Bins is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Steven J Luck directly on the LibreTexts platform.

    • Was this article helpful?