-
Notifications
You must be signed in to change notification settings - Fork 1
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
boot.pval throws an error for BCa confidence intervals #4
Comments
Thanks for posting this! I'll look into it as soon as I can. |
Sure thing! I also noticed something else: |
+1
|
Hi, I had the same problem and I figured out why it happened. In |
@Sciurus365 It's been a little bit since I revisited this issue and my datasets have evolved a bit since then, so I couldn't find the specific example where setting it to 1e-15 failed (though I know it did). However, I think I may have traced the issue to the pval_precision parameter. Observe: This suggests that the step size of the sequence set by pval_precision (and which depends on the number of boot supplied by the user) interacts with the specific minimum value set in the alpha sequence in a way that does not completely depend on how large this minimum value is. Pragmatically, I could not reproduce this error trying a range of different precision values of different orders of magnitude when I used 1e-14 as opposed to 1e-15, so perhaps this is just an edge case that only happens when the step size and sequence boundary sizes are just small enough to trigger a NA at the end of the sequence? I will try setting mine to 1e-14 and see if anything ever triggers it and report back if it does. |
+1 to @astaroph. I also got the error when setting it to 1e-15. This is my workaround (inside, there is a link to the patchwork code): |
Hey, thanks for your reply! Do you mean the vector from |
Just a small note to draw your attention to an error I got when calculating p-values for BCa confidence intervals along with my temporary fix (though I still don't understand why it works). Hopefully you might!
When using the original boot.pval function I get the following error when type='bca' but not when type is left to defaults:
Error in if (any(ints)) out[inds[ints]] <- tstar[k[inds[ints]]] :
missing value where TRUE/FALSE needed
6.
norm.inter(t, adj.alpha)
5.
bca.ci(boot.out, conf, index[1L], L = L, t = t.o, t0 = t0.o,
h = h, hdot = hdot, hinv = hinv, ...)
4.
boot::boot.ci(boot_res, conf = 1 - alpha_seq, type = type, ...)
3.
withCallingHandlers(expr, warning = function(w) if (inherits(w,
classes)) tryInvokeRestart("muffleWarning"))
2.
suppressWarnings(boot::boot.ci(boot_res, conf = 1 - alpha_seq,
type = type, ...))
1.
boot.pval_fixed(boot_out, type = "bca", theta_null = 0.5)
I apparently fixed it by changing a single value in the following line:
original (doesn't work with type='bca'):
alpha_seq <- seq(1e-16, 1-1e-16, pval_precision)
modified (does work with type='bca')
alpha_seq <- seq(1e-15, 1-1e-15, pval_precision)
Strange!
The text was updated successfully, but these errors were encountered: