ebbr
ebbr copied to clipboard
ebbr fails with unhelpful error when all observations are 0
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