Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Items for next release go here

* Speed improvement from simplifying the normalization when fitting the
generalized Pareto distribution. (#187, @sethaxen)

* Fixed bug where attribute storing normalizing constant of PSIS weights wasn't
updated when using moment matching. (#167, @fweber144)

* Switch unit tests from Travis to GitHub Actions. (#164)

### Bug fixes
Expand Down
4 changes: 1 addition & 3 deletions R/gpdfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ gpdfit <- function(x, wip = TRUE, min_grid_pts = 30, sort_x = TRUE) {
xstar <- x[floor(N / 4 + 0.5)] # first quartile of sample
theta <- 1 / x[N] + (1 - sqrt(M / (jj - 0.5))) / prior / xstar
l_theta <- N * lx(theta, x) # profile log-lik
w_theta <- 1 / vapply(jj, FUN.VALUE = numeric(1), FUN = function(j) {
sum(exp(l_theta - l_theta[j]))
})
w_theta <- exp(l_theta - matrixStats::logSumExp(l_theta)) # normalize
theta_hat <- sum(theta * w_theta)
k <- mean.default(log1p(-theta_hat * x))
sigma <- -k / theta_hat
Expand Down