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:
- 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:
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:
