Skip to contents

This combines the covariates simulation via simul_covariates() with 10 categorical covariates, and the PFS simulation via simul_pfs().

Usage

simul_data(n, add_interaction = FALSE, coefs, ...)

Arguments

n

(count)
number of patients.

add_interaction

(flag)
whether to add interaction terms between covariates 1 and 2.

coefs

(numeric)
named vector of coefficients to set.

...

additional parameters apart from the linear predictor values needed for simul_pfs().

Value

A combined data.frame with the id column, the design matrix and the PFS outcomes.

Details

Regression coefficients are for an AFT with over-parametrized dummy coding for arm-subgroup interactions.

Examples

set.seed(321)
simul_data(
  n = 100,
  coefs = c(arm1 = 1),
  sigma_aft = 1,
  recr_duration = 0.2,
  rate_cens = 2,
  n_events = 20
)
#>      id arm x_1 x_2 x_3 x_4 x_5 x_6 x_7 x_8 x_9 x_10       tt_pfs ev_pfs
#> 1     1   1   a   a   b   a   b   b   b   c   b    c 0.1282226880      0
#> 2     2   1   b   a   b   b   c   b   b   c   a    c 0.1767947720      0
#> 3     3   1   b   a   b   c   a   b   a   a   a    c 0.0375620848      0
#> 4     4   1   b   b   a   c   d   b   a   b   b    a 0.0992460062      0
#> 5     5   0   a   a   a   a   d   b   b   b   b    b 0.1145271123      1
#> 6     6   0   b   a   b   a   d   b   a   c   b    b 0.3823918472      0
#> 7     7   0   b   b   b   c   c   b   a   a   b    c 0.2811471708      1
#> 8     8   1   a   b   b   b   d   a   b   b   b    b 0.3410860911      0
#> 9     9   1   a   b   b   a   d   a   a   c   b    c 0.3240451190      0
#> 10   10   1   b   b   b   c   d   b   b   c   b    b 0.3425044641      0
#> 11   11   1   a   b   b   c   a   b   b   c   b    c 0.3511962811      0
#> 12   12   1   a   b   a   a   a   b   b   a   b    c 0.1720379323      0
#> 13   13   0   a   a   b   c   b   b   a   b   b    a 0.0142147441      0
#> 14   14   0   b   b   b   b   a   a   a   c   b    c 0.2089344005      0
#> 15   15   0   a   a   b   c   d   a   a   a   a    b 0.4003985470      0
#> 16   16   1   b   b   b   b   d   b   a   c   b    a 0.3419909916      0
#> 17   17   0   b   a   b   c   a   b   b   b   b    c 0.3065957316      0
#> 18   18   0   b   a   b   b   a   b   b   b   b    c 0.2223906196      1
#> 19   19   0   b   b   b   b   a   b   b   c   b    c 0.1309563036      0
#> 20   20   0   a   b   a   b   c   a   b   b   b    c 0.1047233675      0
#> 21   21   1   b   b   b   b   d   a   a   b   b    c 0.1308613061      0
#> 22   22   0   b   a   b   a   d   b   a   c   b    a 0.3584195273      0
#> 23   23   0   a   b   b   c   d   b   b   c   b    c 0.2639375285      0
#> 24   24   0   a   a   b   b   d   b   b   c   b    a 0.2968136585      0
#> 25   25   0   a   a   b   b   c   a   a   c   b    a 0.2376888166      0
#> 26   26   1   a   a   a   c   b   a   a   b   b    b 0.0223674499      0
#> 27   27   1   b   a   b   a   a   b   b   a   a    a 0.1512378014      0
#> 28   28   1   b   b   b   b   b   a   a   a   b    c 0.4510755855      0
#> 29   29   0   b   b   b   c   d   b   a   b   b    a 0.2887533091      0
#> 30   30   1   b   a   b   b   a   a   a   c   b    b 0.3471475349      1
#> 31   31   1   b   a   b   a   c   b   b   b   b    a 0.1164908712      0
#> 32   32   0   b   a   b   b   d   a   a   a   b    b 0.3362654296      0
#> 33   33   1   b   a   b   c   c   a   b   b   b    c 0.0815441038      0
#> 34   34   1   a   b   b   b   b   b   a   c   b    c 0.3417314538      0
#> 35   35   0   b   b   a   c   d   b   a   c   b    c 0.2940085382      0
#> 36   36   0   a   b   b   b   b   a   a   a   b    b 0.3067394565      0
#> 37   37   0   a   b   a   a   c   b   b   b   a    a 0.0320812880      0
#> 38   38   1   b   b   b   b   a   b   a   c   b    c 0.2967510092      0
#> 39   39   1   a   b   b   c   d   b   a   c   b    c 0.2821629285      0
#> 40   40   1   a   b   a   a   c   b   b   a   b    c 0.3989537274      0
#> 41   41   0   b   b   b   a   c   b   b   c   a    a 0.1349419758      0
#> 42   42   0   b   b   b   b   b   a   b   b   b    c 0.0110019193      1
#> 43   43   0   a   a   a   c   c   b   b   c   b    c 0.3356035645      1
#> 44   44   0   a   b   b   a   b   b   b   a   b    b 0.0840718392      0
#> 45   45   1   b   a   b   a   d   a   b   a   b    c 0.0007563204      0
#> 46   46   1   b   b   b   c   b   b   b   a   b    c 0.2927920389      0
#> 47   47   0   b   a   b   b   d   b   b   c   b    b 0.2686126485      0
#> 48   48   1   a   b   b   b   a   a   a   b   b    c 0.2726582417      0
#> 49   49   1   a   b   b   a   b   a   a   a   b    c 0.2925882018      0
#> 50   50   0   b   b   b   c   d   b   b   c   b    a 0.0997201689      0
#> 51   51   1   b   b   b   c   a   b   a   c   b    a 0.0012828808      0
#> 52   52   0   b   a   b   c   d   a   a   c   b    a 0.3211381594      1
#> 53   53   1   a   a   b   c   c   b   a   c   b    b 0.3044618473      0
#> 54   54   0   a   b   b   a   d   a   b   b   b    b 0.2497000496      0
#> 55   55   0   b   a   a   a   c   a   b   a   b    b 0.1484089068      0
#> 56   56   1   a   b   b   b   c   b   b   c   a    b 0.2958200850      0
#> 57   57   0   b   b   a   b   c   b   a   c   b    c 0.2617488988      0
#> 58   58   1   a   a   b   a   a   b   a   c   b    c 0.0247151775      1
#> 59   59   0   b   b   b   b   b   b   a   b   b    c 0.3748451991      0
#> 60   60   0   a   a   b   b   a   a   a   c   b    c 0.0041083358      1
#> 61   61   1   b   b   b   c   d   b   a   b   b    c 0.0157443425      0
#> 62   62   1   a   b   b   c   a   b   a   c   b    c 0.3235550944      0
#> 63   63   0   b   a   a   b   d   b   a   b   b    c 0.4148607902      0
#> 64   64   1   a   a   b   b   d   a   b   a   b    a 0.0961596484      1
#> 65   65   0   a   b   b   a   d   b   b   c   b    c 0.0626320161      0
#> 66   66   1   b   b   b   c   d   b   b   c   a    a 0.0067666320      0
#> 67   67   1   b   b   b   b   d   a   a   c   b    b 0.4421577878      0
#> 68   68   1   a   a   b   c   c   b   b   a   b    c 0.2270726904      0
#> 69   69   0   b   b   b   a   a   b   b   b   b    c 0.3785837055      0
#> 70   70   1   b   b   b   c   d   b   a   c   a    a 0.0191520654      0
#> 71   71   1   a   b   b   b   c   b   b   b   b    a 0.3382673208      0
#> 72   72   0   a   b   b   c   c   b   b   a   b    b 0.0863618422      0
#> 73   73   0   a   a   b   a   b   b   b   c   a    c 0.3639538628      1
#> 74   74   0   a   b   b   a   c   b   b   c   b    c 0.0875243735      1
#> 75   75   0   a   b   b   b   c   a   b   b   b    c 0.1582868357      1
#> 76   76   1   b   b   b   c   a   b   b   c   b    c 0.2628716063      0
#> 77   77   0   b   a   b   a   b   b   b   b   b    c 0.0432361315      0
#> 78   78   0   a   b   a   b   c   b   a   b   b    c 0.3048109831      1
#> 79   79   0   b   a   b   b   c   a   b   a   b    c 0.1022586054      1
#> 80   80   0   a   b   b   c   d   b   a   b   b    c 0.1071161874      1
#> 81   81   0   b   b   b   c   d   b   a   a   b    b 0.1200884324      0
#> 82   82   1   b   b   b   b   d   b   a   b   b    b 0.3196011651      0
#> 83   83   1   a   b   b   c   b   a   a   a   b    b 0.0801926630      0
#> 84   84   0   b   a   b   a   a   b   a   c   a    b 0.0066999029      1
#> 85   85   1   b   a   b   b   c   b   b   c   b    c 0.0092246926      0
#> 86   86   0   a   a   b   a   a   a   b   b   a    b 0.0025413876      1
#> 87   87   1   a   a   a   b   b   b   b   c   a    a 0.3294185575      0
#> 88   88   1   b   b   b   b   d   b   b   c   b    a 0.3826538677      0
#> 89   89   1   b   b   b   a   c   b   b   b   b    b 0.0171878384      0
#> 90   90   1   b   a   b   c   b   b   b   a   b    b 0.0153720826      0
#> 91   91   1   a   a   b   c   a   b   b   c   a    a 0.4214402233      0
#> 92   92   1   a   b   b   b   c   b   b   a   b    c 0.0229397770      0
#> 93   93   1   a   b   a   b   c   b   b   c   b    c 0.4620108881      0
#> 94   94   0   b   b   b   b   c   b   a   c   b    a 0.1225403841      0
#> 95   95   0   b   a   a   a   c   a   b   b   b    a 0.1053230008      0
#> 96   96   0   a   b   b   b   c   b   b   b   b    c 0.2340241512      0
#> 97   97   0   b   a   b   c   c   a   b   c   b    c 0.0879261284      1
#> 98   98   0   a   b   a   c   b   b   a   b   b    c 0.2531817962      0
#> 99   99   1   b   b   b   c   d   a   b   a   b    c 0.0648335167      0
#> 100 100   1   b   b   b   c   d   b   b   c   b    a 0.2363842877      1