getBrassHazardFromTable: Compute expected hazards with respect to a corrected...

getBrassHazardFromTableR Documentation

Compute expected hazards with respect to a corrected reference life table

Description

returns the cumulative hazard and the hazard rate of subjects in a reference life table

Usage

getBrassPseudoHazardFromTable(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", 
		idname = "Id_byperiod",
		origin = "01/01/1970", format="%d/%m/%Y",
		left.open = FALSE, 
		SplineBrass=R2bBSplineBasis(knots=c(-2.5,0,2.5), degree=3)*c(1, 0, 1),
		verbose=FALSE)

Arguments

Y

An object with interval data. It can be an object of class Surv with arguments time, time2 and event or a two-column matrix with starting time in the first column and ending time in the second column.

startdate

a numeric vector such that as.Date(startadate) is interpreted as the date of the start (when Y[,]==0).

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 variables.

ratetable

an object of class ratetable, ie a table of event rates.

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 survexp an example bellow.

agemin

numeric value of the age at which the cumulative hazard starts.

scale

numeric value to scale agemin.

ratename, cumrateendname, cumrateentername, idname

names of the returned variables

origin, format

passed to as.Date

left.open

logical, passed to findInterval

SplineBrass

Spline basis used to transform the rates

verbose

logical, if true the progression of the computation is output.

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

getHazardFromTable for the cumulative hazard and the hazard rate of subjects in a 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 <- getPseudoHazardFromTable(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", 
	               idname="Id_byperiod"
	               ) 
	summary(HH)
}	
					

flexrsurv documentation built on June 7, 2023, 5:09 p.m.