getHazardFromTable {flexrsurv} | R Documentation |
computes expected hazards with respect to a reference life table
Description
returns the cumulative hazard and the hazard rate of subjects in a reference life table
Usage
getHazardFromTable(Y, startdate, startage, matchdata = NULL,
ratetable = survival::survexp.us,
age = 1, year = 2, rmap, agemin = 16, scale = 365.25,
ratename = "rateend",
cumrateendname = "cumrateend",
cumrateentername = "cumrateenter",
origin = "01/01/1970", format = "%d/%m/%Y",
left.open = FALSE, verbose=FALSE)
Arguments
Y |
An object with interval data. It can be an object of class |
startdate |
a numeric vector such that |
startage |
a numeric vector of age in days the start (when Y[,]==0). |
matchdata |
an optional data.frame in which to interpret the additional variables to be mapped to the |
ratetable |
an object of class |
age , year |
character values of the names of the age and period variables in the rate table. |
rmap |
an optional list that maps data set names to the ratetable names. See |
agemin |
numeric value of the age at which the cumulative hazard starts. |
scale |
numeric value to scale |
ratename , cumrateendname , cumrateentername |
names of the returned variables |
origin , format |
arguments passed |
left.open |
logical, passed to |
verbose |
logical, if |
Details
The cumulative rates are computed using survexp
.
Value
A data.frame
with 3 columns with the rate at the ending time, the cumulative rate from agemin up to the starting time and upt to the ending time.
See Also
getPseudoHazardFromTable
for the cumulative hazard in each period of a reference life table.
getBrassHazardFromTable
for the cumulative hazard in a corrected reference life table.
survexp
Examples
if (requireNamespace("relsurv", quietly = TRUE) & requireNamespace("date", quietly = TRUE)) {
library(date)
# data from package relsurv
data(rdata, package="relsurv")
# rate table from package relsurv
data(slopop, package="relsurv")
tmpsurv <- Surv(rep(0, length(rdata$time)), rdata$time, rdata$cens)
HH <- getHazardFromTable(tmpsurv, startdate=rdata$year,
startage=rdata$age*365.24 , matchdata=rdata, ratetable=slopop,
age="age", year="year",
rmap=list(sex=sex),
agemin=18, scale=365.24,
ratename = "poprate",
cumrateendname ="cumrateend",
cumrateentername ="cumrateenter"
)
summary(HH)
}