- h = 1 means the test rejects the null hypothesis at the default 5% significance level (p < 0.05).
- p = 0.00208 is the p-value, which is much less than 0.05.
- This means that there is a statistically significant difference between the outputs of the two algorithms.
- Since "lower is better" I would suggest checking the means of x1 and x2:
paired t-test result interpretation
11 views (last 30 days)
Show older comments
hi all,
need a refresher course on t-test, I seek your help.
I have 2 algorithms to solve the same problem, the output of each algorithm produce a single number. This single number indicate the efficacy of the algorithm (lower the better).
In a simulation, I ran both algorithms for, say, 10000 times. At each time, inputs to both algorithms are the same; their ourputs are different, of course.
How do I know which algorithm gives a better results on average, and that their outputs are indeed different with significance? The means(std) of both output vectors are small, and the t-test results are:
[h,p]=ttest(x1, x2)
h =
1
p =
0.002082123196735
Questions: - am I using ttest the right way for paired t-test, and
- how do I interpret these results?
regards,
0 Comments
Answers (1)
Samayochita
on 21 Apr 2025
Edited: Samayochita
on 23 Apr 2025
Hi Elvis,
I understand that you want to know if the “ttest” function has been used correctly and how to interpret the t-test results (h and p values).
Since both the algorithms were run on the same inputs each time, the outputs (x1 and x2) are paired, thus the use of “ttest” is correct.
The MATLAB function “ttest(x1, x2)” performs a paired t-test by default, testing if the mean difference between x1 and x2 is zero.
The t-test results could be interpreted as follows:
If mean(x1) < mean(x2): Algorithm 1 is better.
If mean(x2) < mean(x1): Algorithm 2 is better.
For more information on the “ttest” function, please refer to the documentation link given below:
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!