Wilcoxon's sign rank test

Wilcoxon's sign rank test

It is suitable for paired comparison in T-test, but it doesn'T need to find that the difference between pairs of data obeys normal distribution, only requires symmetrical distribution. Verify that the difference between pairs of observations comes from a population with a mean of 0 (the population that produces the data has the same mean).

In Matlab, rank sum test is implemented by function ranksum.

The command is: [p,h]=ranksum(x,y,alpha)

Where x, y can be unequal vectors and alpha is the given significance level, which must be the number between 0 and 1. p returns the probability of significance of whether the population generating two independent samples is the same, and H returns the result of hypothesis test. If the overall difference between X and Y is not significant, then h is zero; if the overall difference between X and Y is significant, then h is 1. If p is close to zero, the original hypothesis can be questioned.

clear;
clc;
path1 = 'C:\Users\Administrator\Desktop\Reorganize the vascular network\Real data.xls';
path2 = 'C:\Users\Administrator\Desktop\Reorganize the vascular network\Real data 1.xls';
path3 = 'C:\Users\Administrator\Desktop\Reorganize the vascular network\Generating data 9.xls';
path4 = 'C:\Users\Administrator\Desktop\Reorganize the vascular network\Generate data 1.xls';
path5 = 'C:\Users\Administrator\Desktop\Reorganize the vascular network\wgan-gp1.xls';
path6 = 'C:\Users\Administrator\Desktop\Reorganize the vascular network\wgan-gp200.xls';


mypath1  = path1;%Compare the two results
mypath2  = path2;
A = 'A2:A500';
B = 'B2:B500';
C = 'C2:C500';
D = 'D2:D500';
E = 'E2:E500';
F = 'F2:F500';
G = 'G2:G500';
H = 'H2:H500';
I = 'I2:I500';
J = 'J2:J500';
K = 'K2:K500';
L = 'L2:L500';
M = 'M2:M500';
N = 'N2:N500';
O = 'O2:O500';
disp('Length of main branch')
[num1] = xlsread(mypath1,A);
[num2] =  xlsread(mypath2,A);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Left branch length')
[num1] = xlsread(mypath1,B);
[num2] =  xlsread(mypath2,B);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Right branch length')
[num1] = xlsread(mypath1,C);
[num2] =  xlsread(mypath2,C);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Main left length ratio')
[num1] = xlsread(mypath1,D);
[num2] =  xlsread(mypath2,D);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Main right length ratio')
[num1] = xlsread(mypath1,E);
[num2] =  xlsread(mypath2,E);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Main fork curl')
[num1] = xlsread(mypath1,F);
[num2] =  xlsread(mypath2,F);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Left fork curl')
[num1] = xlsread(mypath1,G);
[num2] =  xlsread(mypath2,G);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Right fork curl')
[num1] = xlsread(mypath1,H);
[num2] =  xlsread(mypath2,H);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Main left angle')
[num1] = xlsread(mypath1,I);
[num2] =  xlsread(mypath2,I);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Main right angle')
[num1] = xlsread(mypath1,J);
[num2] =  xlsread(mypath2,J);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Left and right angle')
[num1] = xlsread(mypath1,K);
[num2] =  xlsread(mypath2,K);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Length of primary endpoint')
[num1] = xlsread(mypath1,L);
[num2] =  xlsread(mypath2,L);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p);

disp('Left endpoint length')
[num1] = xlsread(mypath1,M);
[num2] =  xlsread(mypath2,M);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p)

disp('Right end length')
[num1] = xlsread(mypath1,N);
[num2] =  xlsread(mypath2,N);
mean1 = mean(num1); %average value
mean2 = mean(num2); 
std1 = std(num1); %standard deviation
std2 = std(num2); 
var1 = var(num1); %variance
var2 = var(num2);
[p,h] = ranksum(num1,num2);
fprintf('Raw data 1--average value:%f,standard deviation:%f,variance:%f\n',mean1,std1,var1);
fprintf('Raw data 2--average value:%f,standard deviation:%f,variance:%f\n',mean2,std2,var2);
fprintf('h value:%d,p value:%f\n\n',h,p)


 

Keywords: network curl MATLAB

Added by Keith Scott on Sun, 05 Jan 2020 10:36:52 +0200