@@ -63,14 +63,14 @@ relative_eff.array <- function(x, ..., cores = getOption("mc.cores", 1)) {
6363 S <- prod(dim(x )[1 : 2 ]) # posterior sample size = iter * chains
6464
6565 if (cores == 1 ) {
66- n_eff_vec <- apply(x , 3 , ess_rfun )
66+ n_eff_vec <- apply(x , 3 , posterior :: ess_mean )
6767 } else {
6868 if (! os_is_windows()) {
6969 n_eff_list <-
7070 parallel :: mclapply(
7171 mc.cores = cores ,
7272 X = seq_len(dim(x )[3 ]),
73- FUN = function (i ) ess_rfun (x [, , i , drop = TRUE ])
73+ FUN = function (i ) posterior :: ess_mean (x [, , i , drop = TRUE ])
7474 )
7575 } else {
7676 cl <- parallel :: makePSOCKcluster(cores )
@@ -79,7 +79,7 @@ relative_eff.array <- function(x, ..., cores = getOption("mc.cores", 1)) {
7979 parallel :: parLapply(
8080 cl = cl ,
8181 X = seq_len(dim(x )[3 ]),
82- fun = function (i ) ess_rfun (x [, , i , drop = TRUE ])
82+ fun = function (i ) posterior :: ess_mean (x [, , i , drop = TRUE ])
8383 )
8484 }
8585 n_eff_vec <- unlist(n_eff_list , use.names = FALSE )
@@ -192,15 +192,3 @@ psis_n_eff.matrix <- function(w, r_eff = NULL, ...) {
192192 }
193193 1 / ss * r_eff
194194}
195-
196- # ' MCMC effective sample size calculation
197- # '
198- # ' @noRd
199- # ' @param sims An iterations by chains matrix of draws for a single parameter.
200- # ' In the case of the **loo** package, this will be the **exponentiated**
201- # ' log-likelihood values for the ith observation.
202- # ' @return MCMC effective sample size based on RStan's calculation.
203- # '
204- ess_rfun <- function (sims ) {
205- posterior :: ess_basic(sims )
206- }
0 commit comments