You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use posterior functions where possible / avoid duplication of code #408
We have certain functions in loo that are more or less copies from code in posterior.
For loo v3.0.0, we need to inspect the loo code base and replace all function definitions that can be replaced by exporting the equivalent function from posterior. This avoids code duplication and reduces maintainability effort.
Hi @florence-bockting,I would like to work on this for v3.0.0 if nobody else is on it.I compared loo and posterior on current main:
is_constant is identical,so loo can use posterior::is_constant
gpdfit already calls posterior::gpdfit
ps_khat_threshold is different,loo caps it at 0.7 and posterior does not
n_pareto uses r_eff and ceiling(),while posterior::ps_tail_length ignores r_eff and uses floor()
So switching the last two would change results.Should those also move to the posterior versions,or stay in loo for now?
Hello @soujasK, thank you for your interest on working on this topic and supporting loo.
We have submitted yesterday (2026-11-18) a new Cran release of posterior. So, perhaps it makes sense to wait for this one until we can see in Cran (https://cloud.r-project.org/web/packages/posterior/index.html) that the date in "published" is updated.
Then it might make sense to do a re-evaluation and list all the functions that you would change/modify in this issue.
Afterwards you can perhaps simply tag us again (@jgabry , @VisruthSK, and me) and then we can give the "Go" and you can move on doing the PR.
Hi @florence-bockting@jgabry@VisruthSK,posterior 1.8.0 is now on CRAN so I redid the comparison against current loo master.Most functions listed in #249 are already gone from loo.What is left:
is_constant:identical to posterior::is_constant (exported),so I would remove the loo copy and use posterior's
exp_x_minus_exp_y:identical,but it is internal in posterior,so I would keep the loo copy unless posterior exports it
ps_khat_threshold:loo caps it at 0.7 and posterior does not,so switching would change results
n_pareto vs posterior::ps_tail_length:loo uses r_eff and ceiling(),posterior ignores r_eff and uses floor(),so also a behaviour change
gpdfit:loo already just calls posterior::gpdfit,I would keep the wrapper since loo exports it
So my plan would be to replace is_constant only,and keep the others unless you want ps_khat_threshold and n_pareto to follow posterior.Does that sound ok?
Activity
VisruthSK commentedon Oct 17, 2026
See also #249
soujasK commentedon Nov 17, 2026
Hi @florence-bockting,I would like to work on this for v3.0.0 if nobody else is on it.I compared loo and posterior on current main:
So switching the last two would change results.Should those also move to the posterior versions,or stay in loo for now?
florence-bockting commentedon Nov 18, 2026
Hello @soujasK, thank you for your interest on working on this topic and supporting loo.
We have submitted yesterday (2026-11-18) a new Cran release of posterior. So, perhaps it makes sense to wait for this one until we can see in Cran (https://cloud.r-project.org/web/packages/posterior/index.html) that the date in "published" is updated.
Then it might make sense to do a re-evaluation and list all the functions that you would change/modify in this issue.
Afterwards you can perhaps simply tag us again (@jgabry , @VisruthSK, and me) and then we can give the "Go" and you can move on doing the PR.
I hope this sounds reasonable =) Thank you again.
soujasK commentedon Nov 19, 2026
Hi @florence-bockting @jgabry @VisruthSK,posterior 1.8.0 is now on CRAN so I redid the comparison against current loo master.Most functions listed in #249 are already gone from loo.What is left:
So my plan would be to replace is_constant only,and keep the others unless you want ps_khat_threshold and n_pareto to follow posterior.Does that sound ok?