-
Notifications
You must be signed in to change notification settings - Fork 2
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
Debug curve plot #323
Conversation
📖 https://ucd-serg.github.io/serocalculator/preview/pr323 |
@sschildhauer please review this PR; this is a good opportunity to get you up to speed on github code review |
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
ab0 <- function( | ||
t, | ||
curve_params) { | ||
ab0 <- function(t, curve_params) { |
There was a problem hiding this comment.
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"]] |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
fixes UCD-SERG/shiny_decay_curve#4 by handling r = 1 case specially;
$y(t) = y_1 e^{-v(t-t_1)}$
is undefined when r = 1, but the limit is