kphaz.fit: kphaz.fit

Description Usage Arguments Details Value References See Also Examples

View source: R/all.R

Description

Calculates Kaplan-Meier type hazard estimates.

Usage

1
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

kphaz.plot

Examples

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

Example output

$time
[1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5

$haz
[1] 0.1111111 0.1250000 0.1428571 0.1666667 0.2000000 0.2500000 0.3333333
[8] 0.5000000 1.0000000

$var
[1] 0.01234568 0.01562500 0.02040816 0.02777778 0.04000000 0.06250000 0.11111111
[8] 0.25000000 1.00000000

muhaz documentation built on April 21, 2021, 5:06 p.m.

Related to kphaz.fit in muhaz...