Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

kphaz.fit

kphaz.fit


Description

Calculates Kaplan-Meier type hazard estimates.

Usage

kphaz.fit(time,status,strata,q=1,method="nelson")

Arguments

time

A vector of time values; all values must be greater than or equal to zero. Missing values (NAs) are not allowed.

status

A vector of status values. The values are 0 for censored or 1 for uncensored (dead). Missing values (NAs) are not allowed. Must have the same length as time.

strata

An optional vector that will be used to divide the subjects into disjoint groups. Each group generates a hazard curve. If missing, all subjects are assumed to be in the same strata. Missing values (NAs) are allowed.

q

Number of failure times combined for estimatingthe hazard at their midpoint. Default is 1.

method

Type of hazard estimation made. Must be one of "nelson" or "product-limit". The default is "nelson".

Details

Let

t[1] < t[2] < \cdots < t[m]

denote the m "distinct" death times.

1. Estimate the cumulative hazard, H[t[j]], and the variance of the cumulative hazard, Var(H[t[j]]), at each of the m distinct death times according to the method selected.

a. For the "nelson" method:

H[t[j]] = sum(t[i] <= t[j]) status[i]/(n-i+1)

Var(H[t[j]]) = ∑(t[i] <= t[j]) status[i]/((n-i+1)^2)

b. For the "product-limit" metod:

H[t[j]] = sum(t[i] <= t[j]) -log(1 - status[i]/(n-i+1))

Var(H[t[j]]) = sum(t[i] <= t[j]) status[i]/((n-i+1)*(n-i))

2. For k=1,...,(m-q), define the hazard estimate and variance at time[k] = (t[q+j]+t[j])/2 to be

haz[time[k]] = (H[t[q+j]]-H[t[j]])/(t[q+j]-t[j])

var[time[k]] = (Var(H[t[q+j]])-Var(H[t[j]]))/ (t[q+j]-t[j])^2

Note that if the final time is a death time rather than a censoring time, the "product-limit" estimate will be Inf for the final hazard and variance estimates.

Value

A list representing the results of the hazard estimation, with the following components:

time

A vector containing the times at which hazard estimations were made.

haz

A vector containing the hazard estimate at each time.

var

A vector containing variance estimates for each hazard estimate.

strata

A vector which divides the hazard estimate into disjoint groups. This vector is returned only if 'strata' is defined when 'kphaz.fit' is called.

References

Jarjoura, David (1988). Smoothing Hazard Rates with Cubic Splines. Commun. Statist. -Simula. 17(2), 377-392.

See Also

Examples

time <- 1:10
status <- rep(1,10)
kphaz.fit(time,status)

muhaz

Hazard Function Estimation in Survival Analysis

v1.2.6.4
GPL
Authors
S original by Kenneth Hess, R port by R. Gentleman
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.