pyears
and
survexp
to aid in their
calculations.
ratetable(age, sex, year)
"dimid"
attribute of the rate table
being used by
pyears
or
survexp
. The units of time for the response
variable if present in the formula to
pyears
or
survexp
must match
the units of time (e.g.,
age
) in the rate table.
"ratetable"
with columns corresponding to the arguments
to
ratetable
. For
survexp.us
the columns are named
age
,
sex
, and
year
. The matrix has attributes necessary for
pyears
and
survexp
to complete their computations.
The purpose of this function is to match the data frame's variables
to the proper dimensions of the rate table. Argument order
is unimportant but the argument names are. For the
survexp.us
rate table,
the necessary argument names
age
,
sex
, and
year
are contained in the
"dimid"
attribute. This function is intended to be called in a
formula expression and not by itself.
# Create new data frame with the largest stop value for each patient hearta <- by(heart, IND=heart$id, FUN=function(x)x[x$stop==max(x$stop),]) hearta <- do.call("rbind", hearta) # Estimate of conditional survival survexp(stop ~ ratetable(sex="male", year=year*365.25, age=(age+48)*365.25), conditional=T, data=hearta) # Estimate of conditional survival stratified by prior surgery survexp(stop ~ surgery + ratetable(sex="male", year=year*365.25, age=(age+48)*365.25), conditional=T, data=hearta) rm(hearta)