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

ebbr fails with unhelpful error when all observations are 0 #8

Open
jan-glx opened this issue Feb 8, 2021 · 0 comments · May be fixed by #9
Open

ebbr fails with unhelpful error when all observations are 0 #8

jan-glx opened this issue Feb 8, 2021 · 0 comments · May be fixed by #9

Comments

@jan-glx
Copy link

jan-glx commented Feb 8, 2021

When all observations (k) are 0, ebbr fails with an unhelpful error message:

> ebbr::add_ebb_estimate(data.frame(k=rep(0, 10), n=sample(100, 10)), k ,n)

 Error in if (!all(lower <= start & start <= upper)) { : 
  missing value where TRUE/FALSE needed

If at least one observation is >1 it does work fine:

> ebbr::add_ebb_estimate(data.frame(k=c(1, rep(0, 9)), n=sample(100, 10)), k ,n)
   k  n   .alpha1   .beta1     .fitted       .raw         .low       .high
1  1 30 1.5202724 293.3042 0.005156533 0.03333333 3.829061e-04 0.015922746
2  0 74 0.5202724 338.3042 0.001535522 0.00000000 1.958268e-06 0.007564209
3  0 52 0.5202724 316.3042 0.001642147 0.00000000 2.094575e-06 0.008088588
4  0 97 0.5202724 361.3042 0.001437914 0.00000000 1.833525e-06 0.007084076
5  0 95 0.5202724 359.3042 0.001445906 0.00000000 1.843738e-06 0.007123393
6  0 58 0.5202724 322.3042 0.001611626 0.00000000 2.055554e-06 0.007938499
7  0 41 0.5202724 305.3042 0.001701212 0.00000000 2.170101e-06 0.008379020
8  0 39 0.5202724 303.3042 0.001712411 0.00000000 2.184422e-06 0.008434081
9  0 38 0.5202724 302.3042 0.001718066 0.00000000 2.191654e-06 0.008461884
10 0 44 0.5202724 308.3042 0.001684686 0.00000000 2.148968e-06 0.008297763
jan-glx added a commit to jan-glx/ebbr that referenced this issue Feb 8, 2021
jan-glx added a commit to jan-glx/ebbr that referenced this issue Feb 8, 2021
jan-glx added a commit to jan-glx/ebbr that referenced this issue Feb 8, 2021
jan-glx added a commit to jan-glx/ebbr that referenced this issue Feb 8, 2021
jan-glx added a commit to jan-glx/ebbr that referenced this issue Feb 8, 2021
@jan-glx jan-glx linked a pull request Feb 8, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant