Description Usage Arguments Value Examples
Draw Kaplan-Meier Survival Plot with an object of class 'gam'
1 |
model |
a fitted gam object as produced by gam() |
data |
A data frame or list containing the values of the model covariates at which predictions are required |
np |
Numeric Number of time intervals |
timevar |
character Name of variable containing time |
until |
Maximum value of time |
id |
Optional labels of preset values |
A ggplot
1 2 3 4 5 6 7 8 9 10 | require(mgcv)
data(pbc,package="survival")
pbc$status1 <- as.numeric(pbc$status==2)
pbc$stage <- factor(pbc$stage)
model = gam(time ~ trt +sex + s(sqrt(protime))+s(platelet)+ s(age)+s(bili)+s(albumin),
weights=status1, family=cox.ph, data=pbc, method="REML")
dfSex=averageData(pbc,list(sex=c("m","f")))
drawSurv(model,data=dfSex,id=list(sex=c("m","f")))
dfBili=averageData(pbc,list(bili=c(1,10)))
drawSurv(model,data=dfBili,id=list(bili=c(1,10)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.