Skip to content
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

incorrect output in some cases #6

Open
jackywangtj66 opened this issue Feb 23, 2022 · 1 comment
Open

incorrect output in some cases #6

jackywangtj66 opened this issue Feb 23, 2022 · 1 comment

Comments

@jackywangtj66
Copy link

Dear developer,
I encountered some unexpected result when applying this function:
2022-02-23
The 2.0 entries are due to the incorrect output "-1" of chi2comb_cdf.

I then checked the case when two chisquared random variables are in the combination, both having dof 1, ncent 0. Whenever the expected probability is smaller than around 0.225, it will output -1 as the result and the errno is 1. For example, chi2comb_cdf(1.25,[ChiSquared(coef=2, ncent=0, dof=1),ChiSquared(coef=3, ncent=0, dof=1)],0), which should output 0.2246805.

However this does not hold for all cases. I have not found any error when either of the dof is not 1. When the number of variables is at least 3, it also works well. As for the non-centrality parameters, error also occurs when the output is small, for example, chi2comb_cdf(5,[ChiSquared(coef=5, ncent=3, dof=1),ChiSquared(coef=3, ncent=0, dof=1)],0), which should be 0.1471154.

Could you please check why it goes wrong?

@huangyh09
Copy link

Hi Tianjie,

It looks like the error category "1" gives a clue for the issue (denoting "1: required accuracy not achieved"). Therefore, if we increase the absolute error tolerance atol from the default 1e-4 to 1e-3 or even 1e-2, the error will be resolved. Probably, we can use a try and error strategy (increase atol gradually).

BTW, thanks Danilo for developing the nice package (and already have considered the potential issue)!

Huang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants