ergm
ergm copied to clipboard
Broken stick burn-in detection can malfunction if no burn-in is required.
E.g.,
library(ergm)
library(coda)
mk.s <- function(n) mcmc.list(mcmc(cbind(rnorm(n)))) # IID normal sample
sim <- unlist(replicate(100, ergm:::.find_OK_burnin(mk.s(100)))[1,])
hist(sim)
Created on 2021-05-21 by the reprex package (v2.0.0)
The correct answer is, of course, 0, and the maximum mathematically possible value is 1.
This bug is not too severe, since its worst case scenario is that adaptive MCMC sampling takes twice as long as needed, with the more typical scenario being closer to 30% longer. Nonetheless, some way to detect that there is no need to break the stick would be helpful.