calc_t: Create a continuous exposure trend vector

Description Usage Arguments Value Examples

View source: R/sim_exposure.R

Description

Creates a trend vector for a continuous exposure.

Usage

1
2
calc_t(n, trend = "no trend", slope = 1, amp = 0.6, custom_func = NULL,
  ...)

Arguments

n

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

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.

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.

custom_func

An R object specifying a customized function from which to create a trend variable. Must accept the arguments n and mean.

...

Optional arguments to a custom trend function

Value

A numeric vector of simulated exposure values for each study day, to be used to generate data with seasonal trends.

Examples

1
calc_t(5, "cos3", amp = .5)

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