std_exposure: Simulate exposure data using default methods

Description Usage Arguments Value Examples

View source: R/sim_exposure.R

Description

Simulates binary or continuous exposure data with or without seasonal trends using default functions.

Usage

1
2
std_exposure(n, central, sd = NULL, trend = "no trend",
  exposure_type = "binary", slope, amp, start.date = "2000-01-01", ...)

Arguments

n

A non-negative integer specifying the number of days to simulate.

central

A numeric value specifying the mean probability of exposure (for binary data) or the mean exposure value (for continuous data).

sd

A numeric value giving the standard deviation of the exposure values from the exposure trend line.

trend

A character string that specifies the desired trend function. 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.

  • "curvilinear": A curved long-term trend with no seasonal trend.

  • "cos1linear": A seasonal trend plus a linear long-term trend.

See the package vignette for examples of the shapes of these trends.

exposure_type

A character string specifying the type of exposure. Choices are "binary" or "continuous".

slope

A numeric value specifying the slope of the trend, to be used with trend = "linear" or trend = "cos1linear".

amp

A numeric value specifying the amplitude of the seasonal trend. Must be between -1 and 1.

start.date

A date of the format "yyyy-mm-dd" from which to begin simulating daily exposures

...

Optional arguments to a custom trend function

Value

A data frame with two columns: date (date) and simulated exposure values (x).

Examples

1
2
3
4
5
std_exposure(n = 5, central = .1, trend = "cos1", amp = .02)
std_exposure(n = 5, central = 50, sd = 5, trend = "cos3", amp = .6,
             exposure_type = "continuous", start.date = "2001-04-01")
std_exposure(n=50, central=.1, amp=.05,cust_expdraw=rnbinom,
             cust_expdraw_args=list(size=10))

eesim documentation built on June 4, 2017, 1:03 a.m.