title: How to calculate p-value comparing bootstrap-based predicted probabilities and observed probabilities
body: <p>Given the sample data <code>dat</code> below, I would appreciate any help to:</p>
  
  <p>(1) check whether my approach below following boot's <a href="https://cran.r-project.org/web/packages/boot/boot.pdf" rel="nofollow noreferrer">vignette</a> to calculate bootstrap-based predictions from logistic regression is correct and help correct if there is any mistake in my approach. </p>
  
  <p>(2) calculate
      bootstrap-based p-values comparing the observed probability and the predicted probability.</p>
  
  <p><strong>#my sample data:</strong></p>
  
  <pre><code>ldose &lt;- rep(0:5, 2)
  numdead &lt;- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
  sex &lt;- factor(rep(c("M", "F"), c(6, 6)))
  SF &lt;- cbind(numdead, numalive = 20-numdead)
  dat&lt;-data.frame(ldose, numdead, sex, SF)
  tibble::rowid_to_column(dat, "indices")
  
  new.data &lt;- data.frame(ldose = 20, sex = "F")
  </code></pre>
  
  <p><strong>#doing bootstrap:</strong></p>
  
  <pre><code>#Here I would appreciate any correction if something is not correct in my approach
  
  temp.out&lt;-function(dat, indices, new.data) {
       d&lt;-dat[indices, ] 
       fit1&lt;- glm(SF ~ sex*ldose, family = binomial (link = logit), data = d)  
       return(predict(fit1, new.data, type="response"))
  }
  
  results &lt;- boot::boot(dat, temp.out, 1000, sim = "permutation")
  
  boot::boot.ci(results, conf = 0.95, type = "all") #this fails
  
       Error in model.frame.default(formula = SF ~ sex * ldose, data = d, drop.unused.levels = TRUE) : 
        variable lengths differ (found for 'sex')
  
  boot::boot.ci(results, conf = c(0.90, 0.95), type = c("perc")) #this works
  </code></pre>
  
  <p><strong>#calculating bootstrap-based p-value comparing the observed probability(e.g., 0.45) and the predicted probabilities (based on the bootstrap algorithm):</strong></p>
  
  <pre><code>#Here I would appreciate any help to calculate the p-value
  </code></pre>
  
  <p>Thanks in advance for any help. If there is anything that is not clear, please kindly let me know.</p>