## How to use bootci.fmsm
## Write a function with one argument called x giving a fitted model,
## and returning some results of the model. The results may be in any form.
tmat <- rbind(c(NA,1,2),c(NA,NA,3),c(NA,NA,NA))
bexp <- flexsurvreg(Surv(Tstart, Tstop, status) ~ trans, data=bosms3, dist="exp")
summfn <- function(x, t){
resp <- flexsurv::pmatrix.fs(x, trans=tmat, t=t)
rest <- flexsurv::totlos.fs(x, trans=tmat, t=t)
list(resp, rest)
}
## Use bootci.fmsm to obtain the confidence interval
## The matrix columns are in the order of the unlisted results of the original
## summfn. You will have to rearrange them into the format that you want.
## If summfn has any extra arguments, in this case \code{t}, make sure they are
## passed through via the ... argument to bootci.fmsm
bootci.fmsm(bexp, B=3, fn=summfn, t=10)
bootci.fmsm(bexp, B=3, fn=summfn, t=5)
Run the code above in your browser using DataLab