Description Usage Arguments Value Examples
View source: R/customizable_functions.R
Creates a vector of expected daily outcome count by relating exposure to baseline outcome values with the function:
log(λ) = log(B) + log(RR)*X
where λ is the expected outcome count on day t, B is the expected base outcome count on day t (incorporating long-term and seasonal trends, but not the influence of the exposure), RR is the relative risk of the outcome for a one-unit increase in exposure, and X is the simulated exposure on day t. The user may input a custom function to relate exposure, relative risk, and baseline.
1 | create_lambda(baseline, exposure, rr, cust_lambda_func = NULL, ...)
|
baseline |
A non-negative numeric vector of baseline outcome values,
typically the output of |
exposure |
A numeric vector of exposure values, typically the output
of |
rr |
A non-negative numeric value specifying the relative risk (i.e., the relative risk per unit increase in the exposure). |
cust_lambda_func |
An R object name specifying a user-made custom function for relating baseline, relative risk, and exposure |
... |
Optional arguments for a custom lambda function |
A numeric vector of mean outcome values for each day in the simulation.
1 2 3 4 5 | base <- create_baseline(n = 10, average_baseline = 22, trend = "linear",
slope = .4)
exp <- sim_exposure(n = 5, central = 100, sd = 10, amp = .6,
exposure_type = "continuous")
create_lambda(baseline = base, exposure = exp$x, rr = 1.01)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.