Function to simulate studies that mimic the infection duration data from Duong et al. 2015 (or another external dataset)

simExternal(nsims, phi.func = NULL, ext_df = NULL)

Arguments

nsims

Number of study simulations

phi.func

Optional recency test-positive function

ext_df

A dataset with column "duration" and column for binary "recent" indicator

Value

List of data frames with an id, time, and recency indicator

Examples

set.seed(0)
study <- simExternal(nsims=1, phi.func=function(t) 1 - pgamma(t, 1, 1.5))
head(study)
#>   id durations recent
#> 1  1 0.1505818      1
#> 2  1 0.2600958      1
#> 3  1 0.4407940      1
#> 4  1 0.6844627      0
#> 5  1 1.0458590      0
#> 6  1 1.3552361      0