Skip to contents

Conversion of a Data Set from One Row per Transition to One Row per Patient

Usage

getDatasetWideFormat(data)

Arguments

data

(data.frame)
data frame containing entry and exit times of an illness-death model. See getSimulatedData() for details.

Value

This function returns a data set with one row per patient and endpoints PFS and OS.

Details

The output data set contains the following columns:

  • id (integer): patient id.

  • trt integer): treatment id.

  • PFStime (numeric): event time of PFS event.

  • CensoredPFS (logical): censoring indicator for PFS event.

  • PFSevent (logical): event indicator for PFS event.

  • OStime (numeric): event time of OS event.

  • CensoredOS (logical): censoring indicator for OS event.

  • OSevent (logical): event indicator for OS event.

  • recruitTime (numeric): time of recruitment.

  • OStimeCal (numeric): OS event time at calendar time scale.

  • PFStimeCal (numeric): PFS event time at calendar time scale.

Examples

transition1 <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6)
transition2 <- exponential_transition(h01 = 1, h02 = 1.3, h12 = 1.7)
transition3 <- exponential_transition(h01 = 1.1, h02 = 1, h12 = 1.5)
simData <- getOneClinicalTrial(
  nPat = c(30, 20, 30), transitionByArm = list(transition1, transition2, transition3),
  dropout = list(rate = 0, time = 12),
  accrual = list(param = "time", value = 0)
)
getDatasetWideFormat(simData)
#>    id trt      PFStime CensoredPFS PFSevent       OStime CensoredOS OSevent
#> 1   1   1 0.3223123286           0        1 0.3223123286          0       1
#> 2   2   1 0.7090484104           0        1 1.0449132260          0       1
#> 3   3   1 0.2966917416           0        1 1.8327935276          0       1
#> 4   4   1 0.0290521679           0        1 0.4014558005          0       1
#> 5   5   1 0.0984397000           0        1 0.0984397000          0       1
#> 6   6   1 0.0467190512           0        1 0.0467190512          0       1
#> 7   7   1 1.1970408702           0        1 1.1970408702          0       1
#> 8   8   1 0.0914600143           0        1 0.0914600143          0       1
#> 9   9   1 0.1740391511           0        1 0.4797561694          0       1
#> 10 10   1 0.0669849606           0        1 0.0669849606          0       1
#> 11 11   1 0.0183250973           0        1 0.0183250973          0       1
#> 12 12   1 0.0748979707           0        1 0.0748979707          0       1
#> 13 13   1 0.0378583541           0        1 1.0398236834          0       1
#> 14 14   1 0.8564882180           0        1 1.0781238692          0       1
#> 15 15   1 0.0740669305           0        1 0.5514924957          0       1
#> 16 16   1 0.2266543744           0        1 0.2266543744          0       1
#> 17 17   1 0.6146259754           0        1 0.7473521660          0       1
#> 18 18   1 0.1002014077           0        1 0.1002014077          0       1
#> 19 19   1 0.3708130248           0        1 1.1892153053          0       1
#> 20 20   1 0.5121405273           0        1 1.6026970664          0       1
#> 21 21   1 0.1249750119           0        1 0.1249750119          0       1
#> 22 22   1 0.3198303997           0        1 0.5965047805          0       1
#> 23 23   1 0.0101546944           0        1 0.0101546944          0       1
#> 24 24   1 0.0436662644           0        1 0.0436662644          0       1
#> 25 25   1 0.2434898709           0        1 0.2434898709          0       1
#> 26 26   1 0.1254999918           0        1 0.1254999918          0       1
#> 27 27   1 0.2292678100           0        1 0.2956419227          0       1
#> 28 28   1 0.4499335461           0        1 0.4499335461          0       1
#> 29 29   1 0.0007772943           0        1 0.0007772943          0       1
#> 30 30   1 1.3579126659           0        1 1.3579126659          0       1
#> 31 31   2 0.1631144539           0        1 0.8036697087          0       1
#> 32 32   2 0.1674414283           0        1 0.1674414283          0       1
#> 33 33   2 0.3812552098           0        1 1.3292929861          0       1
#> 34 34   2 0.4237612060           0        1 0.4237612060          0       1
#> 35 35   2 0.5834219837           0        1 0.6399333588          0       1
#> 36 36   2 0.2653941743           0        1 0.2653941743          0       1
#> 37 37   2 0.3727146459           0        1 0.3727146459          0       1
#> 38 38   2 0.3973146045           0        1 0.3973146045          0       1
#> 39 39   2 0.3667502014           0        1 0.3667502014          0       1
#> 40 40   2 0.0429461757           0        1 0.0429461757          0       1
#> 41 41   2 0.5443080149           0        1 0.5443080149          0       1
#> 42 42   2 0.1764437995           0        1 0.4117917707          0       1
#> 43 43   2 0.2352831257           0        1 0.2352831257          0       1
#> 44 44   2 0.0196460790           0        1 0.0271103262          0       1
#> 45 45   2 0.0804805123           0        1 0.1550929184          0       1
#> 46 46   2 0.0969404259           0        1 0.0969404259          0       1
#> 47 47   2 0.5627109950           0        1 0.6880157237          0       1
#> 48 48   2 0.9026030484           0        1 1.2719707752          0       1
#> 49 49   2 0.1235704054           0        1 0.1235704054          0       1
#> 50 50   2 0.3981708081           0        1 0.8624516616          0       1
#> 51 51   3 0.4594657688           0        1 0.4594657688          0       1
#> 52 52   3 0.1251391811           0        1 0.1262682581          0       1
#> 53 53   3 1.3438075372           0        1 1.3438075372          0       1
#> 54 54   3 0.7251947416           0        1 2.3865750257          0       1
#> 55 55   3 0.3043318314           0        1 0.6001784215          0       1
#> 56 56   3 1.1346912025           0        1 1.9114513094          0       1
#> 57 57   3 0.5212354515           0        1 0.5212354515          0       1
#> 58 58   3 0.1570238975           0        1 0.9953626874          0       1
#> 59 59   3 0.2994753927           0        1 0.3063574116          0       1
#> 60 60   3 0.4322770645           0        1 0.4322770645          0       1
#> 61 61   3 1.9834377047           0        1 2.0773792705          0       1
#> 62 62   3 1.0263111443           0        1 1.0263111443          0       1
#> 63 63   3 1.1442477067           0        1 2.6578470172          0       1
#> 64 64   3 0.9667957638           0        1 1.0897027185          0       1
#> 65 65   3 0.2497635085           0        1 0.6976538819          0       1
#> 66 66   3 0.1468731254           0        1 0.7709579604          0       1
#> 67 67   3 0.2840875130           0        1 0.7360299225          0       1
#> 68 68   3 0.1335834217           0        1 0.1335834217          0       1
#> 69 69   3 0.3219019261           0        1 0.3219019261          0       1
#> 70 70   3 0.1599954073           0        1 0.1599954073          0       1
#> 71 71   3 0.3750693657           0        1 0.3750693657          0       1
#> 72 72   3 0.2729358338           0        1 0.2729358338          0       1
#> 73 73   3 0.1604183449           0        1 0.1604183449          0       1
#> 74 74   3 0.2973777392           0        1 0.2973777392          0       1
#> 75 75   3 0.3617279388           0        1 0.3617279388          0       1
#> 76 76   3 0.7100506623           0        1 0.7100506623          0       1
#> 77 77   3 0.1327475743           0        1 0.1327475743          0       1
#> 78 78   3 0.0418417170           0        1 0.0418417170          0       1
#> 79 79   3 0.0698837055           0        1 0.0698837055          0       1
#> 80 80   3 0.5552120578           0        1 0.5552120578          0       1
#>    recruitTime    OStimeCal   PFStimeCal
#> 1            0 0.3223123286 0.3223123286
#> 2            0 1.0449132260 0.7090484104
#> 3            0 1.8327935276 0.2966917416
#> 4            0 0.4014558005 0.0290521679
#> 5            0 0.0984397000 0.0984397000
#> 6            0 0.0467190512 0.0467190512
#> 7            0 1.1970408702 1.1970408702
#> 8            0 0.0914600143 0.0914600143
#> 9            0 0.4797561694 0.1740391511
#> 10           0 0.0669849606 0.0669849606
#> 11           0 0.0183250973 0.0183250973
#> 12           0 0.0748979707 0.0748979707
#> 13           0 1.0398236834 0.0378583541
#> 14           0 1.0781238692 0.8564882180
#> 15           0 0.5514924957 0.0740669305
#> 16           0 0.2266543744 0.2266543744
#> 17           0 0.7473521660 0.6146259754
#> 18           0 0.1002014077 0.1002014077
#> 19           0 1.1892153053 0.3708130248
#> 20           0 1.6026970664 0.5121405273
#> 21           0 0.1249750119 0.1249750119
#> 22           0 0.5965047805 0.3198303997
#> 23           0 0.0101546944 0.0101546944
#> 24           0 0.0436662644 0.0436662644
#> 25           0 0.2434898709 0.2434898709
#> 26           0 0.1254999918 0.1254999918
#> 27           0 0.2956419227 0.2292678100
#> 28           0 0.4499335461 0.4499335461
#> 29           0 0.0007772943 0.0007772943
#> 30           0 1.3579126659 1.3579126659
#> 31           0 0.8036697087 0.1631144539
#> 32           0 0.1674414283 0.1674414283
#> 33           0 1.3292929861 0.3812552098
#> 34           0 0.4237612060 0.4237612060
#> 35           0 0.6399333588 0.5834219837
#> 36           0 0.2653941743 0.2653941743
#> 37           0 0.3727146459 0.3727146459
#> 38           0 0.3973146045 0.3973146045
#> 39           0 0.3667502014 0.3667502014
#> 40           0 0.0429461757 0.0429461757
#> 41           0 0.5443080149 0.5443080149
#> 42           0 0.4117917707 0.1764437995
#> 43           0 0.2352831257 0.2352831257
#> 44           0 0.0271103262 0.0196460790
#> 45           0 0.1550929184 0.0804805123
#> 46           0 0.0969404259 0.0969404259
#> 47           0 0.6880157237 0.5627109950
#> 48           0 1.2719707752 0.9026030484
#> 49           0 0.1235704054 0.1235704054
#> 50           0 0.8624516616 0.3981708081
#> 51           0 0.4594657688 0.4594657688
#> 52           0 0.1262682581 0.1251391811
#> 53           0 1.3438075372 1.3438075372
#> 54           0 2.3865750257 0.7251947416
#> 55           0 0.6001784215 0.3043318314
#> 56           0 1.9114513094 1.1346912025
#> 57           0 0.5212354515 0.5212354515
#> 58           0 0.9953626874 0.1570238975
#> 59           0 0.3063574116 0.2994753927
#> 60           0 0.4322770645 0.4322770645
#> 61           0 2.0773792705 1.9834377047
#> 62           0 1.0263111443 1.0263111443
#> 63           0 2.6578470172 1.1442477067
#> 64           0 1.0897027185 0.9667957638
#> 65           0 0.6976538819 0.2497635085
#> 66           0 0.7709579604 0.1468731254
#> 67           0 0.7360299225 0.2840875130
#> 68           0 0.1335834217 0.1335834217
#> 69           0 0.3219019261 0.3219019261
#> 70           0 0.1599954073 0.1599954073
#> 71           0 0.3750693657 0.3750693657
#> 72           0 0.2729358338 0.2729358338
#> 73           0 0.1604183449 0.1604183449
#> 74           0 0.2973777392 0.2973777392
#> 75           0 0.3617279388 0.3617279388
#> 76           0 0.7100506623 0.7100506623
#> 77           0 0.1327475743 0.1327475743
#> 78           0 0.0418417170 0.0418417170
#> 79           0 0.0698837055 0.0698837055
#> 80           0 0.5552120578 0.5552120578