3 Esimerkkikoodi
Edellä mainitussa artikkelissa oli vain minimaalinen harjoitusdatasetti, joka näkyy alla. Sen muoto/muuttujat ovat seuraavanlaiset (lähde: Grafféon ym. (PMID: 31442762):
This Toy Example Data is given in wide format. It contains the following variables:
- id is the patient’s identifier,
- randt is the date of the randomization visit,
- lastdt is the date of latest news,
- status is equal to 1 if the patient dies on lastdt (and 0 otherwise),
- age is the patient’s age,
- ps1, ps2, ps3 are the values of a covariate measured at dates randt, dt2, dt3, respectively
- arm is the patient’s randomized arm,
- swtrtdt is the date when the patient initiates the other arm treatment (NA if does not happen).
id | randt | lastdt | status | age | ps1 | ps2 | ps3 | dt2 | dt3 | arm | swtrtdt |
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2018-01-12 | 2018-03-02 | 1 | 20 | 0 | 0 | 0 | 2018-02-02 | 2018-03-01 | A | 2018-03-01 |
2 | 2017-11-04 | 2017-12-15 | 1 | 50 | 1 | NA | 2 | NA | 2017-12-12 | B | NA |
3 | 2017-05-20 | 2018-01-04 | 0 | 40 | 0 | 0 | 1 | 2017-08-02 | 2018-01-02 | A | NA |