format long;
clear;
load EQRIX_data.mat  
Xt=TailRisk(:,1); % EQRIX from 1996:01 to 2010:12
    
%% the high-low tail risk concern month

aaa = sort(Xt(1:end), 'descend');
STATES=zeros(DataSize,1);
for i=1:DataSize
    if Xt(i)<aaa(DataSize/2-2) %note that aaa(89:94) are the same, so we cannot use aaa(DataSize/2)=aaa(90) to determine regime, instead, we use aaa(88)
        STATES(i)=0;
    else
        STATES(i)=1;
    end
end

save('Para_EQRIX.mat','STATES');

