# wkm

### Description

Weighted Kaplan-Meier estimator with discrete time-independent covariate

### Usage

1 2 |

### Arguments

`times` |
a vector of evaluation times |

`data` |
data frame containing the variables in formula (if is.null(formula) expected column names are: Y (time), D (status), W (strat. factor), V (left-truncation times)) |

`param` |
list of parameters containing: alpha: fractional parameter (default=1) var: if TRUE (default) calculate variance estimate cov: if FALSE (default) do not calculate covariance matrix estimate left.limit: if TRUE calculate left-continuous estimates, else calculate right-continuous estimates rr.subset: logical vector defining subset of observations to use for response rate estimation (default: use all observations) |

`formula` |
an object of class '"formula"' specifying the conditional survival model (only discrete covariates supported) |

### Details

This function calculates the weighted Kaplan-Meier estimator for the survival function with weights based on a discrete time-independent covariate as described in Murray/Tsiatis (1996).
The survival probabilities are evaluated at each entry in the vector `times`

. The data frame `data`

must either contain the variable in `formula`

or, if `formula`

is `NULL`

,
the variables `V`

(left-truncation time), `Y`

(censored failure time), `D`

(censoring indicator), `W`

(stratification variable).
If `var`

is `TRUE`

then an estimate of the asmyptotic variance is calculated for each entry in vector `times`

. If `cov`

is `TRUE`

then the `n x n`

asymptotic
covariance matrix is estimated, where `n`

is the length of vector `times`

. If `left.limit`

is `TRUE`

then a left-continuous estimate of the survival function is calculated instead
of a right-continuous estimate (default). If a logical vector `rr.subset`

is supplied, then only a subset of observations is used to estimate the response rates.

### Value

an object of class '"wkm"'

### References

S.~Murray and A.~A. Tsiatis. Nonparametric survival estimation using prognostic longitudinal covariates. *Biometrics*, 52(1):137–151, Mar. 1996.