load('/home/jph/Uni/masterarbeit/evaluation.mat')

%% compare methods of recording
% velocities
eegCorrKin=struct2array(correlations.EEG.kin);
emgCorrKin=struct2array(correlations.EMG.kin);
LFCorrKin=struct2array(correlations.LF.kin);

anova1([eegCorrKin,emgCorrKin,LFCorrKin],cat(1,zeros([15,1]),ones([6,1]),2*ones([15,1])))
xlabel('EEG - EMG - LF')
ylabel('correlation recorded - predicted')
title('ANOVA for EEG, EMG and LF')
anova1([eegCorrKin,emgCorrKin],cat(1,zeros([15,1]),ones([6,1])))
anova1([eegCorrKin,LFCorrKin],cat(1,zeros([15,1]),2*ones([15,1])))
anova1([emgCorrKin,LFCorrKin],cat(1,ones([6,1]),2*ones([15,1])))

% positions
eegCorrPos=struct2array(correlations.EEG.pos);
emgCorrPos=struct2array(correlations.EMG.pos);
LFCorrPos=struct2array(correlations.LF.pos);

anova1([eegCorrPos,emgCorrPos,LFCorrPos],cat(1,zeros([9,1]),ones([3,1]),2*ones([9,1])))
xlabel('EEG - EMG - LF')
ylabel('correlation recorded - predicted')
title('ANOVA for EEG, EMG and LF')
anova1([eegCorrPos,emgCorrPos],cat(1,zeros([9,1]),ones([3,1])))
anova1([eegCorrPos,LFCorrPos],cat(1,zeros([9,1]),2*ones([9,1])))
anova1([emgCorrPos,LFCorrPos],cat(1,ones([3,1]),2*ones([9,1])))

%% compare direct and via
%kin
direct=correlations.EEG.kin.Default;
viaAutoenc=correlations.EEG.kin.ViaAutoenc;
viaPCA=correlations.EEG.kin.ViaPCA;
viaNNMF=correlations.EEG.kin.ViaNNMF;

anova1([direct(:),viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'direct','Autoenc','PCA','NMF'})
ylabel('correlation recorded - predicted')
title('Compare velocity prediction direct and via')

anova1([viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'Autoenc','PCA','NMF'})

%pos
direct=correlations.EEG.pos.Default;
viaAutoenc=correlations.EEG.pos.ViaAutoenc;
viaPCA=correlations.EEG.pos.ViaPCA;
viaNNMF=correlations.EEG.pos.ViaNNMF;

anova1([direct(:),viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'direct','Autoenc','PCA','NMF'})
ylabel('correlation recorded - predicted')
title('Compare position prediction direct and via')

anova1([viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'Autoenc','PCA','NMF'})

%% evaluate single combination
input=correlations.LF.Autoenc;
sizeY=2;
limits_y=[1,-1];

names=fieldnames(input);
noOfPlots=size(names,1);

for i=1:noOfPlots
    limits_y=[min(min(min(input.(sprintf('%s',names{i})))),limits_y(1)),...
        max(max(max(input.(sprintf('%s',names{i})))),limits_y(2))];
end
limits_y=[limits_y(1)-0.1*diff(limits_y),limits_y(2)+0.1*diff(limits_y)]

figure();

for i=1:noOfPlots
    subplot(sizeY,ceil(noOfPlots/sizeY),i)
    boxplot(input.(sprintf('%s',names{i})))
    title(names{i})
    ylim(limits_y)
end

anova1(cat(2,input.Default(:),input.Offset1(:),input.Offset2(:)),[0,1,2])
anova1(cat(2,input.Default(:),input.Offset1(:),input.Pause1(:),input.Pause1Offset1(:)),{'0.5s Pause','0.5s Pause', '1s Pause', '1s Pause'})
