I'm looping through many analyses in an R notebook, and capturing confidence intervals each iteration. Each time, confint emits "Waiting for profiling to be done..." as output that shows up in the notebook. Can I suppress this?
The following code emits the message I'd like to avoid in the console and RStudio. If it matters, I only care about the output to the notebook in RStudio.
y = c(1,2,3,4,5,6,7,8,9,0)
x = c(2,4,6,8,2,4,6,8,2,4)
fit = glm(y ~ x)
ci.05 = confint(fit, level=0.95)["x","2.5 %"]
print(paste("The lower bound of the 95% CI is",ci.05))
@mko's solution is a nice general way to attack problems like these but in this particular case you can get rid of the message by passing a profile object to confint
directly. If you use the following line instead of your original code none of the output will be any different but you won't get the message that is annoying you.
ci.05 = confint(profile(fit), level=0.95)["x","2.5 %"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With