diff options
author | Ken Kellner <ken@kenkellner.com> | 2023-12-03 13:17:10 -0500 |
---|---|---|
committer | Ken Kellner <ken@kenkellner.com> | 2023-12-03 13:17:10 -0500 |
commit | 1335dd34df1680fa505bd8c425b4feaf11b2656c (patch) | |
tree | 0271aa293a1bb2498ab9933c1e7e247ff81896ae | |
parent | 147f0353b3919c32350400f109b09c72767472b2 (diff) |
More robust Rhat calculation
-rw-r--r-- | R/process_output.R | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/R/process_output.R b/R/process_output.R index cb18490..4877b8b 100644 --- a/R/process_output.R +++ b/R/process_output.R @@ -149,7 +149,10 @@ calc_f <- function(values, mn){ calc_Rhat <- function(mcmc_list){ stopifnot(has_one_parameter(mcmc_list)) - coda::gelman.diag(mcmc_list)$psrf[1] + out <- try(coda::gelman.diag(mcmc_list, + autoburnin=FALSE, multivariate=FALSE)$psrf[1]) + if(inherits(out, "try-error") || !is.finite(out)) out <- NA + out } mcmc_to_mat <- function(mcmc_list){ |