# cutp: *cut p*oint for a continuous variable in a model fit with... In survMisc: Miscellaneous Functions for Survival Data

## Description

Determine the optimal cut point for a continuous variable in a `coxph` or `survfit` model.

## Usage

 ```1 2 3 4 5 6 7``` ```cutp(x, ...) ## S3 method for class 'coxph' cutp(x, ..., defCont = 3) ## S3 method for class 'survfit' cutp(x, ..., defCont = 3) ```

## Arguments

 `x` A `survfit` or `coxph` object `defCont` definition of a continuous variable. If the variable has > `defCont` unique values, it is treated as continuous and a cut point is determined. `...` Additional arguments (not implemented).

## Details

For a cut point mu, of a predictor K, the variable is split into two groups, those >= mu and those < mu.
The score (or log-rank) statistic, sc, is calculated for each unique element k in K and uses

• e1[i] the number of events

• n1[i] the number at risk

in those above the cut point, respectively.
The basic statistic is

sc[k] = sum (e1[i] - n1[i] * e[i] / n[i])

The sum is taken across times with observed events, to D, the largest of these.
It is normalized (standardized), in the case of censoring, by finding s^2 which is:

s^2 = (1 / (D - 1)) * sum[i:D](1 - sum[j:i](1 / (D - j + 1))^2 )

The test statistic is then

Q = max(abs(sc[k])) / s * sqrt((D - 1))

Under the null hypothesis that the chosen cut point does not predict survival, the distribution of Q has a limiting distibution which is the supremum of the absolute value of a Brownian bridge:

p= P(Q >= q) = 2 sum[i:Inf](-1)^(i + 1) * e^(-2 * i^2 *q^2)

## Value

A `list` of `data.table`s.
There is one list element per continuous variable.
Each has a column with possible values of the cut point (i.e. unique values of the variable), and the additional columns:

 `U` The score (log-rank) test for a model with the variable 'cut' into into those >= the cutpoint and those below. `Q` The test statistic. `p` The p-value.

The tables are ordered by p-value, lowest first.

## References

Contal C, O'Quigley J, 1999. An application of changepoint methods in studying the effect of age on survival in breast cancer. Computational Statistics & Data Analysis 30(3):253–70. ScienceDirect (paywall)

Mandrekar JN, Mandrekar, SJ, Cha SS, 2003. Cutpoint Determination Methods in Survival Analysis using SAS. Proceedings of the 28th SAS Users Group International Conference (SUGI). Paper 261-28. SAS (free)

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35``` ```## Mandrekar et al. above data("bmt", package="KMsurv") b1 <- bmt[bmt\$group==1, ] # ALL patients c1 <- coxph(Surv(t2, d3) ~ z1, data=b1) # z1=age c1 <- cutp(c1)\$z1 data.table::setorder(c1, "z1") ## [] below is used to print data.table to console c1[] ## Not run: ## compare to output from survival::coxph matrix( unlist( lapply(26:30, function(i) c(i, summary(coxph(Surv(t2, d3) ~ z1 >= i, data=b1))\$sctest))), ncol=5, dimnames=list(c("age", "score_test", "df", "p"))) cutp(coxph(Surv(t2, d3) ~ z1, data=bmt[bmt\$group==2, ]))\$z1[] cutp(coxph(Surv(t2, d3) ~ z1, data=bmt[bmt\$group==3, ]))[[1]][] ## K&M. Example 8.3, pg 273-274. data("kidtran", package="KMsurv") k1 <- kidtran ## patients who are male and black k2 <- k1[k1\$gender==1 & k1\$race==2, ] c2 <- coxph(Surv(time, delta) ~ age, data=k2) print(cutp(c2)) ## check significance of computed value summary(coxph(Surv(time, delta) ~ age >= 58, data=k2)) k3 <- k1[k1\$gender==2 & k1\$race==2, ] c3 <- coxph(Surv(time, delta) ~ age, data=k3) print(cutp(c3)) ## doesn't apply to binary variables e.g. gender print(cutp(coxph(Surv(time, delta) ~ age + gender, data=k1))) ## End(Not run) ```

### Example output

