create_lambda {eesim} | R Documentation |
Create a series of mean outcome values
Description
Creates a vector of expected daily outcome count by relating exposure to baseline outcome values with the function:
log(\lambda_t) = log(B_t) + log(RR)*X_t
where \lambda_t
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_t
is the
simulated exposure on day t
.
The user may input a custom function to relate exposure, relative risk, and
baseline.
Usage
create_lambda(baseline, exposure, rr, cust_lambda_func = NULL, ...)
Arguments
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 |
Value
A numeric vector of mean outcome values for each day in the simulation.
Examples
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)