New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statistical functions #554
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #554 +/- ##
===========================================
+ Coverage 91.89% 91.91% +0.01%
===========================================
Files 159 161 +2
Lines 31666 33491 +1825
Branches 2971 3130 +159
===========================================
+ Hits 29099 30782 +1683
- Misses 2561 2703 +142
Partials 6 6
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add jstat and bassel to deps https://handsontable.github.io/hyperformula/guide/dependencies.html ?
How do I edit this? |
Co-authored-by: Wojciech Czerniak <wojciech.czerniak@gmail.com>
Here: https://github.com/handsontable/hyperformula/blob/master/docs/guide/dependencies.md |
Co-authored-by: Wojciech Czerniak <wojciech.czerniak@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions are good, one more thing is to adjust formatting and linters a little bit.
Co-authored-by: Wojciech Czerniak <wojciech.czerniak@gmail.com>
Co-authored-by: Wojciech Czerniak <wojciech.czerniak@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It's all good, I only found some small inconsistencies between our results and GS/XL.
['=BETA.DIST(1, 2, 3, 4, 5, 6, 7)'], | ||
]) | ||
|
||
expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NA, ErrorMessage.WrongArgNumber)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GS sets the default value of cumulative to TRUE and returns 1 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is some weird artefact...
['=BETA.DIST(0.6, 1, 1, FALSE(), 0.6, 0.7)'], | ||
['=BETA.DIST(0.7, 1, 1, FALSE(), 0.6, 0.7)'], | ||
]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next inconsistency: GS returns 0 for 1st, 4th and 5th test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are also some internally inconsistent values for GS :)
]) | ||
|
||
expect(engine.getCellValue(adr('A1'))).toEqual(0) | ||
expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GS returns 0 here
expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) | ||
//both products #1 and #2 return NUM for '=BINOM.INV(10, 0, 0.5)', which is incorrect | ||
expect(engine.getCellValue(adr('A3'))).toEqual(0) | ||
//both products #1 and #2 return NUM for '=BINOM.INV(10, 10, 0.5)', which is incorrect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the test is (10,1,0.5)
expect(engine.getCellValue(adr('A1'))).toEqual(1) | ||
expect(engine.getCellValue(adr('A2'))).toBeCloseTo(1.77245385588014, 6) | ||
expect(engine.getCellValue(adr('A3')) as number / 1133278.39212948).toBeCloseTo(1, 6) | ||
expect(engine.getCellValue(adr('A4'))).toBeCloseTo(-0.94530871782981, 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GS returns NUM
expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) | ||
expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) | ||
expect(engine.getCellValue(adr('A3'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) | ||
expect(engine.getCellValue(adr('A4'))).toEqual(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XL returns NUM here
|
||
expect(engine.getCellValue(adr('A1'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) | ||
expect(engine.getCellValue(adr('A2'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.ValueSmall)) | ||
expect(engine.getCellValue(adr('A3'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.WrongOrder)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XL returns 1 here
Also please add to the |
Context
29 statistical functions EXPON.DIST, EXPONDIST, FISHER, FISHERINV, GAMMA, GAMMA.DIST, GAMMADIST, GAMMALN, GAMMALN.PRECISE, GAMMA.INV, GAMMAINV, GAUSS, BETA.DIST, BETADIST, BETA.INV, BETAINV, BINOM.DIST, BINOMDIST, BINOM.INV, BESSELI, BESSELJ, BESSELK, BESSELY, CHIDIST, CHIINV, CHISQ.DIST, CHISQ.DIST.RT, CHISQ.INV, CHISQ.INV.RT.
How has this been tested?
Types of changes
Related issue(s):
Checklist: