Learn R Programming

survMisc (version 0.4.6)

sf: Estimates of survival (or hazard) function based on $n$ and $e$

Description

Estimates of survival (or hazard) function based on $n$ and $e$

Usage

sf(n, e, what = c("all", "s", "sv", "h", "hv"))

Arguments

n
Number at risk per time point (a vector)
e
Number of events per time point (a vector)
what
See return, below

Value

  • The return value will be a vector, unless what="all" (the default), in which case it will be a data.table. If what="s", the survival is returned, based on the Kaplan-Meier or product-limit estimator. This is $1$ at $t=0$ and thereafter is given by: $$\hat{S}(t) = \prod_{t \leq t_i} (1-\frac{e_i}{n_i} )$$

    If what="sv", the survival variance is returned. Greenwoods estimtor of the variance of the Kaplan-Meier (product-limit) estimator is: $$Var[\hat{S}(t)] = [\hat{S}(t)]^2 \sum_{t_i \leq t} \frac{e_i}{n_i (n_i-e_i)}$$

    If what="h", the hazard is returned, based on the the Nelson-Aalen estimator. This has a value of $\hat{H}=0$ at $t=0$ and thereafter is given by: $$\hat{H}(t) = \sum_{t \leq t_i} \frac{e_i}{n_i}$$

    If what="hv", the hazard variance is returned. The variance of the Nelson-Aalen estimator is given by: $$Var[\hat{H}(t)] = \sum_{t_i \leq t} \frac{e_i}{n_i^2}$$

    If what="all" (the default), all of the above are returned in a data.table, along with: Survival, based on the Nelson-Aalen estimator. Given by $$\hat{S_{na}}=e^{H}$$ where $H$ is hazard. HKM Hazard, based on the Kaplan-Meier estimator. Given by $$\hat{H_{km}}=-\log{S}$$ where $S$ is survival.

References

Examples for are from: K&M. what="sv": Table 4.1A, pg 93. what="hv": Table 4.2, pg 94. what="all": Table 4.3, pg 97.

Examples

Run this code
data(bmt, package="KMsurv")
b1 <- bmt[bmt$group==1, ] # ALL patients
t1 <- tne(Surv(time=b1$t2, event=b1$d3))
sf(n=t1$n, e=t1$e, what="all")
###
data(drug6mp, package="KMsurv")
s1 <- Surv(time=drug6mp$t2, event=drug6mp$relapse) # 6MP patients
t1 <- tne(s1)
sf(n=t1$n, e=t1$e, what="sv")
sf(n=t1$n, e=t1$e, what="hv")

Run the code above in your browser using DataLab