Skip to content

Make ltriangle density floor relative to scale - #184

Merged
joethorley merged 2 commits into
add-triangle-distributionfrom
joethorley/ltriangle-relative-floor
Jul 14, 2026
Merged

Make ltriangle density floor relative to scale#184
joethorley merged 2 commits into
add-triangle-distributionfrom
joethorley/ltriangle-relative-floor

Conversation

@joethorley

Copy link
Copy Markdown
Member

Follow-up to #169 (targets the add-triangle-distribution branch).

Addresses the statistical review item on the soft density floor in the log-triangular likelihood.

The uncensored branch of ll_ltriangle.hpp floors the density argument to keep the likelihood finite when a candidate support fails to cover a data point. That floor was an absolute 1e-8, which is not consistent across data magnitudes (the density argument has the units of scalelog, so an absolute floor bites differently depending on the scale of the data). It is now relative: 1e-8 * scalelog, i.e. a fixed fraction of the peak density argument.

  • Fits where the support covers the data are unchanged (the floor never binds), so no existing snapshots change.
  • Added a scale-invariance test: scaling all concentrations by 1000 leaves scalelog unchanged, shifts locationlog by log(1000), and scales the HC5 by 1000. This property is what a scale-relative floor protects and an absolute floor can break at extreme magnitudes.

Per your steer on the review, this is the "relative to scale" option. Note this keeps the soft-barrier design (a non-covering fit still receives a finite likelihood / AIC weight); flagging such fits as invalid would be a larger, separate change if wanted.

🤖 Generated with Claude Code

joethorley and others added 2 commits July 14, 2026 13:08
Follow-up to #169.

The soft density floor in the log-triangular likelihood was an absolute
1e-8, which is not scale-consistent across data magnitudes. It is now
1e-8 * scalelog (a fraction of the peak density argument) so the soft
barrier behaves the same regardless of the magnitude of the data. Fits
where the support covers the data are unchanged (the floor never binds),
so no existing snapshots change. Adds a scale-invariance test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joethorley
joethorley merged commit e4ab438 into add-triangle-distribution Jul 14, 2026
@joethorley
joethorley deleted the joethorley/ltriangle-relative-floor branch July 14, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant