Preparation of a Data Set to Compute Log-likelihood
Arguments
- data
(
data.frame
)
containing entry and exit times of an illness-death model. SeegetOneClinicalTrial()
for details.
Value
This function returns a data set with one row per patient and transition, when the patient is at risk.
Details
The output data set contains the following columns:
id (
integer
): patient id.from (
integer
): start event state.to (
integer
): end event state.trans (
integer
): transition (1, 2 or 3) identifier1
: Transition from state 0 (stable) to 1 (progression).2
: Transition from state 0 (stable) to 2 (death).3
: Transition from state 1 (progression) to 2 (death).
entry (
numeric
): time at which the patient begins to be at risk for the transition.exit (
numeric
): time at which the patient ends to be at risk for the transition.status (
logical
): event indicator for the transition.
Examples
transition <- exponential_transition(h01 = 1.2, h02 = 1.5, h12 = 1.6)
simData <- getOneClinicalTrial(
nPat = c(30), transitionByArm = list(transition),
dropout = list(rate = 0.8, time = 12),
accrual = list(param = "time", value = 1)
)
prepareData(simData)
#> id from to trans entry exit status
#> 1 1 1 2 1 0.00000000 0.066277129 0
#> 2 1 1 3 2 0.00000000 0.066277129 1
#> 3 2 1 2 1 0.00000000 0.582430280 0
#> 4 2 1 3 2 0.00000000 0.582430280 1
#> 5 3 1 2 1 0.00000000 1.089692162 0
#> 6 3 1 3 2 0.00000000 1.089692162 1
#> 7 4 1 2 1 0.00000000 0.003181653 0
#> 8 4 1 3 2 0.00000000 0.003181653 1
#> 9 5 1 2 1 0.00000000 0.101806397 0
#> 10 5 1 3 2 0.00000000 0.101806397 1
#> 11 6 1 2 1 0.00000000 0.045827971 0
#> 12 6 1 3 2 0.00000000 0.045827971 0
#> 13 7 1 2 1 0.00000000 0.153713905 0
#> 14 7 1 3 2 0.00000000 0.153713905 1
#> 15 8 1 2 1 0.00000000 0.212997515 1
#> 16 8 1 3 2 0.00000000 0.212997515 0
#> 17 8 2 3 3 0.21299752 0.298913236 1
#> 18 9 1 2 1 0.00000000 0.243098829 1
#> 19 9 1 3 2 0.00000000 0.243098829 0
#> 20 9 2 3 3 0.24309883 0.517737352 1
#> 21 10 1 2 1 0.00000000 0.443369615 1
#> 22 10 1 3 2 0.00000000 0.443369615 0
#> 23 10 2 3 3 0.44336962 0.523616153 1
#> 24 11 1 2 1 0.00000000 0.142387308 0
#> 25 11 1 3 2 0.00000000 0.142387308 1
#> 26 12 1 2 1 0.00000000 0.727902990 1
#> 27 12 1 3 2 0.00000000 0.727902990 0
#> 28 12 2 3 3 0.72790299 1.850785731 1
#> 29 13 1 2 1 0.00000000 0.093890872 0
#> 30 13 1 3 2 0.00000000 0.093890872 1
#> 31 14 1 2 1 0.00000000 0.925866670 0
#> 32 14 1 3 2 0.00000000 0.925866670 1
#> 33 15 1 2 1 0.00000000 0.010891613 1
#> 34 15 1 3 2 0.00000000 0.010891613 0
#> 35 15 2 3 3 0.01089161 1.301701664 1
#> 36 16 1 2 1 0.00000000 0.106896270 0
#> 37 16 1 3 2 0.00000000 0.106896270 0
#> 38 17 1 2 1 0.00000000 1.149721738 0
#> 39 17 1 3 2 0.00000000 1.149721738 1
#> 40 18 1 2 1 0.00000000 0.138002841 0
#> 41 18 1 3 2 0.00000000 0.138002841 1
#> 42 19 1 2 1 0.00000000 0.446380686 0
#> 43 19 1 3 2 0.00000000 0.446380686 1
#> 44 20 1 2 1 0.00000000 0.421717130 1
#> 45 20 1 3 2 0.00000000 0.421717130 0
#> 46 20 2 3 3 0.42171713 0.516007558 1
#> 47 21 1 2 1 0.00000000 0.361510937 1
#> 48 21 1 3 2 0.00000000 0.361510937 0
#> 49 21 2 3 3 0.36151094 0.575776916 0
#> 50 22 1 2 1 0.00000000 0.193843792 1
#> 51 22 1 3 2 0.00000000 0.193843792 0
#> 52 22 2 3 3 0.19384379 0.702382476 1
#> 53 23 1 2 1 0.00000000 0.608832711 1
#> 54 23 1 3 2 0.00000000 0.608832711 0
#> 55 23 2 3 3 0.60883271 0.828572235 0
#> 56 24 1 2 1 0.00000000 0.514600178 0
#> 57 24 1 3 2 0.00000000 0.514600178 1
#> 58 25 1 2 1 0.00000000 0.218239975 0
#> 59 25 1 3 2 0.00000000 0.218239975 1
#> 60 26 1 2 1 0.00000000 0.075526144 1
#> 61 26 1 3 2 0.00000000 0.075526144 0
#> 62 26 2 3 3 0.07552614 1.228833720 1
#> 63 27 1 2 1 0.00000000 0.245773869 1
#> 64 27 1 3 2 0.00000000 0.245773869 0
#> 65 27 2 3 3 0.24577387 1.304677951 1
#> 66 28 1 2 1 0.00000000 0.345940472 0
#> 67 28 1 3 2 0.00000000 0.345940472 1
#> 68 29 1 2 1 0.00000000 1.184450217 1
#> 69 29 1 3 2 0.00000000 1.184450217 0
#> 70 29 2 3 3 1.18445022 1.705445544 1
#> 71 30 1 2 1 0.00000000 0.046964496 0
#> 72 30 1 3 2 0.00000000 0.046964496 1