Hi Shay,
The ‘signrank’ function in MATLAB is a two-tailed test by default, but you can specify it to perform a one-tailed test using the ‘tail’ parameter. After setting this parameter, you can test a specific directional hypothesis:
- 'tail', is set to'right': Tests if the median of X - Y is greater than zero (i.e., X is consistently greater than Y).
- 'tail', is set to 'left': Tests if the median of X - Y is less than zero (i.e., Y is consistently greater than X).
I wrote an example of how to use ‘signrank’ for a one-tailed test which you can refer:
% Your data
X = [...]; % Your X values
Y = [...]; % Your Y values
% Perform the Wilcoxon signed-rank test (one-tailed)
[p, h, stats] = signrank(X, Y, 'tail', 'right'); % Test if X is greater than Y
% Alternatively, test if Y is greater than X
% [p, h, stats] = signrank(X, Y, 'tail', 'left');
% Display the results
fprintf('p-value: %f\n', p);
fprintf('Test statistic: %f\n', stats.signedrank);
fprintf('Hypothesis result (1 if rejected, 0 if not): %d\n', h);
Here is the documentation for the ‘signrank’ function:
Hope this helps!