This function returns a data frame containing following variables derived from an rpsftm object. It assumes that only a single switch in treatment occurs i.e. a patient who is randomized to control but has 25

  • .arm - 0 or 1 - randomized arm

  • Arm - "Randomized to Control" or "Randomized to Experimental"

  • Time - time that status applies for

  • Status - one of "Event", "Censored", "At risk on Control", "At risk on Experimental"

  • Count - count of patients in this status at this time.

  • Percent - based on total number of patients in arm.

rpsftm.atrisk(x, eval.times = NULL)

Arguments

x

rpsftm object (rpsftm)

eval.times

- vector of times to evaluate at risk status for. Default is all event and censoring times.

Examples

# use data included in rpsftm package
library(rpsftm)
immdef <- rpsftm::immdef
immdef$rx <- with(immdef, 1 - xoyrs/progyrs)

# fit the model
imm.fit <- rpsftm(Surv(progyrs, prog) ~ rand(imm, rx),
                  data=immdef,
                  censor_time=censyrs)

rpsftm.atrisk(imm.fit, eval.times = c(0, 1, 2, 3))
#>    .arm                        Arm Time                  Status Count Percent
#> 1     0      Randomized to Control    0                   Event     0   0.000
#> 2     0      Randomized to Control    1                   Event    57   0.114
#> 3     0      Randomized to Control    2                   Event   135   0.270
#> 4     0      Randomized to Control    3                   Event   169   0.338
#> 5     0      Randomized to Control    0                Censored     0   0.000
#> 6     0      Randomized to Control    1                Censored     0   0.000
#> 7     0      Randomized to Control    2                Censored   126   0.252
#> 8     0      Randomized to Control    3                Censored   321   0.642
#> 9     0      Randomized to Control    0      At risk on Control   500   1.000
#> 10    0      Randomized to Control    1      At risk on Control   375   0.750
#> 11    0      Randomized to Control    2      At risk on Control   147   0.294
#> 12    0      Randomized to Control    3      At risk on Control     4   0.008
#> 13    0      Randomized to Control    0 At risk on Experimental     0   0.000
#> 14    0      Randomized to Control    1 At risk on Experimental    68   0.136
#> 15    0      Randomized to Control    2 At risk on Experimental    92   0.184
#> 16    0      Randomized to Control    3 At risk on Experimental     6   0.012
#> 17    1 Randomized to Experimental    0                   Event     0   0.000
#> 18    1 Randomized to Experimental    1                   Event    49   0.098
#> 19    1 Randomized to Experimental    2                   Event   119   0.238
#> 20    1 Randomized to Experimental    3                   Event   143   0.286
#> 21    1 Randomized to Experimental    0                Censored     0   0.000
#> 22    1 Randomized to Experimental    1                Censored     0   0.000
#> 23    1 Randomized to Experimental    2                Censored   114   0.228
#> 24    1 Randomized to Experimental    3                Censored   335   0.670
#> 25    1 Randomized to Experimental    0      At risk on Control     0   0.000
#> 26    1 Randomized to Experimental    1      At risk on Control     0   0.000
#> 27    1 Randomized to Experimental    2      At risk on Control     0   0.000
#> 28    1 Randomized to Experimental    3      At risk on Control     0   0.000
#> 29    1 Randomized to Experimental    0 At risk on Experimental   500   1.000
#> 30    1 Randomized to Experimental    1 At risk on Experimental   451   0.902
#> 31    1 Randomized to Experimental    2 At risk on Experimental   267   0.534
#> 32    1 Randomized to Experimental    3 At risk on Experimental    22   0.044