Closed twest820 closed 3 years ago
Thanks, this is true. There are a number of other issues for summaries when working with 1d parameters. I guess it's rare that a user would like to run an MCMC with one parameter, but I should nevertheless tidy this up!
Yeah, there are usually easier and better optimization methods than MCMC for a single parameter. Single parameter is useful for simplified testing and examples, though. From some of the search hits in the BayesianTools I think at least one or two of the package's tests are single parameter and single parameter also makes a good hello world for users new to the package (and probably MCMC as well). Another case is debugging, since if you're having some high dimensional convergence issue or some other problem it can be helpful to start checking low dimensional slices. The latter is how I found this, actually.
From some looking at how BayesianTools interacts with the coda package, I think the snippet below provides a workaround for this issue.
chainInCodaFormat = getSample(mcmcBurnin, coda = TRUE)
coda::gelman.diag(chainInCodaFormat)
Thanks for that, I had already implemented a fix!
btw., I agree about the use of 1-d for examples!
Looks like the problem here is
is.na(diag$mpsrf)
is called even whendiag
is empty, leading to anif
check on an empty object.