Skip to main content
. Author manuscript; available in PMC: 2012 Jun 15.
Published in final edited form as: Neuroimage. 2011 Mar 21;56(4):1929–1945. doi: 10.1016/j.neuroimage.2011.03.032

Algorithm 1.

The V B pseudocode

Input: Multichannel EEG data Xk (k = 1, 2) that are recorded from two experimental conditions
Output: The variational distributions q*(Zk), q*(A), q*(α), q*([Λk(i)]1),q*(Ψk1)
Initialization: Use the settings in (14), and set iter = 0, ℒ(0) = −inf, u(m)=υ(m)=ek(m)=fk(m)=gk(c)=hk(c)=108 (c = 1, …, C; k = 1, 2; m = 1, …, M)
Method:
repeat
    iter = iter + 1
    Update the parameters in the variational distributions using (7) – (12)
    if (iter mod 100) = 0 then
      Compute {ek(m),fk(m)}k=1,2;m=1,,M by solving (13)
    end if
    Compute the variational lower bound ℒ(iter) using (19)
until ℒ(iter) − ℒ (iter − 1) ≤ a pre-defined threshold (e.g., 10−8)