Umpire 2.0: Simulating Associated Survival"

Load the packages we need.

library(Umpire)
library(survival)

Base Survival

Create a survival model, and generate data.

sm <- SurvivalModel(baseHazard = 1/5, # default 1/5 inverse years
                    accrual = 5,      # default 5 years
                    followUp = 1,     # default 1 years
                    units = 12, unitName = "months")
R <- rand(sm, 200)
summary(R)

Fit a Kaplan-Meier curve.

baseModel <- survfit(Surv(LFU, Event) ~ 1, R)
plot(baseModel)

Default method to generate beta coefficients.

Now create several cancer models and generate data.

for (ignore in 1:5) {
  for (jgnore in 1:4) {
    cm <- CancerModel("survtester", nPossible=20, nPattern=2,
                       SURV = function(n) rnorm(n, 0, 2), # old default; too large
                   survivalModel = sm)
    S <- rand(cm, 200)
    model <- survfit(Surv(LFU, Event) ~ CancerSubType, S)
    print(model)
    plot(model)
  }
}

Better method to generate beta coefficients.

Now create several cancer models and generate data.

for (ignore in 1:5) {
  for (jgnore in 1:4) {
    cm <- CancerModel("survtester", nPossible=20, nPattern=2,
                       SURV = function(n) rnorm(n, 0, 0.3),
                   survivalModel = sm)
    S <- rand(cm, 200)
    model <- survfit(Surv(LFU, Event) ~ CancerSubType, S)
    print(model)
    plot(model)
  }
}

Fewer possible hits

for (nPos in c(5, 10, 15)) {
  for (jgnore in 1:4) {
    cm <- CancerModel("survtester", nPossible=nPos, nPattern=2,
                       SURV = function(n) rnorm(n, 0, 0.3),
                   survivalModel = sm)
    S <- rand(cm, 200)
    model <- survfit(Surv(LFU, Event) ~ CancerSubType, S)
    print(model)
    plot(model)
  }
}

Appendix

sessionInfo()


Try the Umpire package in your browser

Any scripts or data that you put into this service are public.

Umpire documentation built on Nov. 11, 2020, 1:08 a.m.