Skip to content

Commit c442f63

Browse files
Merge branch 'loo-v3.0.0' into parallelization
2 parents 30834a4 + 71e9fc3 commit c442f63

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

R/psis.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,9 @@ psis_smooth_tail <- function(x, cutoff) {
257257
fit <- posterior::gpdfit(exp(x) - exp_cutoff, sort_x = FALSE)
258258
k <- fit$k
259259
sigma <- fit$sigma
260+
if (is.na(k)) {
261+
k <- Inf
262+
}
260263
if (is.finite(k)) {
261264
p <- (seq_len(len) - 0.5) / len
262265
qq <- posterior::qgeneralized_pareto(p, 0, sigma, k) + exp_cutoff

tests/testthat/test_psis.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,9 @@ test_that("do_psis_i throws warning if all tail values the same", {
152152
})
153153

154154
test_that("psis_smooth_tail returns original tail values if k is infinite", {
155-
# skip on M1 Mac until we figure out why this test fails only on M1 Mac
156-
skip_if(Sys.info()[["sysname"]] == "Darwin" && R.version$arch == "aarch64")
157-
158-
xx <- c(1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4)
159-
val <- suppressWarnings(psis_smooth_tail(xx, 3))
155+
xx <- log(c(2, 2, 2, 2, 3, 4, 5, 6))
156+
val <- suppressWarnings(psis_smooth_tail(xx, 0))
160157
expect_equal(val$tail, xx)
161158
expect_equal(val$k, Inf)
162159
})
160+

0 commit comments

Comments
 (0)