Last active
April 10, 2021 19:18
-
-
Save jenniferthompson/3985d60366be20ba0c23309271d4c143 to your computer and use it in GitHub Desktop.
Try example code from `multistateutils` Example vignette
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Work through examples in multistateutils docs | |
library(mstate) | |
library(flexsurv) | |
library(multistateutils) | |
data(ebmt3) | |
tmat <- trans.illdeath(c('transplant', 'pr', 'rfs')) | |
tmat | |
long <- msprep(time=c(NA, 'prtime', 'rfstime'), | |
status=c(NA, 'prstat', 'rfsstat'), | |
data=ebmt3, | |
trans=tmat, | |
keep=c('age', 'dissub')) | |
models <- lapply(1:3, function(i) { | |
flexsurvreg(Surv(time, status) ~ age + dissub, data=long, dist='weibull') | |
}) | |
newdata <- data.frame(age="20-40", dissub="AML") | |
## Consistently crashes R on macOS High Sierra | |
# predict_transitions(models, newdata, tmat, times=365) | |
pmatrix.simfs(models, tmat, newdata=newdata, t=365) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment