Creates a trend vector for binary exposure data, centered at a probability p.
bin_t(n, p, trend = "no trend", slope = 1, amp = 0.01,
start.date = "2000-01-01", custom_func = NULL, ...)A non-negative integer specifying the number of days to simulate.
A numeric value between 0 and 1 giving the mean probability of exposure across study days.
A character string that gives the trend function to use. Options are:
"no trend": No trend, either seasonal or long-term (default).
"cos1": A seasonal trend only.
"cos2": A seasonal trend with variable amplitude across years.
"cos3": A seasonal trend with steadily decreasing amplitude over time.
"linear": A linear long-term trend with no seasonal trend.
"monthly": Uses a user-specified probability of exposure for each month.
A numeric value specifying the slope of the trend, to be used
with trend = "linear" or trend = "cos1linear".
A numeric value specifying the amplitude of the seasonal trend. Must be between -.5 and .5.
A date of the format "yyyy-mm-dd" from which to begin simulating values.
An R object specifying a customized function from
which to create a trend variable. Must accept arguments n and
p.
Optional arguments to a custom trend function
A numeric vector of daily expected probability of exposure, to be used to generate binary exposure data with seasonal trends.
bin_t(n = 5, p = .3, trend = "cos1", amp = .3)
Run the code above in your browser using DataLab