TuringLang / ParetoSmooth.jl

An implementation of PSIS algorithms in Julia.
http://turinglang.org/ParetoSmooth.jl/
MIT License
19 stars 12 forks source link

Difference with loo output #71

Closed miguelbiron closed 1 year ago

miguelbiron commented 1 year ago

Hi -- I'm trying to understand differences in the output of gpd_fit and the output of the function gpdfit in the R package loo. Is there a reason to have this line

https://github.com/TuringLang/ParetoSmooth.jl/blob/b1d603ecc34282bdfc54224247e11be3784407fe/src/GPD.jl#L55

be different from the corresponding one in loo?

https://github.com/stan-dev/loo/blob/9b9a8a81928f37895772d7977b433894d837082d/R/gpdfit.R#L41

Specifically, why use

(grid_size + 1) / $(1:grid_size)

instead of

grid_size / ($(1:grid_size) + 0.5)

?

ParadaCarleton commented 1 year ago

It’s a slightly different continuity correction. If you plug them in a calculator you’ll see it doesn’t make a practical difference.

miguelbiron commented 1 year ago

It's true, the difference is small, but noticeable. In any case, I thought I'd raise this issue because it explains the difference I was seeing versus the loo package. Thanks for clarifying.