simTime: simTime

Description Usage Arguments Value Author(s) Examples

Description

simTime is a function to perform the parametric-bootstrap step, where we use the true coefficients

and cumulative hazard to simulate survival and censoring.

Usage

1
simTime(simmodels, original.yvars, result)

Arguments

simmodels

a list in the form of the return value of simData()

which consists of three lists:

obj: a list of ExpressionSets, matrices or RangedSummarizedExperiments

setsID: a list of set labels indicating which original set the simulated one is from

indices: a list of patient labels to tell which patient in the original set is drawn

original.yvars

response variable in the order of original sets(without sampling)

result

a list in the form of return of getTrueModel()

which consists of five lists:

Beta: a list of coefficients obtained by

grid: timeline grid corresponding to hazard estimations censH and survH

survH: cumulative hazard for survival times distribution

censH: cumulative hazard for censoring times distribution

lp: true linear predictors

Value

survival time is saved in phenodata, here the function still returns the ExpressionSets

Author(s)

Yuqing Zhang, Christoph Bernau, Levi Waldron

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
library(curatedOvarianData)


data(E.MTAB.386_eset)


data(GSE14764_eset)


esets.list <- list(E.MTAB.386=E.MTAB.386_eset[1:100, 1:20], GSE14764=GSE14764_eset[1:100, 1:20])


rm(E.MTAB.386_eset, GSE14764_eset)





## simulate on multiple ExpressionSets


set.seed(8) 





y.list <- lapply(esets.list, function(eset){


  time <- eset$days_to_death


  cens.chr <- eset$vital_status


  cens <- rep(0, length(cens.chr))


  cens[cens.chr=="living"] <- 1


  return(Surv(time, cens))


})





# To perform both parametric and non-parametric bootstrap, you can call simBootstrap()


# or, you can divide the steps into:


res <- getTrueModel(esets.list, y.list, 100)


simmodels <- simData(obj=esets.list, y.vars=y.list, n.samples=10)





# Then, use this function


simmodels <- simTime(simmodels=simmodels, original.yvars=y.list, result=res) 





# it also supports performing only the parametrc bootstrap step on a list of expressionsets


# but you need to construct the parameter by scratch


res <- getTrueModel(esets.list, y.list, 100)


setsID <- seq_along(esets.list)


indices <- list()


for(i in setsID){


  indices[[i]] <- seq_along(sampleNames(esets.list[[i]])) 


}


simmodels <- list(obj=esets.list, y.vars=y.list, indices=indices, setsID=setsID)





new.simmodels <- simTime(simmodels=simmodels, original.yvars=y.list, result=res)  

zhangyuqing/simulatorZ documentation built on Oct. 21, 2020, 1:05 a.m.