Description Usage Arguments Details Value See Also Examples
This function is used to calculate confidence intervals of mean total lifetime using jackknife resampling.
1 |
obj |
An object returned by |
state |
A numeric vector indicating from which state the mean total lifetime is simulated. Default is NULL, where no mean total life for a specific state is output. If obj is returned by optim.fit with treatment=NULL, there is no need to set this argument. |
nsim |
The times of simulation for mean total life. The default is 1000. |
L |
The prespecified threshold for blocking the increase of residual lifetime. The default is 120. |
This function systematically leaves out each subject from the original datset and simulates mean total lifetimes
for each n-1
-sized subsample. The jackknife mean and variance are calculated by aggregating n
simulated
mean total lifetimes. For each jackknife dataset, mean total lifetime is simulated using the
algorithm described in sim.MTL.
If the input object comes from optim.fit
with treatment=NULL
, a list object with elements:
conf.state.MTL |
A data frame containing states, corresponding mean total lifetime, standard error and 95% confidence interval. If state=NULL, this element does not exist. |
state.table |
The correspondence of state number and state label. |
If the input object comes from optim.fit
with treatment
is not NULL, a list object with elements:
conf.strategies |
Mean total lifetime for different strategies, along with standard error and 95% confidence interval |
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 | ## Not run:
library(OptimalTiming)
##################################
## Example 1: This example shows how to calculate confidence
## intervals for different treatment strategies
## read data
data(SimCml)
## fit multistate model with treatment not equals NULL
fit=optim.fit(data=SimCml,
transM=matrix(c(0,1,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,1,1,1,1,
0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0),7,byrow=TRUE),
nstate=7,state_label=c("diagnose","cp1","ap","cp2","bc","sct","death"),
event_label=c("cp1.s","ap.s","cp2.s","bc.s","sct.s","death.s"),
treatment=c("sct","sct.s"),absorb=c("death","death.s"),
cov=c("age"),cov_value=c(0))
## compare different treatment strategies
conf.MTL(obj=fit,nsim=1000,L=120)
##################################
## Example 2: This example shows how to calculate confidence
## intervals for a given state
## read data
data(SimCml)
## delete the information of transplant time
data=SimCml[SimCml$sct.s==0,]
del=which(names(SimCml)%in%c("sct","sct.s"))
data=data[,-del]
## fit multistate model with treatment equals NULL
fit=optim.fit(data=data,
transM=matrix(c(0,1,0,0,0,0,0,0,1,0,1,1,0,0,0,
1,1,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0),6,byrow=TRUE),
nstate=6,state_label=c("diagnose","cp1","ap","cp2","bc","death"),
absorb=c("death","death.s"),event_label=c("cp1.s","ap.s","cp2.s","bc.s","death.s"),
cov=c("age"),cov_value=c(0))
## calculate mean total lifetime and confidence intervals
## for state 1,2,3,4
conf.MTL(obj=fit,state=c(1,2,3,4),nsim=1000,L=120)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.