Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug curve plot #323

Merged
merged 12 commits into from
Dec 20, 2024
Merged

Debug curve plot #323

merged 12 commits into from
Dec 20, 2024

Conversation

d-morrison
Copy link
Member

@d-morrison d-morrison commented Dec 4, 2024

fixes UCD-SERG/shiny_decay_curve#4 by handling r = 1 case specially;
Pasted Graphic
is undefined when r = 1, but the limit is $y(t) = y_1 e^{-v(t-t_1)}$

@d-morrison d-morrison marked this pull request as ready for review December 4, 2024 03:24
Copy link

github-actions bot commented Dec 4, 2024

📖 https://ucd-serg.github.io/serocalculator/preview/pr323
Preview documentation for this PR (at commit 2b540a6)

@d-morrison
Copy link
Member Author

@sschildhauer please review this PR; this is a good opportunity to get you up to speed on github code review

@d-morrison d-morrison added bug an unexpected problem or unintended behavior backend internal functions, etc labels Dec 4, 2024
Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
R/ab0.R 100.00% <100.00%> (+100.00%) ⬆️

... and 2 files with indirect coverage changes

ab0 <- function(
t,
curve_params) {
ab0 <- function(t, curve_params) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint

y0 <- curve_params[["y0"]]
y1 <- curve_params[["y1"]]
t1 <- curve_params[["t1"]]
alpha <- curve_params[["alpha"]]
shape <- curve_params[["r"]]
r <- curve_params[["r"]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shortening varname to make lines below fit in less than 80 characters


beta <- bt(y0, y1, t1)

yt <- 0

yt_phase_1 <- y0 * exp(beta * t)
yt_phase_2 <- (y1^(1 - shape) - (1 - shape) * alpha * (t - t1))^(1 / (1 - shape))
if (r == 1) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if r == 1, the usual expression for this function reduces to 0^Inf = 0, which isn't correct; as r -> 1, the function should reduce to the exponential.

@kristinawlai kristinawlai merged commit ce83d48 into main Dec 20, 2024
14 checks passed
@kristinawlai kristinawlai deleted the debug-curve-plot branch December 20, 2024 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend internal functions, etc bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

investigate why r=1 produces surprising results
2 participants