Skip to content

Use has_uncertainty() in discretise() to avoid the sd() message - #182

Merged
sbfnk merged 1 commit into
mainfrom
issue-181-discretise-prints-an-sd-message-for-unce
Dec 1, 2026
Merged

sbfnk merged 1 commit into
mainfrom
issue-181-discretise-prints-an-sd-message-for-unce

Conversation

@sbfnk-bot

Copy link
Copy Markdown
Collaborator

discretise() checked for uncertain parameters with !is.na(sd(x)). For an uncertain distribution, sd() prints a message about fix_parameters(), so discretise(x, strict = FALSE) showed a message about a call the user did not make. The check now uses has_uncertainty(x), which tests the parameters directly and prints nothing. Behaviour is otherwise unchanged. NEWS entry added.

A new test in test-lognormal.R calls discretise() with strict = FALSE on an uncertain, bounded LogNormal() and expects no message. It fails without the change. Only test-lognormal.R was run; the rest of the suite is left to CI.

This PR closes #181.

Co-authored-by: sbfnk <sebastian.funk@lshtm.ac.uk>
@sbfnk-bot
sbfnk-bot marked this pull request as ready for review December 1, 2026 15:02
@sbfnk-bot
sbfnk-bot requested a review from sbfnk December 1, 2026 15:03
@sbfnk
sbfnk merged commit b981da4 into main Dec 1, 2026
11 checks passed
@sbfnk
sbfnk deleted the issue-181-discretise-prints-an-sd-message-for-unce branch December 1, 2026 15:06
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.

discretise() prints an sd() message for uncertain distributions

2 participants