# Compute arbitrary quantile of a Kaplan-Meier estimate of a survival function

### Description

In survival analysis, often some quantiles (mainly the median) of an estimated survival function
are of interest. The survfit function in the 'survival' packages of version *< 2.35* computed median time to event. However,
the output of that function was such that the median is not accessible by the user (it can only be read
off the output). This function makes the median and any other quantile accessible by the user.

### Usage

1 2 3 |

### Arguments

`time` |
Event times, censored or observed. |

`event` |
Censoring indicator, 1 for event, 0 for censored. |

`group` |
Quantiles can be computed for several survival curves, defined by |

`quant` |
Quantile to be computed. Real number in |

`conf.level` |
Significance level for confidence interval for the time to event quantile. |

`conftype` |
Type of confidence interval to be computed. For possible choices see above, and for specifications
regarding the different options confer the help file of the function |

`conflower` |
Controls modified lower limits to the curve, the upper limit remains unchanged. See |

### Value

`n` |
Number of observations used. |

`events` |
Number of events. |

`quantile` |
Quantile estimate. |

`lower.ci` |
Lower limit of confidence interval. |

`upper.ci` |
Upper limit of confidence interval. |

### Author(s)

Kaspar Rufibach

kaspar.rufibach@gmail.com

### References

Computation of confidence intervals is done according to

Brookmeyer, R. and Crowley, J. (1982).
A Confidence Interval for the Median Survival Time.
*Biometrics*, **38**, 29–41.

### See Also

Partly based on the function `survfit`

.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
## use Acute Myelogenous Leukemia survival data contained in package 'survival'
time <- leukemia[, 1]; status <- leukemia[, 2]; x <- as.factor(leukemia[, 3])
plot(survfit(Surv(time, status) ~ x, conf.type = "none"), mark = "/", col = 1:2)
## median time to event
qKM <- quantileKM(time, status, group = x, quant = 0.5, conf.level = 0.95,
conftype = "log")
qKM
## extract results
qKM$quantities
## comparison to standard function (median time to event not accessible by user)
quant.surv <- survfit(Surv(time, status) ~ x, conf.int = 0.95)
quant.surv
## compute arbitrary quantile
qKM2 <- quantileKM(time, status, group = x, quant = 0.25, conf.level = 0.95,
conftype = "log")
qKM2
``` |