function [win,tie,loss, medMar] = winTieLossCalculatorAr(actValues,predGac2WC,predGac2CC)

% define variables for ar values
%     ar21 = abs(actValues-pred1) ;
%     ar22 = abs(actValues-pred2) ;
%     ar23 = abs(actValues-pred4) ;
%     ar24 = abs(actValues-pred8) ;
%     ar25 = abs(actValues-pred16) ;
%     ar26 = abs(actValues-predx) ;
%     ar27 = abs(actValues-pred1CC) ;
%     ar28 = abs(actValues-pred2CC) ;
%     ar29 = abs(actValues-pred4CC) ;
%     ar210 = abs(actValues-pred8CC) ;
%     ar211 = abs(actValues-pred16CC) ;
%     ar212 = abs(actValues-predxCC) ;
%     ar213 = abs(actValues-predGac2CC) ;

ar21 = -1 * ones(size(predGac2WC));
ar22 = -1 * ones(size(predGac2CC));
for tmpCounter = 1:size(predGac2WC,1)
    ar21(tmpCounter,:) = abs(actValues-predGac2WC(tmpCounter,:));
    ar22(tmpCounter,:) = abs(actValues-predGac2CC(tmpCounter,:));
end

% below, we calculate the median mar's coming from 20 different runs for
% within company and cross company respectively
medMarWC = median(mean(ar21'));
medMarCC = median(mean(ar22'));
medMar = [medMarWC medMarCC];

% indicate how many methods are being compared
methodCount = 2;
% define variables for win tie loss values
win = zeros(methodCount,1);
tie = zeros(methodCount,1);
loss = zeros(methodCount,1);

% start calculating win tie loss values
for i = 1:methodCount
    
    for j = (i+1):methodCount
        
        if i ~= j   % if i and j are different
            
            for k = 1:size(predGac2WC,1)
                eval(['[P,H] = ranksum(ar2',num2str(i),'(',num2str(k),',:),ar2',num2str(j),'(',num2str(k),',:));']);
                if H == 0   % if they are the same
                    eval(['tie(',num2str(i),') = tie(',num2str(i),') +1;']);
                    eval(['tie(',num2str(j),') = tie(',num2str(j),') +1;']);
                else
                    % calculate median values
                    eval(['medi = mean(ar2',num2str(i),'(',num2str(k),',:));']);
                    eval(['medj = mean(ar2',num2str(j),'(',num2str(k),',:));']);
                    if medi < medj
                        eval(['win(',num2str(i),') = win(',num2str(i),') +1;']);
                        eval(['loss(',num2str(j),') = loss(',num2str(j),') +1;']);
                    else
                        eval(['win(',num2str(j),') = win(',num2str(j),') +1;']);
                        eval(['loss(',num2str(i),') = loss(',num2str(i),') +1;']);
                    end
                end
            end
            
        end
    end
end

win = win(1);
tie = tie(1);
loss = loss(1);

end