- '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
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (1개)
TED MOSBY
2024년 10월 10일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!