Skip to content

LBDP destructive sampling: parameter hardening and full BDD(r) inference#2

Open
Horopter wants to merge 1 commit intokingaa:bddrfrom
Horopter:codex/attempt-2
Open

LBDP destructive sampling: parameter hardening and full BDD(r) inference#2
Horopter wants to merge 1 commit intokingaa:bddrfrom
Horopter:codex/attempt-2

Conversation

@Horopter
Copy link

@Horopter Horopter commented Feb 5, 2026

What this changes

  • Parameter hardening

    • C++ bounds checks for r in src/lbdp.cc and yaml/src/lbdp.cc (0 <= r <= 1).
    • r and n0 validation in yaml/R/lbdp.R for runLBDP and continueLBDP.
  • Full BDD(r) inference (0 ≤ r ≤ 1)

    • Exact likelihood (R/lbdp_exact.R): General-r formula using saturation (non-destructive vs destructive samples). Removed r == 0 restriction; lbdp_exact now accepts 0 <= r <= 1.
    • POMP filter (src/lbdp_pomp.c): Comment that the filter supports BDD(r). Logic was already r-aware; no behavioral change.
    • Docs: R/lbdp.R, R/lbdp_exact.R, man/lbdp.Rd updated so destructive sampling is documented for both exact and pfilter inference.
  • Tests (tests/lbdp4.R)

    • Invalid r still rejected (try blocks).
    • Saturation checks for r=0 and r=1 simulations.
    • lbdp_exact and lbdp_pomp (pfilter) return finite likelihood for r=0.4.
    • Calibration: for r ∈ {0, 0.5, 1}, simulate tree, compare exact and pfilter log-likelihood; pfilter must be within tolerance of exact.

Why

Completes BDD(r) support on the bddr branch: hardening for r and n0, plus inference (exact and particle filter) for 0 <= r <= 1, with tests ensuring exact and pfilter agree.

Validation

  • R CMD INSTALL .
  • Rscript tests/lbdp4.R

@Horopter Horopter changed the title Harden LBDP destructive-sampling parameter handling LBDP destructive sampling: parameter hardening and full BDD(r) inference Feb 5, 2026
- Parameter hardening: C++ r bounds in src/lbdp.cc, yaml; r and n0 checks in yaml/R/lbdp.R
- Full BDD(r) inference: lbdp_exact general-r likelihood (0<=r<=1), filter docs, R/man docs
- Tests: invalid r, saturation, exact/pfilter for r=0.4, calibration over r in {0,0.5,1}
@Horopter Horopter force-pushed the codex/attempt-2 branch 2 times, most recently from e795585 to db51862 Compare February 5, 2026 20:38
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