Skip to content

Commit f17844f

Browse files
authored
Merge pull request #402 from n-kall/tail-length-fix
properly take into account r_eff when deciding tail length
2 parents aba4bb8 + 6cee79a commit f17844f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/pareto_smooth.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,12 @@ ps_convergence_rate <- function(k, ndraws, ...) {
639639
#' @return tail length
640640
#' @export
641641
ps_tail_length <- function(ndraws, r_eff, ...) {
642-
ceiling(ifelse(ndraws > 225, 3 * sqrt(ndraws / r_eff), ndraws / 5))
642+
floor(
643+
ifelse(
644+
ndraws * r_eff > 225,
645+
3 * sqrt(ndraws / r_eff),
646+
ndraws / 5)
647+
)
643648
}
644649

645650
#' Pareto-k diagnostic message

0 commit comments

Comments
 (0)