Skip to content

Commit 0a8ea9d

Browse files
committed
Added warning if tail values are constant to match original functionality
1 parent f834fde commit 0a8ea9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

R/psis.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ do_psis_i <- function(log_ratios_i, tail_len_i, ...) {
207207
# shift log ratios for safer exponentation
208208
lw_i <- log_ratios_i - max(log_ratios_i)
209209

210+
if (length(unique(tail(log_ratios_i, -tail_len_i))) == 1) {
211+
warning(
212+
"Can't fit generalized Pareto distribution ",
213+
"because all tail values are the same.",
214+
call. = FALSE
215+
)
216+
}
217+
210218
smoothed <- posterior::pareto_smooth_tail(
211219
x = lw_i,
212220
ndraws_tail = tail_len_i,

0 commit comments

Comments
 (0)