Wilcoxon秩和检验MATLAB实现

Wilcoxon秩和检验MATLAB实现


在单目标优化算法中,得到结果后一般要进行威尔克森秩和检验。

Wilcoxon(威尔克森)秩和检验的目的是用于比较两个独立样本的差异。在算法中用于比较自己的算法和别人的算法有没有差异,有差异才可以比较优劣,没有差异默认在改测试中性能相等。

clear all

%初始化参数
n=30;
m=10;
x = zeros(n,m);
y = zeros(n,m);

%导入数据
load 002.mat
for i = 1 : n
    for j = 1 : m
        x (i,j) = result(i,j).bestval;
    end    
end

导入数据
load 002.mat
for i = 1 : n
    for j = 1 : m
        y (i,j) = result( i , j ).bestval;
    end    
end


p = zeros(1,n);
h = zeros(1,n);      
for i = 1 : n
    [p(i),h(i)]=ranksum(x(i,:),y(i,:));
end

h=h'
% if h=1 represent the two vector not equal and the p<=0.05
% if h=0 represent the two vector equal

猜你喜欢

转载自blog.csdn.net/weixin_44037272/article/details/115130049
今日推荐