- '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).
In need of a specific statistic test
2 views (last 30 days)
Show older comments
Hi,
I am looking for a single-tailed, paired, non-parametric statistic test.
Specifically, I have (Xi,Yi) pairs and I want to know whether X is consistently larger than Y, or vica versa, in a significant manner (i want to be able to quantify the significance either way).
Is there such a thing implemented in Matlab? Ranksum and signrank are close to what i need but are both two-tailed.
Thanks!
Shay
0 Comments
Answers (1)
TED MOSBY
on 10 Oct 2024
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:
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!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!