Skip to content

Use proper, wide log-normal default priors in BEAUti - #111

Open
alexeid wants to merge 2 commits into
masterfrom
fix/proper-template-priors
Open

alexeid wants to merge 2 commits into
masterfrom
fix/proper-template-priors

Conversation

@alexeid

@alexeid alexeid commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Several of BEAUti's default priors are improper, and so is the hyperprior it adds. This PR replaces them with a single proper default, LogNormal(M = 0, S = 8) in log space (median 1, 95% from 1.6×10⁻⁷ to 6.4×10⁶), which is wide enough for any time unit. BEAST 3's BEAUti gets the same defaults (CompEvol/beast3#208).

Default priors

Prior Was Now
strict clock rate (Standard.xml) Uniform(0, ∞), improper LogNormal(0, 8)
clock rate, relaxed mean rate (ClockModels.xml) Gamma(0.01, 100) LogNormal(0, 8)
mutation rate (Standard.xml, SubstModels.xml) OneOnX, improper LogNormal(0, 8)
Yule birth rate Uniform(0, ∞), improper LogNormal(0, 8)
calibrated-Yule and birth-death birth rates Uniform(0, 1000) LogNormal(0, 8)
constant and exponential coalescent population size OneOnX, improper LogNormal(0, 8)
EBSP populationMean Gamma(0.01, 100) LogNormal(0, 8)
Bayesian skyline, first population size Jeffreys (1/x), improper exponential with an estimated mean, bPopSizesInitialMean: LogNormal(0, 8) prior, scale operator, trace-log column

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. The birth–death relative death rate (Uniform(0, 1)) and the other proper defaults are unchanged.

Hyperprior

Ticking "estimate" on a prior's own parameter added a OneOnX hyperprior with a scale operator. That's improper, and a scale operator can't move a value of 0, such as a LogNormal's M = 0. Now:

  • A positive parameter (lower bound ≥ 0 or value > 0) gets LogNormal(0, 8) with a scale operator.
  • Any other gets Normal(0, 8) with a random-walk operator.

Legacy parameters often have no lower bound even when they're positive (a LogNormal's S, for example), hence the value test.

Testing

  • I compiled the changed classes against BEAST.base 2.7.9 and BEAST.app 2.7.8. With them and these templates, beauti -nex anolis.nex -exitaction writexml writes a Yule analysis with the new birth-rate prior, and it runs.
  • I didn't run the TestFX GUI tests (ant isn't installed here, and on macOS the tests drive the real mouse). So the non-default templates (skyline, coalescent, birth–death, relaxed clock) and the hyperprior dialog haven't been exercised in the GUI. Please run the BeastFX tests, or click through these before merging.
  • The same model changes, run as BEAST 2 examples in Give the calibration and tree-prior examples proper priors beast2#1225, match BEAST 3 in all ten examples.

Several default priors were improper: Uniform(0, Infinity) on the
strict clock rate and the Yule birth rate, OneOnX (1/x) on the mutation
rate and the constant and exponential coalescent population sizes, and
a Jeffreys (1/x) prior on the first Bayesian skyline population size.
Others were Gamma(0.01, 100), which has about half its mass below 1e-28,
or Uniform(0, 1000) on birth rates.

Use LogNormal(M=0, S=8) in log space (median 1, 95% from 1.6e-7 to
6.4e6) for the clock rates (strict and relaxed mean), mutation rate,
Yule, calibrated-Yule and birth-death birth rates, the coalescent
population sizes and the EBSP populationMean. The same defaults are
being adopted in BEAST 3's BEAUti (CompEvol/beast3).

The Bayesian skyline's 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.

The hyperprior BEAUti adds when a prior's own parameter is estimated
was OneOnX, which is improper. A positive parameter (lower bound >= 0
or value > 0) now gets LogNormal(0, 8) with a scale operator; any
other, such as a LogNormal's M = 0, gets Normal(0, 8) with a random-walk
operator, since a scale operator cannot move a value of 0.

Checked by compiling the changed classes against BEAST.base 2.7.9 and
writing a Yule analysis of anolis.nex with "beauti -exitaction
writexml", which runs. The GUI tests were not run.
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