Unit Testing of Two Sample Independent TTest
ClosedPublic

Authored by devanshuagarwal on Jun 30 2019, 10:35 AM.

Details

Reviewers
sgerlach
asemke
Summary

It is at very initial stage. Getting this reviewed can speed up things with lesser mistakes.

Test Plan

ttest is the command for unit testing.

Diff Detail

Repository
R262 LabPlot
Lint
Lint Skipped
Unit
Unit Tests Skipped
Restricted Application added a project: KDE Edu. · View Herald TranscriptJun 30 2019, 10:35 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
devanshuagarwal requested review of this revision.Jun 30 2019, 10:35 AM

Changed model to data driven model so that, we can tests on multiple sets without writing multiple compare functions.

Added Unit Tests for One Sample TTest and Two Sample Paired TTest;

sgerlach added inline comments.Jul 1 2019, 2:07 PM
src/backend/hypothesisTest/HypothesisTest.cpp
1073

fabs instead of abs.
why "-1*" instead of just "-"?

tests/stats/ttest/TTestTest.cpp
40

add comment: "first sample"

48

add comment "second sample"

53

add space before

86

Can you use the DEBUG() macro instead of qDebug()?
QDEBUG("tValue is " << tValue)

91

using an absolute error of 0.01 depends heavily on tValue. Why is the error so big? Can you use relative errors instead?

138

DEBUG()?

143

see above

158

check comment

190

DEBUG()?

195

see above

devanshuagarwal marked 2 inline comments as done.Jul 1 2019, 7:27 PM
devanshuagarwal added inline comments.
tests/stats/ttest/TTestTest.cpp
53

Sorry, I didn't get. Add space before?

86

QDEBUG and DEBUG macro are not working in my pc, may be due to some setting. I have to check for it. I will use the macro, once I will fix the setting.

91

I tried using relative error. But, I am not getting what value of delta to use. If I use as small as 0.1 also then the test is not passing for values:

actual: 1.51815e-05
expected < 0.001

which is very more accurate than expected.

sgerlach added inline comments.Jul 2 2019, 3:46 PM
tests/stats/ttest/TTestTest.cpp
53

I meant to add an empty line to make it more readable.

86

I thought that you already fixed it for you. If it's not working for you, please add a TODO-comment when using qDebug().

91

the problem here is that the expected value is not known more precise? An absolute error of 0.01 make not much sense here.
I would suggest to use a more precise expected value or test for actual < expected in this case.

devanshuagarwal marked 15 inline comments as done.Aug 11 2019, 6:57 PM
sgerlach accepted this revision.Aug 16 2019, 7:35 AM
This revision is now accepted and ready to land.Aug 16 2019, 7:35 AM
sgerlach closed this revision.Aug 18 2019, 9:59 PM