rsadd: Fit an Additive model for Relative Survival

Description Usage Arguments Details Value References See Also Examples

View source: R/Rcode.r


The function fits an additive model to the data. The methods implemented are the maximum likelihood method, the semiparametric method, a glm model with a binomial error and a glm model with a poisson error.


rsadd(formula, data=parent.frame(), ratetable = relsurv::slopop,
      int, na.action, method, init,bwin,centered,cause,control,...)



a formula object, with the response on the left of a ~ operator, and the terms on the right. The terms consist of predictor variables separated by the + operator, along with a ratetable term. The ratetable term matches each subject to his/her expected cohort. If the variables are organized and named in the same way as in the population tables, the ratetable term can be omitted. The response must be a survival object as returned by the Surv function.

NOTE: The time must be in days, and the same is required for the ratetable variables (the variables used in the population tables), for example age and year (year must be given in the date format, i.e. in number of days since 01.01.1960).


a data.frame in which to interpret the variables named in the formula.


a table of event rates, organized as a ratetable object, such as slopop.


either a single value denoting the number of follow-up years or a vector specifying the intervals (in years) in which the hazard is constant (the times that are bigger than max(int) are censored. If missing, only one interval (from time 0 to maximum observation time) is assumed. The EM method does not need the intervals, only the maximum time can be specified (all times are censored after this time point).


a missing-data filter function, applied to the model.frame, after any subset argument has been used. Default is options()$na.action.


glm.bin or glm.poi for a glm model, EM for the EM algorithm and max.lik for the maximum likelihood model (default).


vector of initial values of the iteration. Default initial value is zero for all variables.


controls the bandwidth used for smoothing in the EM algorithm. The follow-up time is divided into quartiles and bwin specifies a factor by which the maximum between events time length on each interval is multiplied. The default bwin=-1 lets the function find an appropriate value. If bwin=0, no smoothing is applied.


if TRUE, all the variables are centered before fitting and the baseline excess hazard is calculated accordingly. Default is FALSE.


A vector of the same length as the number of cases. 0 for population deaths, 1 for disease specific deaths, 2 (default) for unknown. Can only be used with the EM method.


a list of parameters for controlling the fitting process. See the documentation for glm.control for details.


other arguments will be passed to glm.control.


NOTE: All times used in the formula argument must be specified in days. This is true for the follow-up time as well as for any variables needed ratetable object, like age and year. On the contrary, the int argument requires interval specification in years.

The maximum likelihood method and both glm methods assume a fully parametric model with a piecewise constant baseline excess hazard function. The intervals on which the baseline is assumed constant should be passed via argument int. The EM method is semiparametric, i.e. no assumptions are made for the baseline hazard and therefore no intervals need to be specified.

The methods using glm are methods for grouped data. The groups are formed according to the covariate values. This should be taken into account when fitting a model. The glm method returns life tables for groups specified by the covariates in groups.

The EM method output includes the smoothed baseline excess hazard lambda0, the cumulative baseline excess hazard Lambda0 and times at which they are estimated. The individual probabilites of dying due to the excess risk are returned as Nie. The EM method fitting procedure requires some local smoothing of the baseline excess hazard. The default bwin=-1 value lets the function find an appropriate value for the smoothing band width. While this ensures an unbiased estimate, the procedure time is much longer. As the value found by the function is independent of the covariates in the model, the value can be read from the output (bwinfac) and used for refitting different models to the same data to save time.


An object of class rsadd. In the case of method="glm.bin" and method="glm.poi" the class also inherits from glm which inherits from the class lm. Objects of this class have methods for the functions print and summary. An object of class rsadd is a list containing at least the following components:


the data as used in the model, along with the variables defined in the rate table


the ratetable used.


the maximum time (in years) used. All the events at and after this value are censored.


the fitting method that was used.


the vector of linear predictors, one per subject.


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

Relative survival: Pohar, M., Stare, J. (2007) "Making relative survival analysis relatively easy." Computers in biology and medicine, 37: 1741–1749.

EM algorithm: Pohar Perme M., Henderson R., Stare, J. (2009) "An approach to estimation in relative survival regression." Biostatistics, 10: 136–146.

See Also

rstrans, rsmul


#fit an additive model
#note that the variable year is in the date format - the number of days since 01.01.1960 and that 
#age must be multiplied by 365.241 in order to be expressed in days.
fit <- rsadd(Surv(time,cens)~sex+as.factor(agegr)+ratetable(age=age*365.241,
	   sex=sex,year=year), ratetable=slopop,data=rdata,int=5)

#check the goodness of fit

#use the EM method and plot the smoothed baseline excess hazard
fit <- rsadd(Surv(time,cens)~sex+age+ratetable(age=age*365.241,
	   sex=sex,year=year), ratetable=slopop,data=rdata,int=5,method="EM")
sm <- epa(fit)

Example output

Loading required package: survival
Loading required package: splines
Loading required package: date
                        max     p
sex                   0.662 0.774
as.factor.agegr.54.61 1.068 0.204
as.factor.agegr.62.70 0.839 0.482
as.factor.agegr.71.95 1.054 0.216
GLOBAL                1.085 0.190

relsurv documentation built on April 5, 2018, 5:07 p.m.

Related to rsadd in relsurv...