title: How can I get bias corrected bootstrap confidence intervals for my model predictions
body: <p>I'm interested in bias corrected bootstrap confidence intervals for my model predictions.  I've written some code to perform the bootstrap, show below:</p>
  
  <pre class="lang-r prettyprint-override"><code>library(tidyverse)
  #&gt; Warning: package 'ggplot2' was built under R version 4.0.2
  #&gt; Warning: package 'tibble' was built under R version 4.0.2
  #&gt; Warning: package 'tidyr' was built under R version 4.0.2
  #&gt; Warning: package 'dplyr' was built under R version 4.0.2
  library(boot)
  
  
  x = rnorm(25)
  eta = -0.5 + 0.2*x
  y = rpois(25, exp(eta))
  d = tibble(x, y)
  
  
  
  predictions&lt;-function(data, ind){
    model = glm(y ~ x, data = data[ind,])
    newdata = tibble(x = seq(-2,2, 0.01))
    
    eta = predict(model, newdata = newdata)
    exp(eta)
  }
  
  
  bt = boot(d, predictions, 1000)
  
  boot.ci(bt, type = 'bca')
  #&gt; BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
  #&gt; Based on 1000 bootstrap replicates
  #&gt; 
  #&gt; CALL : 
  #&gt; boot.ci(boot.out = bt, type = &quot;bca&quot;)
  #&gt; 
  #&gt; Intervals : 
  #&gt; Level       BCa          
  #&gt; 95%   ( 0.654,  6.095 )  
  #&gt; Calculations and Intervals on Original Scale
  #&gt; Some BCa intervals may be unstable
  </code></pre>
  <p>The bootstrapping works as anticipated, however the <code>boot.ci</code> call only computes a single confidence interval.</p>
  <p>My desired output would be a dataframe which has:</p>
  <ul>
  <li>One column for bootstrap predictions (essentially, the mean of the bootstraps)</li>
  <li>One column for the lower <code>100*(1-a)</code> confidence limit, and</li>
  <li>One column for the upper <code>100*(1-a)</code> confidence limit.</li>
  </ul>
  <p>How can I use <code>boot</code> to obtain the desired output?</p>