View source: R/gammaImputeData.R
gammaImpute | R Documentation |
This function performs the Imputation described in Relaxing the independent censoring assumptions in the Cox proportional hazards model using multiple imputation. (2014) D. Jackson et al. Statist. Med. (33) 4681-4694
gammaImpute(
formula,
data,
m,
gamma,
gamma.factor,
bootstrap.strata = rep(1, nrow(data)),
DCO.time,
...,
parallel = c("no", "multicore", "snow")[1],
ncpus = 1L,
cl = NULL
)
formula |
The model formula to be used when fitting the models to calculate
the cumulative hazard. A formula for coxph can include strata terms but not
cluster or tt and only right-censored |
data |
A time to event data set for which event times are to be imputed |
m |
The number of imputations to be created |
gamma |
Either column name containing the value of gamma or a vector of values giving the subject specific
size of the step change in the log hazard at censoring. If a subject has NA in this column then no imputation is performed
for this subject (i.e. the subject's censored time remains unchanged after imputation). If a subject has already had an
event then the value of gamma is ignored. If |
gamma.factor |
If used, a single numeric value. If no |
bootstrap.strata |
The strata argument for stratified bootstrap sampling, see argument |
DCO.time |
Either column name containing the subject's data cutoff time or a vector of DCO.times for the subjects or a single number to be used as the DCO.time for all subjects (if imputed events are > this DCO.time then subjects are censored at DCO.time in imputed data sets) |
... |
Additional parameters to be passed into the model fit function |
parallel |
The type of parallel operation to be used (if any). |
ncpus |
integer: number of processes to be used in parallel operation: typically one would chose this to be the number of available CPUs |
cl |
An optional parallel or snow cluster for use if |
See the Gamma Imputation vignette for further details
A GammaImputedSet.object
containing the imputed data sets
GammaImputedSet.object
GammaImputedData.object
## Not run:
data(nwtco)
nwtco <- nwtco[1:500,]
#creating 2 imputed data sets (m=2) for speed, would normally create more
ans <- gammaImpute(formula=Surv(edrel,rel)~histol + instit,
data = nwtco, m=2, gamma.factor=1, DCO.time=6209)
#subject specific gamma (multiplied by gamma.factor to give the jump)
#NA for subjects that are not to be imputed
jumps <- c(rep(NA,10),rep(1,490))
DCO.values <- rep(6209,500)
ans.2 <- gammaImpute(formula=Surv(edrel,rel)~histol + instit + strata(stage),
data = nwtco, m=2, bootstrap.strata=strata(nwtco$stage),
gamma=jumps, gamma.factor=1, DCO.time=DCO.values)
#can also use column names
nwtco$gamma <- jumps
nwtco$DCO.time <- DCO.values
ans.3 <- gammaImpute(formula=Surv(edrel,rel)~histol + instit + strata(stage),
data = nwtco, m=2, bootstrap.strata=strata(nwtco$stage),
gamma="gamma", DCO.time="DCO.time")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.