simulate_cougher: Generate a simulated cough timeline for a user

Description Usage Arguments Value

View source: R/simulate_cougher.R

Description

Simulate an hourly cough timeseries for an imaginary user.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
simulate_cougher(
  rate_mean,
  rate_variance = NULL,
  hours = 24 * 30,
  start_timestamp = as.numeric(Sys.time()),
  tz = Sys.timezone(),
  distribution = "nb",
  format_time = TRUE,
  random_seed = NULL
)

Arguments

rate_mean

Mean hourly cough rate

rate_variance

Variance in the hourly cough rate. If left NULL, variance will be estimated using one of Hyfe's standard regression models, which should produce realistic results for any scenario.

hours

Duration of time series, in hours. Default is 720 (about a month).

start_timestamp

Optional start timestamp (seconds since midnight UTC on January 1, 1970). Default is to use your system's current time.

tz

Optional timezone for timestamp. Default is your system timezone.

distribution

The frequency distribution to base the simulation upon. Default is 'nb', negative binomial. This is currently the only option.

format_time

If TRUE (the default), formatted date/time variables will be returned using format_hyfe_time(). It may be useful to change this to FALSE if conducting iterative analyses that rely on speed.

random_seed

Set the random number generator seed in order to replicate a cougher.

Value

A dataframe with a timestamp column, a coughs column, and a dummy rec column in which all rows have 1 full hour of "recording". If format_time is TRUE, additional date/time variables are provided. See format_hyfe_time() or (this section of the vignette)https://hyfe-ai.github.io/hyfer/#hyfetime.


hyfe-ai/hyfer documentation built on Dec. 20, 2021, 5:53 p.m.