sf {survMisc} | R Documentation |
survival (or hazard) function
based on e
and n
.
Description
survival (or hazard) function
based on e
and n
.
Usage
sf(x, ...)
## Default S3 method:
sf(x, ..., what = c("S", "H"), SCV = FALSE, times = NULL)
## S3 method for class 'ten'
sf(x, ..., what = c("S", "H"), SCV = FALSE, times = NULL, reCalc = FALSE)
## S3 method for class 'stratTen'
sf(x, ..., what = c("S", "H"), SCV = FALSE, times = NULL, reCalc = FALSE)
## S3 method for class 'numeric'
sf(
x,
...,
n = NULL,
what = c("all", "S", "Sv", "H", "Hv"),
SCV = FALSE,
times = NULL
)
Arguments
x |
One of the following:
|
... |
Additional arguments (not implemented). |
what |
See return, below. |
SCV |
Include the Squared Coefficient of
Variation, which is calcluated using
the mean
This measure of dispersion is also referred to as the 'standardized variance' or the 'noise'. |
times |
Times for which to calculate the function.
|
reCalc |
Recalcuate the values?
|
n |
Number at risk. |
Value
A data.table which is stored as an attribute of
the ten
object.
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 hazard estimator H
,
which is:
\hat{S_{na}}=e^{H}
Hazard, based on the Kaplan-Meier survival estimator S
,
which is:
\hat{H_{km}} = -\log{S}
Examples
data("kidney", package="KMsurv")
k1 <- ten(Surv(time=time, event=delta) ~ type, data=kidney)
sf(k1)
sf(k1, times=1:10, reCalc=TRUE)
k2 <- ten(with(kidney, Surv(time=time, event=delta)))
sf(k2)
## K&M. Table 4.1A, pg 93.
## 6MP patients
data("drug6mp", package="KMsurv")
d1 <- with(drug6mp, Surv(time=t2, event=relapse))
(d1 <- ten(d1))
sf(x=d1$e, n=d1$n, what="S")
data("pbc", package="survival")
t1 <- ten(Surv(time, status==2) ~ log(bili) + age + strata(edema), data=pbc)
sf(t1)
## K&M. Table 4.2, pg 94.
data("bmt", package="KMsurv")
b1 <- bmt[bmt$group==1, ] # ALL patients
t2 <- ten(Surv(time=b1$t2, event=b1$d3))
with(t2, sf(x=e, n=n, what="Hv"))
## K&M. Table 4.3, pg 97.
sf(x=t2$e, n=t2$n, what="all")