Skip to contents

Begin creating a simulated dataset.

Usage

brm_simulate_outline(
  n_group = 2L,
  n_subgroup = NULL,
  n_patient = 100L,
  n_time = 4L,
  rate_dropout = 0.1,
  rate_lapse = 0.05
)

Arguments

n_group

Positive integer of length 1, number of treatment groups.

n_subgroup

Positive integer of length 1, number of subgroup levels. Set to NULL to omit the subgroup entirely.

n_patient

Positive integer of length 1. If n_subgroup is NULL, then n_patient is the number of patients per treatment group. Otherwise, n_patient is the number of patients per treatment group per subgroup. In both cases, the total number of patients in the whole simulated dataset is usually much greater than the n_patients argument of brm_simulate_outline().

n_time

Positive integer of length 1, number of discrete time points (e.g. scheduled study visits) per patient.

rate_dropout

Numeric of length 1 between 0 and 1, post-baseline dropout rate. A dropout is an intercurrent event when data collection for a patient stops permanently, causing the outcomes for that patient to be missing during and after the dropout occurred. The first time point is assumed to be baseline, so dropout is there. Dropouts are equally likely to occur at each of the post-baseline time points.

rate_lapse

Numeric of length 1, expected proportion of post-baseline outcomes that are missing. Missing outcomes of this type are independent and uniformly distributed across the data.

Value

A data frame from brm_data() with attributes to define roles for various columns in the dataset. The data frame has one row per patient per time point and the following columns:

  • group: integer index of the treatment group.

  • patient: integer index of the patient.

  • time: integer index of the discrete time point.

Examples

brm_simulate_outline()
#> # A tibble: 800 × 5
#>    response missing group   time   patient    
#>       <dbl> <lgl>   <chr>   <chr>  <chr>      
#>  1       NA FALSE   group_1 time_1 patient_001
#>  2       NA FALSE   group_1 time_2 patient_001
#>  3       NA FALSE   group_1 time_3 patient_001
#>  4       NA FALSE   group_1 time_4 patient_001
#>  5       NA FALSE   group_1 time_1 patient_002
#>  6       NA FALSE   group_1 time_2 patient_002
#>  7       NA FALSE   group_1 time_3 patient_002
#>  8       NA FALSE   group_1 time_4 patient_002
#>  9       NA FALSE   group_1 time_1 patient_003
#> 10       NA FALSE   group_1 time_2 patient_003
#> # ℹ 790 more rows