Repository navigation
Use proper, wide log-normal default priors in BEAUti - #208
Merged
Merged
Conversation
Replace the Gamma(0.01, 100) default priors in the templates with LogNormal(M=0, S=8) in log space (median 1, 95% from 1.6e-7 to 6.4e6): the clock rate (strict and the relaxed-clock mean rate), the mutation rate, the Yule, calibrated-Yule and birth-death birth rates, the constant and exponential coalescent population sizes, and the EBSP populationMean. Gamma(0.01, 100) has about half its mass below 1e-28, so it acts like a 1/x prior with an arbitrary cutoff far below any meaningful value. The GTR rate priors, Gamma(0.05, 10), are unchanged. The Bayesian skyline template put an improper Jeffreys (1/x) prior on the first population size. The first population size now has an exponential prior with an estimated mean (bPopSizesInitialMean) that has a LogNormal(0, 8) prior, a scale operator and a trace-log column. BEAUti's hyperprior, added when a prior's own parameter is estimated, was always LogUniform with a scale operator. That is invalid for a parameter that may be negative, such as a LogNormal's M; with the new defaults M = 0, so estimating it made BEAUti write XML that did not parse. A non-negative parameter now gets a LogNormal(0, 8) hyperprior with a scale operator, and a Real-domain one a Normal(0, 8) hyperprior with a random-walk operator. Update SimpleTreePriorTest for the skyline's new parameter and HyperPriorTest for the hyperprior distributions. The beast-fx tests pass, slow ones included.
walterxie
added a commit
that referenced
this pull request
Nov 6, 2026
…odel input Review requests from alexeid on #204: 1. Proper priors, in both versions (BEAST 3 examples and the BEAST 2 files in legacy/), as in #199 and BEAUti's defaults (#208): LogNormal(0, 8) for rates and sizes, LogNormal(1, 1.25) for kappa. Replaces the improper flat, OneOnX and Uniform(0, Infinity) priors, and the LogUniform stand-ins. 2. BactrianSubtreeSlide starts at its tuned size (BEAST 3 runs, acceptance about 0.3) instead of 1.0. The sizes are kept rather than BEAUti's new 0.01 (#201); each file's comment says why. 4. SequenceSimulator / SimulatedAlignment: branchRateModel takes the BranchRateModel interface, so legacy clocks are accepted too. Also: - Move the BEAST 2 seqgen files to beast.fx/examples/legacy/, next to their BEAST 3 conversions (they need beast-fx classes). - legacy/README.md: the legacy/ files are BEAST 2 XML, not converted, and must still run in BEAST 2.8.x with the old (deprecated) classes. - Test that the legacy examples still parse: a new method in beast-base's ExampleXmlParsingTest, and a beast-fx ExampleXmlParsingTest for the beast-fx examples and their legacy sources. - Update MIGRATION-REPORT-batch2.md; add TODO-migrate-legacy-xmls-batch2.md for the open requests (3: posterior comparison with 2.7.9; 5: release scripts end to end).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes all of BEAUti's default priors proper, and wide enough for any time unit. The default is LogNormal(M = 0, S = 8) in log space: median 1, 95% from 1.6×10⁻⁷ to 6.4×10⁶. BEAST 2.7's BEAUti gets the same defaults (CompEvol/BeastFX#111).
Default priors
populationMean. Gamma(0.01, 100) is proper, but about half its mass lies below 10⁻²⁸. In practice it's a 1/x prior with an arbitrary cutoff far below any meaningful value.jeffreys="true"on unbounded popSizes). It now has an exponential prior with an estimated mean (bPopSizesInitialMean), which has a LogNormal(0, 8) prior, a scale operator and a trace-log column.Hyperprior
Ticking "estimate" on a prior's own parameter added a LogUniform hyperprior with a scale operator, whatever the parameter's domain. For a Real-domain parameter such as a LogNormal's M, that's invalid whenever M ≤ 0. With M = 0, which is now the default, BEAUti wrote XML that failed to parse ("Tensor param is not valid"). Now:
PositiveReal,NonNegativeReal,UnitInterval) gets LogNormal(0, 8) with a scale operator. A continuous parameter is exactly 0 with probability 0, so these are in practice positive.Tests
SimpleTreePriorTestis updated for the skyline's new parameter, andHyperPriorTestfor the new hyperprior distributions.beast-fxtests pass: 52 run, 0 failures, 4 skipped, plus the slow ones (BeautiCLITest,BeautiDivergenceDatingTest,BeautiRateTutorialTest,BeautiStarBeastTest).Independent of #199 and #201. It touches the same template files as #201, which changes only the subtree-slide size, but different lines.