prob_detectable <- function(time_since_inf, dt) {
. <- NULL
p <- NULL
prob_detect <- data.table::copy(dt)[
,
p := boot::inv.logit(
beta1 + beta2 * (time_since_inf - cutpoint) +
(time_since_inf - cutpoint) * beta3 * beta2 * fifelse(
time_since_inf - cutpoint > 0, 1, 0
)
)
]
prob_detect <- prob_detect[
,
.(sample = 1:data.table::.N, time = time_since_inf, p)
]
return(prob_detect)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.