@@ -282,9 +282,9 @@ ebfmi <- function(post_warmup_sampler_diagnostics) {
282
282
efbmi_val <- NULL
283
283
if (! is.null(post_warmup_sampler_diagnostics )) {
284
284
if (! (" energy__" %in% posterior :: variables(post_warmup_sampler_diagnostics ))) {
285
- warning(" E-BFMI not computed as the 'energy__' diagnostic could not be located." , call. = FALSE )
285
+ warning(" E-BFMI not computed because the 'energy__' diagnostic could not be located." , call. = FALSE )
286
286
} else if (posterior :: niterations(post_warmup_sampler_diagnostics ) < 3 ) {
287
- warning(" E-BFMI is undefined for posterior chains of length less than 3." , call. = FALSE )
287
+ warning(" E-BFMI not computed because it is undefined for posterior chains of length less than 3." , call. = FALSE )
288
288
} else {
289
289
energy <- posterior :: extract_variable_matrix(post_warmup_sampler_diagnostics , " energy__" )
290
290
if (any(is.na(energy ))) {
@@ -302,9 +302,12 @@ ebfmi <- function(post_warmup_sampler_diagnostics) {
302
302
check_ebfmi <- function (post_warmup_sampler_diagnostics , threshold = 0.2 ) {
303
303
efbmi_val <- ebfmi(post_warmup_sampler_diagnostics )
304
304
if (any(efbmi_val < threshold )) {
305
- message(paste0(sum(efbmi_val < threshold ), " of " , length(efbmi_val ), " chains had energy-based Bayesian fraction " ,
306
- " of missing information (E-BFMI) less than " , threshold , " , which may indicate poor exploration of the " ,
307
- " posterior." ))
305
+ message(
306
+ " Warning: " , sum(efbmi_val < threshold ), " of " , length(efbmi_val ),
307
+ " chains had energy-based Bayesian fraction of missing information (E-BFMI)" ,
308
+ " less than " , threshold , " ." ,
309
+ " \n This may indicate poor exploration of the posterior."
310
+ )
308
311
}
309
312
invisible (NULL )
310
313
}
0 commit comments