Description Usage Arguments Value Examples

View source: R/customizable_functions.R

Simulates daily outcome counts for each study day based on user specifications
for average outcome count, any underlying trends in expected outcome counts, and
the association between exposure and outcome. This function starts from a vector of
expected outcome count on each study day and simulates through a draw from a Poisson
distribution based on this expected daily value. If desired, a user can also use
a custom function to customize this stage of the simulation; see the vignette for
`eesim`

for more details and examples.

1 2 3 4 5 |

`exposure` |
A numeric vector of exposure values, typically the output
of |

`average_outcome` |
A non-negative numeric value specifying the average daily outcome count. |

`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 |

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

`rr` |
A non-negative numeric value specifying the relative risk (i.e., the relative risk per unit increase in the exposure). |

`start.date` |
A date of the format "yyyy-mm-dd" from which to begin simulating values |

`cust_base_func` |
A R object name specifying a user-made custom function for baseline trend. |

`cust_lambda_func` |
An R object name specifying a user-made custom function for relating baseline, relative risk, and exposure |

`cust_base_args` |
A list of arguments and their values used in the user-specified custom baseline function |

`cust_lambda_args` |
A list of arguments and their values used in the user-specified custom lambda function |

`cust_outdraw` |
An R object name specifying a user-created function to
randomize the outcome values off of the baseline for outcome values. This
function must take inputs |

`cust_outdraw_args` |
A list of arguments besides |

A dataframe with a simulated time series, with columns for
`date`

, `x`

(exposure), and `outcome`

.

1 2 3 | ```
exp <- sim_exposure(n = 5, central = 100, sd = 10, amp = .6,
exposure_type = "continuous")
sim_outcome(exposure = exp, average_outcome = 22, trend = "linear")
``` |

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.