# How to calculate p-value comparing bootstrap-based predicted probabilities and observed probabilities

I posted this question on stackoverflow first but I have got no answer so far, so I decided to post it here in the hope that here I might get an answer. I hope my procedure is acceptable.

Essentially, what I want is any help to calculate bootstrap- and permutation-based p-values comparing the observed probability and the predicted probability.

#data:

ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive = 20-numdead)
dat<-data.frame(ldose, numdead, sex, SF)
tibble::rowid_to_column(dat, "indices")
new.data <- data.frame(ldose = 20, sex = "F")


#bootstrap:

temp.out<-function(dat, indices, new.data) {
d<-dat[indices, ]
f<- glm(SF ~ sex*ldose, family = binomial (link = logit), data = d)
return(predict(f, new.data, type="response"))
}

results <- boot::boot(dat, temp.out, 1000, sim = "permutation")

boot::boot.ci(results, conf = c(0.90, 0.95), type = c("perc"))


#questions:

#boot::boot.ci(results, conf = 0.95, type = "all") #why is this failing?
#how should I proceed to calculate bootstrap-based p-value
comparing the observed probability(e.g., 0.45) and
the predicted probabilities (based on the bootstrap algorithm above)?


Thanks in advance for any help. If anything is not clear, please kindly let me know in the comments.