1. surv
Description
Creates a living object, typically used as a response variable in a model formula. Parameter matching is a special feature of this feature, see the detailed information below.
SURV (Time, Time2, event, type=c (' Right ', ' left ', ' interval ', ' Counting ', ' interval2 ', ' mstate '), origin=0) are. SURV (x)
Arguments
Time
for right-censored data, this is a tracking time. For interval data, the first parameter is the start time of the interval.
Event
status indication, usually, 0 = alive, 1 = dead. Other options are true/false (TRUE = dead) or 1/2 (2= death). For interval censored data, status indication, 0 = right deletion, 1 = event time, 2 = left deletion, 3 = interval deletion.
right-censoring: only know the actual life is greater than a certain number;
left censoring: only know the actual life is less than a certain number;
interval deletion (Interval censoring): Only know the actual life span within a time interval.
time2
the end time of the interval delete interval or only the process data is counted.
type
Specifies the type of deletion. "Right", "left", "Counting", "interval", "Interval2" or "mstate".
If the event variable is a factor, assume type= "Mstate". If the parameter time2,type= "right" is not specified, if the parameter time2,type= "Counting" is specified
Surv Use Example
> str (lung) ' data.frame ': 228 obs. Of ten variables: $ inst:num 3 3 3 5 1 7 each 1 7 ... $ time:num 306 45 5 1010 883 ... $ status:num 2 2 1 2 2 1 2 2 2 2 ... $ age:num-all-in-all ... $ sex : num 1 1 1 1 1 1 2 2 1 1 ... $ ph.ecog:num 1 0 0 1 0 1 2 2 1 2 ... $ ph.karno:num 90 90 90 90 100 50 70 60 70 7 0 ... $ pat.karno:num ... $ meal.cal:num 1175 1225 na 1150 na ... $ wt.loss:num na ($) ... $ 0 0 1 ...> with (Lung, surv (time, status)) [1] 306 455 1010+ 210 883 1022+ 310 361 218 [10] 166 170 654 728 71 567 144 613 707 [19] 61 88 301 81 624 371 394 520 574 [28 ] 118 390 12 473 26 533 107 53 122 [37] 814 965+ 93 731 460 153 433 145 583 [46] 95 303 519 643 765 735 189 53 246 [55] 689 65 5 132 687 345 444 223 175 [64] 60 163 65 208 821+ 428 230 840+ 305 [73] 11 132 226 426 705 363 11 176 791 [82] 95 196+ 167 806+ 284 641 147 740+ 163 [91] 655 239 88 245 588+ 30 179 310 477 [100] 166 559+ 450 364 107 177 1 56 529+ 11 [109] 429 351 15 181 283 201 524 13 212 [118] 524 288 363 442 199 550 54 558 207 [127] 92 60 551+ 543+ 293 202 353 511+ 267 [136] 511+ 371 387 457 337 201 404+ 222 62 [145] 458+ 356+ 353 163 31 340 229 444+ 315+[154] 182 156 329 364+ 291 179 376+ 384+ 2 68 [163] 292+ 142 413+ 266+ 194 320 181 285 301+[172] 348 197 382+ 303+ 296+ 180 186 145 269+[ 181] 300+ 284+ 350 272+ 292+ 332+ 285 259+ 110 [190] 286 270 81 131 225+ 269 225+ 243+ 279+[199] 276+ 135 79 59 240+ 202+ 235+ 105 224+[208] 239 237+ 173+ 252+ 221+ 185+ 92+ 13 222+[217] 19 183 211+ 175+ 197+ 203+ 188+ 191+[226] 105+ 174+ 177+> str (heart) ' Data.frame ': 172 obs. of 8 variables: $ start:num 0 0 0 1 0 675 0 0 0 Wuyi ... $ stop:num 6 1-3-... $ event:num 1 1 0 1 0 1 1 1 0 1 ... $ age:num-17.16 3.84 6.3 6.3-7.74 ... $ year:num 0.123 0.255 0.266 0.266 0.49 ... $ surgery:num 0 0 0 0 0 0 0 0 0 0 ... $ transplant:factor w/2 levels "0", "1": 1 1 1 2 1 2 1 1 1 2 ... $ id:num 1 2 3 3 4 4 5 6 7 7 ...> surv (Heart$start, Heart$stop, heart$event) [1] (0.0, 50.0] (0.0, 6.0] (0.0, 1.0+] [4] (1.0, 1 6.0] (0.0, 36.0+] (36.0, 39.0] [7] (0.0, 18.0) (0.0, 3.0] (0.0, 51.0+] [10] (51.0, 675.0] (0.0, 4 0.0] (0.0, 85.0] [13] (0.0, 12.0+] (12.0, 58.0) (0.0, 26.0+] [16] (26.0, 153.0] (0.0, 8.0] (0.0, 1 7.0+] [19] (17.0, 81.0] (0.0, 37.0+] (37.0,1387.0] [22] (0.0, 1.0] (0.0, 28.0+] (28.0, 308.0] [25] (0. 0, 36.0] (0.0, 20.0+] (20.0, 43.0] [28] (0.0, 37.0] (0.0, 18.0+] (18.0, 28.0] [31] (0.0, 8.0+] (8.0,1032.0] (0.0, 12.0 +] [34] (12.0, 51.0] (0.0, 3.0+] (3.0, 733.0] [37] (0.0, 83.0+] (83.0, 219.0] (0.0, 25.0+] [40] (25.0,1 800.0+] (0.0,1401.0+] (0.0, 263.0] [43] (0.0, 71.0+] (71.0, 72.0] (0.0, 35.0] [46] (0.0, 16.0+] (16.0, 852.0] (0.0, 16.0] [49] (0.0, 17.0+] (17.0, 77.0] (0.0, 51.0+] [52] (51.0,1587.0+] (0.0, 23.0+] (23.0,1 572.0+] [55] (0.0, 12.0] (0.0, 46.0+] (46.0, 100.0) [58] (0.0, 19.0+] (19.0, 66.0] (0.0, 4.5+] [61] ( 4.5, 5.0] (0.0, 2.0+] (2.0, 53.0] [64] (0.0, 41.0+] (41.0,1408.0+] (0.0, 58.0+] [67] (58.0,1322.0+] ( 0.0, 3.0] (0.0, 2.0] [70] (0.0, 40.0] (0.0, 1.0+] (1.0, 45.0] [73] (0.0, 2.0+] (2.0, 996.0) ( 0.0, 21.0+] [76] (21.0, 72.0] (0.0, 9.0] (0.0, 36.0+] [79] (36.0,1142.0+] (0.0, 83.0+] (83.0, 980.0] [82 ] (0.0, 32.0+] (32.0, 285.0] (0.0, 102.0] [85] (0.0, 41.0+] (41.0, 188.0] (0.0, 3.0] [88] (0.0, 10.0+] (10.0, 61.0) (0.0 , 67.0+] [91] (67.0, 942.0+] (0.0, 149.0] (0.0, 21.0+] [94] (21.0, 343.0] (0.0, 78.0+] (78.0, 916.0+] [97] ( 0.0, 3.0+] (3.0, 68.0] (0.0, 2.0] [100] (0.0, 69.0] (0.0, 27.0+] (27.0, 842.0+][103] (0.0, 33.0+) ( 33.0, 584.0] (0.0, 12.0+][106] (12.0, 78.0] (0.0, 32.0] (0.0, 57.0+][109] (57.0, 285.0] (0.0, 3.0+) ( 3.0, 68.0] [112] (0.0, 10.0+] (10.0, 670.0+] (0.0, 5.0+][115] (5.0, 30.0] (0.0, 31.0+] (31.0, 620.0+][1 18] (0.0, 4.0+] (4.0, 596.0+] (0.0, 27.0+][121] (27.0, 90.0] (0.0, 5.0+] (5.0, 17.0] [124] (0.0, 2. 0] (0.0, 46.0+] (46.0, 545.0+][127] (0.0, 21.0] (0.0, 210.0+] (210.0, 515.0+][130] (0.0, 67.0+] (67.0, 96. 0] (0.0, 26.0+][133] (26.0, 482.0+] (0.0, 6.0+] (6.0, 445.0+][136] (0.0, 428.0+] (0.0, 32.0+] (32.0, 80. 0] [139] (0.0, 37.0+) (37.0, 334.0] (0.0, 5.0] [142] (0.0, 8.0+] (8.0, 397.0+] (0.0, 60.0+][145] (60.0, 110.0] (0.0, 31.0+] (31.0, 370.0+][148] (0.0, 13 9.0+] (139.0, 207.0] (0.0, 160.0+][151] (160.0, 186.0) (0.0, 340.0] (0.0, 310.0+][154] (310.0, 340.0+] (0.0, 2 8.0+] (28.0, 265.0+][157] (0.0, 4.0+] (4.0, 165.0] (0.0, 2.0+][160] (2.0, 16.0] (0.0, 13.0+] (13.0, 18 0.0+][163] (0.0, 21.0+] (21.0, 131.0+] (0.0, 96.0+][166] (96.0, 109.0+] (0.0, 21.0] (0.0, 38.0+][169] (38. 0, 39.0+] (0.0, 31.0+] (0.0, 11.0+][172] (0.0, 6.0)
2.survreg
Fit the parametric survival regression model. These are the position scale models for arbitrary transformations of time variables; In the most common case, a logarithmic transformation is used to establish an accelerated failure time model.
Survreg (formula, data, weights, subset,
Na.action, dist= "Weibull", Init=null, Scale=0,
Control,parms=null,model=false, X=false,
Y=true, Robust=false, Score=false, ...)
Dist
The assumed distribution of the Y variable. "Weibull", "exponential", "Gaussian", "logistic", "Lognormal" and "loglogistic".
Scale
An optional fixed value. If set <=0,scale will be estimated
Control
List of control values, reference Survreg.control ()
R Survival Analysis aft