Declare the predictor prior scale - #350
Conversation
|
The PR body was updated to include the factorised hurdle preflight coverage and its zero-component-call regression tests. |
|
Independent review completed after two cycles. One real problem was found in the original PR: factorised hurdle fits and amendments validated the growth and survival components sequentially. If negative predictor values occurred only among deaths, the growth component could begin sampling before the survival component rejected This is fixed by validating the complete predictor before either component call and explicitly forwarding the validated declaration to both components. Regression tests now verify that invalid full predictors cause zero component calls. The reviewer independently reproduced the corrected behaviour and found no remaining defects on re-review. |
What
Adds an explicit
predictor_scaledeclaration to the default-prior routes. A user who supplies an already logged predictor can now selectpredictor_scale = "log", including when every value is non-negative."concentration"makes the recorded-concentration interpretation explicit, and"auto"retains the existing sign-based choice.Closes #317.
Why it matters
The
necandec50prior no longer has to depend on the units used to record an experiment. On the declared log scale,log(1) = 0remains a tested predictor value rather than being discarded as a zero control.Scientific decision
No property of a numeric column can distinguish precomputed logged values from recorded concentrations. The new declaration is therefore explicit. The default remains
"auto"so existing calls and published analyses retain their priors."log"keeps every distinct supplied value and builds the existing normal prior on that scale."concentration"omits zero controls, logs the positive concentrations, and builds the existing lognormal prior. It refuses negative values before any model or grouped level is fitted. The historical uninformative widths remain unchanged:10 * sd(x)on an already logged predictor and the 95% coverage width on recorded concentrations. The"regularizing"set retains its 98% coverage rule.Validation
test-define_prior.R, including the 30-cell The nec/ec50 gamma prior cannot describe a log-spaced concentration series #302/The regularizingnecandec50prior is uniform where the predictor is supplied logged #314 regression gatestest-fit_bayesnec.R, withbrm()mocked to inspect the fitted priortest-bnec.Randtest-bnec_group.R, including pre-loop refusaltest-bnec_hurdle.Randtest-bayesnechurdlefit-methods.R, includingzero-component-call refusal for factorised fits and amendments
get_priors(..., predictor_scale = "log")R CMD check --no-manual --no-build-vignettes --no-tests: two existing vignette warnings and two existing code/package-structure notes; no new findingImplementation detail
The declaration is passed through
bnec(),get_priors(),amend(),bnec_group(), factorised hurdle fits and joint hurdle/zero-inflated prior construction.validate_predictor_scale()centralises the accepted values and checks a declared concentration scale before model or group loops.predictor_prior()repeats the validation as a backstop for internal routes.The internal vector previously named
predictor_scalewas renamedprior_predictor; it represents the whole predictor used to prime and bound both blocks of a joint fit, not the user's scale declaration.