rs.surv.rsadd: Compute a Relative Survival Curve from an additive relative...

rs.surv.rsaddR Documentation

Compute a Relative Survival Curve from an additive relative survival model

Description

Computes the predicted relative survival function for an additive relative survival model fitted with maximum likelihood.

Usage

rs.surv.rsadd(formula, newdata)

Arguments

formula

a rsadd object (Implemented only for models fitted with the codemax.lik (default) option.)

newdata

a data frame with the same variable names as those that appear in the rsadd formula. a predicted curve for each individual in this data frame shall be calculated

Details

Does not work with factor variables - you have to form dummy variables before calling the rsadd function.

Value

a survfit object; see the help on survfit.object for details. The survfit methods are used for print, plot, lines, and points.

References

Package. Pohar M., Stare J. (2006) "Relative survival analysis in R." Computer Methods and Programs in Biomedicine, 81: 272–278

See Also

survfit, survexp

Examples


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("1Jul1982")))
#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")


relsurv documentation built on March 18, 2022, 5:15 p.m.