create_lambda: Create a series of mean outcome values

Description Usage Arguments Value Examples

View source: R/customizable_functions.R

Description

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.

Usage

1
create_lambda(baseline, exposure, rr, cust_lambda_func = NULL, ...)

Arguments

baseline

A non-negative numeric vector of baseline outcome values, typically the output of create_baseline.

exposure

A numeric vector of exposure values, typically the output of sim_exposure.

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

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)

eesim documentation built on May 2, 2019, 7:30 a.m.