extracth0: Function that extracts the hazard function from a 'coxph'...

Description Usage Arguments Details Value

Description

This function extracts the hazard function h_0 from a given coxph object. The object must be provided with the original dataset used for the modeling. The result of the function isn't equivalent to the result of basehaz function, because the latter provides the cumulative baseline hazard H_0(t) and not the hazard function itself.

Usage

1
2
extracth0(dataset, model, times, events, smoothed = FALSE, spar = 0.75,
  grid = 1000)

Arguments

dataset

The dataset as data.frame for modeling the baseline hazard rate

model

The coxph object for calculating the baseline hazard rate

times

The vector of times where events are recorded

events

The vector of the events (0) for censored cases, (1) for recorded events

smoothed

If TRUE return values smoothed according a smooth.spline function

spar

Smoothing parameter, used only if smoothed = TRUE

grid

Number of estimation point of h_0(t) function

Details

The survival function of a Cox proportional hazards model is given by the equation:

S≤ft ( t|x \right )=\exp ≤ft [ -H_0≤ft ( t \right )*\exp≤ft ( β'X \right ) \right ]

where:

H_0≤ft ( t \right )=\int_{0}^{t}h_0≤ft ( u \right )du

Knowing the value of h_0≤ft ( t \right ) it is possible for a given value of β'X to compute the expected survival time. In fact given:

h(t)=h_0(t)*\exp≤ft ( β'X \right )

and censoring time c=U*max(t) where U \sim Uni≤ft [ 0,1 \right ], that is U follows a uniform distribution on the interval from 0 to 1, and max(t) is the maximum observation time for the population to be simulated, the calculated survival time is

T=\frac{-\log{≤ft (U \right )}}{h_t}

It is possible to simulate the censoring in the population by considering that censored cases are they where c<T. Starting from a base coxph model it is possible to give in output a matrix of values of time and h_0(t) needed for the simulation of a Cox distribution with the same covariates, coefficients and baseline hazard of the generating one.

Value

A data.frame with h_0 values and related times.


kbolab/distrcox documentation built on May 20, 2019, 8:10 a.m.