binary_exposure {eesim} | R Documentation |
Simulate binary exposure data
Description
Simulates a time series of binary exposure values with or without seasonal trends.
Usage
binary_exposure(n, p, trend = "no trend", slope, amp = 0.05,
start.date = "2000-01-01", cust_expdraw = NULL,
cust_expdraw_args = list(), custom_func = NULL, ...)
Arguments
n |
A non-negative integer specifying the number of days to simulate. |
p |
A numeric value between 0 and 1 giving the mean probability of exposure across study days. |
trend |
A character string that gives the trend function to use. Options are:
|
slope |
A numeric value specifying the slope of the trend, to be used
with |
amp |
A numeric value specifying the amplitude of the seasonal trend. Must be between -.5 and .5. |
start.date |
A date of the format "yyyy-mm-dd" from which to begin simulating daily exposures |
cust_expdraw |
An R object name specifying a user-created function which determines the distribution of random noise off of the trend line. This function must have inputs "n" and "prob" and output a vector of simulated exposure values. |
cust_expdraw_args |
A list of arguments other than |
custom_func |
An R object specifying a customized function from
which to create a trend variable. Must accept arguments |
... |
Optional arguments to a custom trend function |
Value
A data frame with columns for the dates and daily exposure values for
n
days.
Examples
binary_exposure(n = 5, p = 0.1, trend = "cos1", amp = .02,
start.date = "2001-02-01")
binary_exposure(n=10, p=.1, cust_expdraw=rnbinom,
cust_expdraw_args=list(size=10))