Skip to content
99 changes: 0 additions & 99 deletions R/gpdfit.R

This file was deleted.

4 changes: 2 additions & 2 deletions R/psis.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ psis_smooth_tail <- function(x, cutoff) {
exp_cutoff <- exp(cutoff)

# save time not sorting since x already sorted
fit <- gpdfit(exp(x) - exp_cutoff, sort_x = FALSE)
fit <- posterior::gpdfit(exp(x) - exp_cutoff, sort_x = FALSE)
k <- fit$k
sigma <- fit$sigma
if (is.finite(k)) {
p <- (seq_len(len) - 0.5) / len
qq <- qgpd(p, k, sigma) + exp_cutoff
qq <- posterior::qgeneralized_pareto(p, 0, sigma, k) + exp_cutoff
tail <- log(qq)
} else {
tail <- x
Expand Down
4 changes: 2 additions & 2 deletions R/psislw.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ psislw <- function(lw, wcp = 0.2, wtrunc = 3/4,
# body and gPd smoothed tail
tail_ord <- order(x_tail)
exp_cutoff <- exp(cutoff)
fit <- gpdfit(exp(x_tail) - exp_cutoff, wip=FALSE, min_grid_pts = 80)
fit <- posterior::gpdfit(exp(x_tail) - exp_cutoff, wip=FALSE, min_grid_pts = 80)
k <- fit$k
sigma <- fit$sigma
prb <- (seq_len(tail_len) - 0.5) / tail_len
qq <- qgpd(prb, k, sigma) + exp_cutoff
qq <- posterior::qgeneralized_pareto(prb, 0, sigma, k) + exp_cutoff
smoothed_tail <- rep.int(0, tail_len)
smoothed_tail[tail_ord] <- log(qq)
x_new <- x
Expand Down
Loading