load('SuppLidoPRhCumVals.mat')
%%
PlotAllDataPoints3(RatCtrlNormCumSumLastVal, PRhExp, PRhPost)


ylim([-1 1])
set(gca,'xtick',1:3, 'XTickLabel', {'Rat Ctrl','PRh', 'PRhtrained'})

set(gca, 'YTick', -1:0.5:1)

%%
[p1 h] = ranksum(RatCtrlNormCumSumLastVal, PRhExp)

[p2 h] = ranksum(RatCtrlNormCumSumLastVal, PRhPost)


%text(0.8, 0.8, ['p=', num2str(p1)])
%text(2.8, 0.8, ['p=', num2str(p2)])

%% non-parametric
group = [ones(24,1); ones(4,1)+1; ones(6,1)+2];

[p,tbl,stats] = kruskalwallis([RatCtrlNormCumSumLastVal; PRhExp ; PRhPost],group,'off')

c = multcompare(stats,'CType', 'dunn-sidak')


%%
figure
errorbar(nanmean(RatCtrl_cumvals,2),nanstd(RatCtrl_cumvals,[],2)/sqrt(24),'k')
hold on

errorbar(nanmean(PRhExp_cumvals,2),nanstd(PRhExp_cumvals,[],2)/sqrt(4),'b')


errorbar(nanmean(PRhPost_cumvals,2),nanstd(PRhPost_cumvals,[],2)/sqrt(6),'g')


xlim([0 100])
ylabel('Cummulative Sum')
xlabel('trial #')

ylim([-50 100])

legend({'Rat Ctrl (n=24)',   'PRh (n=4)', 'PRh trained (n=6)'})
