Description Usage Arguments Details Value
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.
1 2 |
dataset |
The dataset as |
model |
The |
times |
The vector of times where events are recorded |
events |
The vector of the events |
smoothed |
If |
spar |
Smoothing parameter, used only if |
grid |
Number of estimation point of h_0(t) function |
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.
A data.frame
with h_0 values and related times.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.