rs.surv.rsadd | R Documentation |
Computes the predicted relative survival function for an additive relative survival model fitted with maximum likelihood.
rs.surv.rsadd(formula, newdata)
formula |
a |
newdata |
a data frame with the same variable names as those that
appear in the |
Does not work with factor variables - you have to form dummy variables before calling the rsadd function.
a survfit
object; see the help on survfit.object
for
details. The survfit
methods are used for print
, plot
,
lines
, and points
.
Package. Pohar M., Stare J. (2006) "Relative survival analysis in R." Computer Methods and Programs in Biomedicine, 81: 272–278
survfit
, survexp
data(slopop)
data(rdata)
#fit a relative survival model
fit <- rsadd(Surv(time,cens)~sex+age+year,rmap=list(age=age*365.241),
ratetable=slopop,data=rdata,int=c(0:10,15))
#calculate the predicted curve for a male individual, aged 65, diagnosed in 1982
d <- rs.surv.rsadd(fit,newdata=data.frame(sex=1,age=65,year=as.Date("1982-01-01")))
#plot the curve (will result in a step function since the baseline is assumed piecewise constant)
plot(d,xscale=365.241)
#calculate the predicted survival curves for each individual in the data set
d <- rs.surv.rsadd(fit,newdata=rdata)
#calculate the average over all predicted survival curves
p.surv <- apply(d$surv,1,mean)
#plot the relative survival curve
plot(d$time/365.241,p.surv,type="b",ylim=c(0,1),xlab="Time",ylab="Relative survival")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.