1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rssurvrsadd.r
\name{rs.surv.rsadd}
\alias{rs.surv.rsadd}
\title{Compute a Relative Survival Curve from an additive relative survival model}
\usage{
rs.surv.rsadd(formula, newdata)
}
\arguments{
\item{formula}{a \code{rsadd} object (Implemented only for models fitted
with the codemax.lik (default) option.)}
\item{newdata}{a data frame with the same variable names as those that
appear in the \code{rsadd} formula. a predicted curve for each individual
in this data frame shall be calculated}
}
\value{
a \code{survfit} object; see the help on \code{survfit.object} for
details. The \code{survfit} methods are used for \code{print}, \code{plot},
\code{lines}, and \code{points}.
}
\description{
Computes the predicted relative survival function for an additive relative
survival model fitted with maximum likelihood.
}
\details{
Does not work with factor variables - you have to form dummy variables
before calling the rsadd function.
}
\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("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")
}
\references{
Package. Pohar M., Stare J. (2006) "Relative survival analysis
in R." Computer Methods and Programs in Biomedicine, \bold{81}: 272--278
}
\seealso{
\code{survfit}, \code{survexp}
}
\keyword{survival}
|