```Loading required package: survival
z1         U          Q          p
1: 15 0.0000000 0.00000000 1.00000000
2: 17 0.7502634 0.16683217 1.00000000
3: 18 0.4232100 0.09410701 1.00000000
4: 19 0.7427106 0.16515268 1.00000000
5: 20 0.2724980 0.06059396 1.00000000
6: 21 0.2736081 0.06084081 1.00000000
7: 22 0.7416005 0.16490584 1.00000000
8: 23 2.1637208 0.48113533 0.97474717
9: 24 1.2170637 0.27063210 0.99999955
10: 26 3.2474808 0.72212539 0.67415725
11: 27 4.7286924 1.05149469 0.21883201
12: 28 5.6821864 1.26351820 0.08209497
13: 29 4.7785156 1.06257363 0.20885364
14: 30 3.4222249 0.76098233 0.60871287
15: 32 2.5916317 0.57628765 0.89403817
16: 36 3.6068403 0.80203429 0.54083616
17: 37 2.8074971 0.62428851 0.83058351
18: 39 2.1070787 0.46854011 0.98060360
19: 40 1.6013513 0.35608416 0.99958127
20: 42 0.9736842 0.21651309 1.00000000
[,1]        [,2]         [,3]         [,4]        [,5]
age        26.0000000 27.00000000 28.000000000 29.000000000 30.00000000
score_test  1.9195957  4.91019534  9.453363533  8.646732729  5.27806670
df          1.0000000  1.00000000  1.000000000  1.000000000  1.00000000
p           0.1659012  0.02669862  0.002107622  0.003276484  0.02159571
z1         U          Q         p
1: 28 4.5270838 0.98359005 0.2880073
2: 30 3.6540586 0.79390968 0.5540826
3: 29 3.5720297 0.77608743 0.5834910
4: 27 3.4147519 0.74191601 0.6407884
5: 26 3.3621348 0.73048399 0.6600702
6: 23 3.2577394 0.70780224 0.6982105
7: 32 2.9489805 0.64071882 0.8062345
8: 21 2.7450586 0.59641315 0.8689962
9: 22 2.6623427 0.57844164 0.8914769
10: 33 2.6009944 0.56511262 0.9068426
11: 25 2.5662010 0.55755312 0.9150305
12: 31 2.1869171 0.47514690 0.9776622
13: 34 1.5691590 0.34092790 0.9998194
14: 17 1.4697921 0.31933865 0.9999563
15: 43 1.4453431 0.31402668 0.9999706
16: 19 1.3875985 0.30148062 0.9999894
17: 35 1.1830743 0.25704408 0.9999999
18: 50 1.1477159 0.24936184 1.0000000
19: 37 1.1170831 0.24270631 1.0000000
20: 18 0.8706633 0.18916719 1.0000000
21: 16 0.7077287 0.15376673 1.0000000
22: 14 0.5953967 0.12936060 1.0000000
23: 46 0.5523192 0.12000123 1.0000000
24: 45 0.5415682 0.11766539 1.0000000
25: 15 0.1123319 0.02440612 1.0000000
26: 13 0.0000000 0.00000000 1.0000000
z1         U          Q         p
z1          U           Q         p
1: 23 3.49406081 0.639185853 0.8085528
2: 24 3.48042241 0.636690912 0.8123064
3: 22 3.14860843 0.575990538 0.8943891
4: 18 2.96035766 0.541552891 0.9310460
5: 27 2.60302171 0.476183657 0.9771747
6: 15 2.47567206 0.452886955 0.9864839
7: 25 2.10593236 0.385248638 0.9984030
8: 17 2.10118201 0.384379635 0.9984585
9: 20 1.96745839 0.359916910 0.9994909
10: 47 1.95138095 0.356975784 0.9995615
11: 14 1.87505233 0.343012611 0.9997958
12: 35 1.79422679 0.328226795 0.9999188
13: 29 1.69326776 0.309757860 0.9999789
14: 19 1.58586761 0.290110617 0.9999963
15: 11 1.57860647 0.288782302 0.9999967
16: 33 1.33417447 0.244067145 1.0000000
17: 50 1.32930492 0.243176335 1.0000000
18: 45 1.14416212 0.209307245 1.0000000
19:  8 0.88417564 0.161746631 1.0000000
20: 37 0.78709903 0.143987926 1.0000000
21: 40 0.75155349 0.137485403 1.0000000
22: 32 0.74325904 0.135968059 1.0000000
23: 41 0.62293656 0.113956871 1.0000000
24: 48 0.57689090 0.105533510 1.0000000
25: 39 0.40983241 0.074972673 1.0000000
26: 36 0.34440367 0.063003470 1.0000000
27: 31 0.31877771 0.058315586 1.0000000
28: 44 0.31062750 0.056824628 1.0000000
29: 43 0.15725524 0.028767481 1.0000000
30: 52 0.04518513 0.008265939 1.0000000
31:  7 0.00000000 0.000000000 1.0000000
z1          U           Q         p
\$age
age         U          Q         p
1:  58 2.6324038 0.80293399 0.5393762
2:  57 2.4538287 0.74846514 0.6297514
3:  64 2.4501868 0.74735429 0.6316225
4:  63 2.4172171 0.73729790 0.6485770
5:  39 2.4102361 0.73516853 0.6521689
6:  62 2.3171861 0.70678650 0.6999099
7:  55 2.2687723 0.69201937 0.7244766
8:  38 2.1567961 0.65786446 0.7797318
9:  60 2.1129700 0.64449664 0.8004834
10:  37 2.0567651 0.62735307 0.8261290
11:  36 1.8910105 0.57679472 0.8934379
12:  52 1.8893288 0.57628175 0.8940451
13:  59 1.8273697 0.55738302 0.9152103
14:  40 1.8219100 0.55571772 0.9169593
15:  56 1.8202578 0.55521376 0.9174847
16:  30 1.8104842 0.55223264 0.9205569
17:  54 1.7082776 0.52105764 0.9488589
18:  44 1.6557991 0.50505070 0.9606225
19:  65 1.6357561 0.49893720 0.9646209
20:  43 1.5557681 0.47453930 0.9779446
21:  53 1.3875202 0.42322046 0.9939575
22:  42 1.3826608 0.42173825 0.9942233
23:  33 1.3778787 0.42027962 0.9944762
24:  51 1.3712143 0.41824682 0.9948146
25:  47 1.1385707 0.34728603 0.9997394
26:  32 1.0843323 0.33074228 0.9999041
27:  23 1.0532184 0.32125195 0.9999498
28:  41 1.0426363 0.31802420 0.9999603
29:  50 1.0311897 0.31453277 0.9999694
30:  31 0.9638931 0.29400600 0.9999946
31:  46 0.8799251 0.26839415 0.9999997
32:  28 0.8511069 0.25960403 0.9999999
33:  66 0.8418331 0.25677534 0.9999999
34:  45 0.6666687 0.20334682 1.0000000
35:  27 0.6450299 0.19674658 1.0000000
36:  26 0.4719227 0.14394553 1.0000000
37:  22 0.4400556 0.13422545 1.0000000
38:  25 0.4266073 0.13012347 1.0000000
39:  49 0.3511406 0.10710467 1.0000000
40:  21 0.3400245 0.10371405 1.0000000
41:  24 0.1532494 0.04674404 1.0000000
42:  48 0.1510785 0.04608187 1.0000000
43:   7 0.0000000 0.00000000 1.0000000
age         U          Q         p

Call:
coxph(formula = Surv(time, delta) ~ age >= 58, data = k2)

n= 92, number of events= 14

coef exp(coef) se(coef)     z Pr(>|z|)
age >= 58TRUE 1.4279    4.1700   0.6386 2.236   0.0253 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

exp(coef) exp(-coef) lower .95 upper .95
age >= 58TRUE      4.17     0.2398     1.193     14.58

Concordance= 0.607  (se = 0.068 )
Rsquare= 0.045   (max possible= 0.697 )
Likelihood ratio test= 4.21  on 1 df,   p=0.04
Wald test            = 5  on 1 df,   p=0.03
Score (logrank) test = 5.87  on 1 df,   p=0.02

\$age
age         U          Q         p
1:  48 3.0965494 0.94450736 0.3342762
2:  46 2.9554945 0.90148289 0.3906865
3:  44 2.9089872 0.88729727 0.4105065
4:  45 2.4986631 0.76214050 0.6067715
5:  59 2.1335713 0.65078043 0.7908033
6:  57 1.9887986 0.60662196 0.8553949
7:  54 1.9678086 0.60021962 0.8639918
8:  43 1.9062716 0.58144964 0.8878512
9:  23 1.7606838 0.53704256 0.9352296
10:  50 1.6157334 0.49282988 0.9683466
11:  40 1.5754543 0.48054397 0.9750458
12:  42 1.4885296 0.45403026 0.9861038
13:  61 1.3664319 0.41678810 0.9950475
14:  56 1.3543248 0.41309521 0.9956016
15:  21 1.3038525 0.39770017 0.9974177
16:  49 1.2498111 0.38121652 0.9986476
17:  39 1.2334880 0.37623765 0.9989071
18:  38 1.1194601 0.34145694 0.9998136
19:  25 1.0496831 0.32017360 0.9999535
20:  37 0.9784052 0.29843247 0.9999919
21:  66 0.9652148 0.29440914 0.9999944
22:  36 0.8643773 0.26365176 0.9999998
23:  52 0.7901217 0.24100236 1.0000000
24:  35 0.7503494 0.22887105 1.0000000
25:  64 0.7323542 0.22338216 1.0000000
26:  33 0.6363215 0.19409034 1.0000000
27:  41 0.6284213 0.19168064 1.0000000
28:  31 0.5222936 0.15930964 1.0000000
29:  27 0.4304879 0.13130713 1.0000000
30:  20 0.2473325 0.07544120 1.0000000
31:  55 0.2105542 0.06422311 1.0000000
32:  13 0.0000000 0.00000000 1.0000000
age         U          Q         p

\$age
age           U           Q            p
1:  40 40.40605202 3.484347686 5.698629e-11
2:  41 39.54197790 3.409835713 1.592076e-10
3:  39 38.67195782 3.334811000 4.380090e-10
4:  42 37.87058656 3.265706101 1.090613e-09
5:  43 37.10139207 3.199375914 2.571272e-09
6:  44 36.78899819 3.172437154 3.624434e-09
7:  47 35.80605086 3.087674351 1.047454e-08
8:  37 35.49550181 3.060894678 1.455975e-08
9:  46 35.07167226 3.024346452 2.271601e-08
10:  38 34.42598779 2.968666942 4.427615e-08
11:  48 34.41154407 2.967421412 4.493573e-08
12:  45 34.32611283 2.960054393 4.903670e-08
13:  36 33.66162344 2.902753272 9.601072e-08
14:  35 31.63925009 2.728357320 6.844021e-07
15:  34 31.45310148 2.712305110 8.150219e-07
16:  49 29.73992576 2.564572293 3.875194e-06
17:  33 29.03407432 2.503704386 7.182061e-06
18:  50 27.32166442 2.356037609 3.016949e-05
19:  54 27.06228888 2.333670797 3.721154e-05
20:  52 26.40574646 2.277054970 6.272117e-05
21:  32 25.76574596 2.221865607 1.030572e-04
22:  51 25.63836525 2.210881147 1.135981e-04
23:  53 24.37173644 2.101655550 2.914142e-04
24:  55 24.10930856 2.079025524 3.521170e-04
25:  31 22.97605279 1.981301126 7.786405e-04
26:  57 21.57222515 1.860244419 1.973649e-03
27:  56 21.41141659 1.846377365 2.187335e-03
28:  30 21.16090486 1.824774908 2.563300e-03
29:  29 19.85958435 1.712557731 5.670030e-03
30:  60 17.85326132 1.539545851 1.747024e-02
31:  58 17.38936899 1.499542880 2.227897e-02
32:  59 17.33350331 1.494725397 2.293107e-02
33:  28 16.49111184 1.422083191 3.503179e-02
34:  27 16.01111106 1.380691134 4.418015e-02
35:  62 14.04795046 1.211401293 1.062470e-01
36:  26 13.99498896 1.206834248 1.086188e-01
37:  61 13.97097529 1.204763470 1.097085e-01
38:  25 13.18577001 1.137052618 1.506106e-01
39:  64 12.81369996 1.104967785 1.738749e-01
40:  24 12.61622656 1.087939000 1.873270e-01
41:  63 12.47504385 1.075764347 1.974330e-01
42:  23 10.82315045 0.933316109 3.484025e-01
43:  65 10.22397437 0.881647170 4.185632e-01
44:  22  8.46275060 0.729771012 6.612726e-01
45:  66  8.22319308 0.709113174 6.960158e-01
46:  21  6.87680316 0.593009512 8.734014e-01
47:  18  4.88309424 0.421085388 9.943376e-01
48:  20  4.64660947 0.400692524 9.971215e-01
49:  19  4.44718677 0.383495644 9.985133e-01
50:  17  4.01016523 0.345809829 9.997602e-01
51:  67  3.96429379 0.341854183 9.998092e-01
52:  16  3.68785050 0.318015562 9.999603e-01
53:  14  3.33450631 0.287545523 9.999971e-01
54:  13  2.97522755 0.256563726 9.999999e-01
55:  68  2.23387467 0.192634411 1.000000e+00
56:  12  2.15499415 0.185832283 1.000000e+00
57:  11  1.79204023 0.154533564 1.000000e+00
58:   8  1.53346552 0.132235810 1.000000e+00
59:   7  1.23679181 0.106652654 1.000000e+00
60:   6  0.91447708 0.078858387 1.000000e+00
61:  70  0.73710839 0.063563298 1.000000e+00
62:   5  0.71007700 0.061232291 1.000000e+00
63:   3  0.53351020 0.046006352 1.000000e+00
64:   2  0.24714577 0.021312199 1.000000e+00
65:  71  0.15880390 0.013694186 1.000000e+00
66:  75  0.06901279 0.005951202 1.000000e+00
67:   1  0.00000000 0.000000000 1.000000e+00
age           U           Q            p

\$gender
[1] NaN
```

survMisc documentation built on May 2, 2019, 5:14 p.m.