Skip to contents

Simulation of Progression Free Survival Times

Usage

simul_pfs(
  lp_aft,
  sigma_aft,
  recr_duration,
  rate_cens,
  n_events,
  add_uncensored_pfs = FALSE
)

Arguments

lp_aft

(numeric)
linear predictor values for the accelerate failure time model (AFT).

sigma_aft

(number)
standard deviation for the AFT model.

recr_duration

(number)
duration of recruitment.

rate_cens

(number)
rate for the exponentially distributed censoring process.

n_events

(count)
number of events to reach for the study end.

add_uncensored_pfs

(flag)
whether to add the uncensored PFS as well to the resulting data.frame.

Value

A data.frame with columns tt_pfs (PFS time) and ev_pfs (corresponding event indicator with 1 for an event and 0 for censored), and optionally tt_pfs_uncens.

Examples

set.seed(123)
simul_pfs(
  lp_aft = rnorm(100),
  sigma_aft = 1,
  recr_duration = 0.2,
  rate_cens = 2,
  n_events = 20
)
#>          tt_pfs ev_pfs
#> 1   0.072391026      0
#> 2   0.023879008      1
#> 3   0.129171233      0
#> 4   0.193271142      0
#> 5   0.037677183      0
#> 6   0.064218853      0
#> 7   0.298624611      0
#> 8   0.098425711      1
#> 9   0.102690509      0
#> 10  0.186533053      0
#> 11  0.258201273      0
#> 12  0.246752360      0
#> 13  0.230997062      0
#> 14  0.137052131      0
#> 15  0.262009334      1
#> 16  0.360911995      0
#> 17  0.180787551      0
#> 18  0.178273954      1
#> 19  0.210286983      0
#> 20  0.185082786      1
#> 21  0.028930742      1
#> 22  0.111501575      0
#> 23  0.285093339      0
#> 24  0.096263545      0
#> 25  0.254739407      0
#> 26  0.104978844      0
#> 27  0.216453593      1
#> 28  0.182934469      0
#> 29  0.195344362      0
#> 30  0.279451361      0
#> 31  0.037491821      0
#> 32  0.222336510      0
#> 33  0.281483009      0
#> 34  0.360471274      0
#> 35  0.083872336      0
#> 36  0.123722728      1
#> 37  0.188409287      0
#> 38  0.201573553      0
#> 39  0.193324095      0
#> 40  0.290564901      0
#> 41  0.173332481      0
#> 42  0.023822602      0
#> 43  0.043176233      1
#> 44  0.230803059      0
#> 45  0.168667376      0
#> 46  0.247596144      0
#> 47  0.003760418      1
#> 48  0.002738761      1
#> 49  0.170336318      0
#> 50  0.340096665      0
#> 51  0.310398066      0
#> 52  0.050108371      1
#> 53  0.262469965      0
#> 54  0.296645091      0
#> 55  0.185277166      0
#> 56  0.357749765      0
#> 57  0.313933721      0
#> 58  0.226846021      0
#> 59  0.187742686      0
#> 60  0.040126174      0
#> 61  0.178223857      0
#> 62  0.203858174      0
#> 63  0.049196475      1
#> 64  0.199600613      0
#> 65  0.017168713      0
#> 66  0.286927353      0
#> 67  0.238195006      0
#> 68  0.274430927      1
#> 69  0.359745348      0
#> 70  0.165535135      0
#> 71  0.247356322      0
#> 72  0.110498062      1
#> 73  0.036053721      0
#> 74  0.003948712      0
#> 75  0.118292943      0
#> 76  0.284240219      1
#> 77  0.137125529      0
#> 78  0.191043928      0
#> 79  0.209062573      0
#> 80  0.021038631      1
#> 81  0.355722481      0
#> 82  0.291261875      0
#> 83  0.309393837      0
#> 84  0.194050595      0
#> 85  0.018804923      0
#> 86  0.179013416      0
#> 87  0.008846880      0
#> 88  0.195177166      0
#> 89  0.081592477      1
#> 90  0.218217758      0
#> 91  0.343328364      0
#> 92  0.239031686      0
#> 93  0.173353841      0
#> 94  0.113985230      1
#> 95  0.035541392      0
#> 96  0.280588671      0
#> 97  0.245376392      0
#> 98  0.204379379      0
#> 99  0.186462361      0
#> 100 0.113024097      1