function [win,tie,loss, medMdmre] = winTieLossCalculatorMdmre(actValues,predGac2WC,predGac2CC)

% define variables for mre values
%     mre21 = abs(actValues-pred1)./actValues;
%     mre22 = abs(actValues-pred2)./actValues;
%     mre23 = abs(actValues-pred4)./actValues;
%     mre24 = abs(actValues-pred8)./actValues;
%     mre25 = abs(actValues-pred16)./actValues;
%     mre26 = abs(actValues-predx)./actValues;
%     mre27 = abs(actValues-pred1CC)./actValues;
%     mre28 = abs(actValues-pred2CC)./actValues;
%     mre29 = abs(actValues-pred4CC)./actValues;
%     mre210 = abs(actValues-pred8CC)./actValues;
%     mre211 = abs(actValues-pred16CC)./actValues;
%     mre212 = abs(actValues-predxCC)./actValues;

mre21 = -1 * ones(size(predGac2WC));
mre22 = -1 * ones(size(predGac2CC));
for tmpCounter = 1:size(predGac2WC,1)
    mre21(tmpCounter,:) = abs(actValues-predGac2WC(tmpCounter,:))./actValues;
    mre22(tmpCounter,:) = abs(actValues-predGac2CC(tmpCounter,:))./actValues;
end

% below, we calculate the median mdmre's coming from 20 different runs for
% within company and cross company respectively
medMdmreWC = median(median(mre21'));
medMdmreCC = median(median(mre22'));
medMdmre = [medMdmreWC medMdmreCC];


% 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(mre2',num2str(i),'(',num2str(k),',:),mre2',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 = median(mre2',num2str(i),'(',num2str(k),',:));']);
                    eval(['medj = median(mre2',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