## Compute the extreme quantile procedure for Cox model

### Description

Compute the extreme quantile procedure for Cox model

### Usage

```cox.adapt(X, cph, cens = rep(1, length(X)), data = rep(0, length(X)),
initprop = 1/10, gridlen = 100, r1 = 1/4, r2 = 1/20,
CritVal = 10)
```

### Arguments

 `X` a numeric vector of data values. `cph` an output object of the function coxph from the package survival. `cens` a binary vector corresponding to the censored values. `data` a data frame containing the covariates values. `initprop` the initial proportion at which we begin to test the model. `gridlen` the length of the grid for which the test is done. `r1` a proportion value of the data from the right that we skip in the test statistic. `r2` a proportion value of the data from the left that we skip in the test statistic. `CritVal` the critical value assiociated to procedure.

### Details

Given a vector of data, a vector of censorship and a data frame of covariates, this function compute the adaptive procedure described in Grama and Jaunatre (2018).

We suppose that the data are in the domain of attraction of the Frechet-Pareto type and that the hazard are somewhat proportionals. Otherwise, the procedure will not work.

### Value

 `coefficients` the coefficients of the coxph procedure. `Xsort` the sorted vector of the data. `sortcens` the sorted vector of the censorship. `sortebz` the sorted matrix of the covariates. `ch` the Hill estimator associated to the baseline function. `TestingGrid` the grid used for the statistic test. `TS,TS1,TS.max,TS1.max` respectively the test statistic, the likelihood ratio test, the maximum of the test statistic and the maximum likelihood ratio test. `window1,window2` indices from which the threshold was chosen. `Paretodata` logical: if TRUE the distribution of the data is a Pareto distribution. `Paretotail` logical: if TRUE a Pareto tail was detected. `madapt` the first indice of the TestingGrid for which the test statistic exceeds the critical value. `kadapt` the adaptive indice of the threshold. `kadapt.maxlik` the maximum likelihood corresponding to the adaptive threshold in the selected testing grid. `hadapt` the adaptive weighted parameter of the Pareto distribution after the threshold. `Xadapt` the adaptive threshold.

### Author(s)

Ion Grama, Kevin Jaunatre

### References

Grama, I. and Jaunatre, K. (2018). Estimation of Extreme Survival Probabilities with Cox Model. arXiv:1805.01638.

`coxph`

### Examples

```
library(survival)