You are on page 1of 10

Homework 4 (Due by 11:59 on 2/25/2014)

In Table D.3 of Appendix D, data is reported on the death times of 863


kidney transplant patients (see section 1.7). Here, patients can be classified
by race and sex into one of four groups. Answer the following questions by
both hand calculation and Proc lifetest.
(a) Test the hypothesis that blacks have a higher mortality rate than white
without adjusting sex;
Code for Answer (a):
libname dog "C:\Users\andresg\Dropbox\USF\2014 Spring\Survival analysis\HW4";
/*to obtain Yi1 and di1*/
proc lifetest data=dog.sec1_7 atrisk;
time time*delta(0);
where race=1;
run;
/*to obtain Yi2 and di2*/
proc lifetest data=dog.sec1_7 atrisk;
time time*delta(0);
where race=2;
run;
/*to obtain Yi and di*/
proc lifetest data=dog.sec1_7 atrisk;
time time*delta(0);
run;
/* combine the three pieces of data above together */
data table7_2;
input ti Yi1 di1 Yi2 di2 Yi di ;
datalines;
2
151
0
710
1
861
1
3
151
0
709
1
860
1
7
151
0
706
2
857
2
10
151
0
702
2
853
2
17
150
0
698
1
848
1
21
150
0
694
1
844
1
26
150
0
693
2
843
2
28
150
0
690
1
840
1
37
150
1
686
0
836
1
40
149
1
686
0
835
1
43
148
1
686
1
834
2
44
147
0
682
1
829
1
45
147
1
681
0
828
1
50
146
0
680
1
826
1
52
146
0
675
1
821
1
56
146
0
674
1
820
1

57
59
62
68
69
78
79
88
91
97
98
104
106
119
121
135
143
150
154
158
162
190
206
209
228
229
242
248
249
252
273
291
297
311
334
340
344
346
354
366
391
402
421
439
450
470
478
481
490
495
570
583
614
615
621
652
697
730
773
776
790
793
806
840
852
864
875
929
939
943
945

146
145
145
145
145
145
145
143
143
141
141
141
141
135
134
133
133
133
132
132
131
130
129
128
127
127
125
125
125
124
122
121
121
120
117
117
117
116
116
116
116
115
113
113
111
109
109
108
108
108
105
105
105
105
105
102
97
97
95
95
93
93
93
93
93
91
88
82
80
80
79

1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0

673
672
671
665
663
662
661
655
654
652
651
649
645
638
637
634
631
629
626
625
625
616
610
610
605
604
599
595
594
591
579
573
572
570
564
561
556
556
553
551
543
540
536
530
526
524
523
522
519
516
504
499
494
493
492
487
473
467
455
454
451
450
449
446
445
444
442
431
430
429
429

1
1
2
2
1
1
1
1
1
1
2
1
1
1
0
1
1
1
1
0
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
2

819
817
816
810
808
807
806
798
797
793
792
790
786
773
771
767
764
762
758
757
756
746
739
738
732
731
724
720
719
715
701
694
693
690
681
678
673
672
669
667
659
655
649
643
637
633
632
630
627
624
609
604
599
598
597
589
570
564
550
549
544
543
542
539
538
535
530
513
510
509
508

2
1
2
2
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2

946
1001
1013
1016
1105
1164
1186
1191
1196
1210
1275
1326
1331
1357
1384
1388
1418
1473
1509
1734
1777
1820
1835
1877
1940
2034
2056
2108
2171
2276
2291
2301
2313
2369
2414
2421
2489
2557
2567
2650
2795
3146
;
run;

79
75
73
73
72
67
66
66
66
65
62
59
59
58
58
57
57
55
54
48
46
43
43
43
42
39
38
36
36
33
32
31
31
31
28
27
22
22
21
19
12
6

0
1
0
1
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
1
0
0
1
0
1
0
0

427
419
418
417
407
390
388
387
386
382
368
356
355
352
344
343
341
328
323
281
267
252
251
246
238
215
204
191
185
167
167
165
163
152
148
147
134
124
124
112
85
33

1
0
1
0
1
1
1
1
0
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
0
1
1

506
494
491
490
479
457
454
453
452
447
430
415
414
410
402
400
398
383
377
329
313
295
294
289
280
254
242
227
221
200
199
196
194
183
176
174
156
146
145
131
97
39

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

data table7_2;
set table7_2;
col8=Yi1*(di/Yi);
col9=di1-Yi1*(di/Yi);
col10=di*(yi1/Yi)*(1-Yi1/Yi)*((Yi-di)/(Yi-1));
run;

proc means data=table7_2 sum;


var col9 col10;
run;
/* the chi-square value from the hand calculation above can be obtained by
lifetest*/
proc lifetest data=dog.sec1_7 ;
time time*delta(0);
strata race;
run;

proc

Answer (a)

Rank Statistics
race Log-Rank Wilcoxon
1

-4.6468

-1285.0

4.6468

1285.0

Covariance Matrix for


the Log-Rank Statistics
race

19.4303 -19.4303

-19.4303 19.4303

Variable

Sum

col9

4.6468274

col10

19.4303000

So the test statistic will be:


2 =

4.64
19.43

= 1.0526

Which represent a P-value greater than 0.2 (SAS= 0.2918) which for a level
of significance of 5% provides a high probability of reject the null
hypothesis being this true, so we end up accepting the null hypothesis. Then
we conclude that there is no significant difference between the races for the
time to event.

(b) Test the hypothesis that blacks have a higher mortality rate than white
without adjusting sex;
Code for answer (b)
data Male;
set dog.sec1_7;
if gender=1;
run;
/*to obtain Yi1 and di1*/
proc lifetest data=Male atrisk ;
time time*delta(0);
where race=1;
run;
/*to obtain Yi2 and di2*/
proc lifetest data=Male atrisk;
time time*delta(0);
where race=2;
run;

/*to obtain Yi and di*/


proc lifetest data=Male atrisk;
time time*delta(0);
run;

/* combine the three pieces of data above together */


data example7_8;
input ti Yi1 di1 Yi2 di2 Yi di ;
datalines;
7
92
0
430
1
522
1
17
92
0
426
1
518
1
26
92
0
424
2
516
2
28
92
0
422
1
514
1
37
92
1
419
0
511
1
43
91
1
419
1
510
2
44
90
0
417
1
507
1
56
90
0
413
1
503
1
57
90
1
412
1
502
2
59
89
0
411
1
500
1
62
89
0
410
1
499
1
68
89
0
406
1
495
1
69
89
0
405
1
494
1
79
89
0
404
1
493
1
88
87
0
400
1
487
1
91
87
0
399
1
486
1
98
86
0
397
2
483
2
106
86
0
393
1
479
1
119
83
0
388
1
471
1
135
82
0
385
1
467
1
150
82
0
383
1
465
1
158
81
1
381
0
462
1
162
80
0
381
1
461
1
190
79
0
376
1
455
1
206
78
1
372
0
450
1
228
76
0
368
1
444
1
242
75
0
365
1
440
1
248
75
0
363
1
438
1
249
75
0
362
1
437
1
252
75
0
360
1
435
1
291
74
0
348
1
422
1
311
74
1
347
1
421
2
334
72
0
342
1
414
1
340
72
0
340
1
412
1
346
72
0
337
1
409
1
354
72
0
335
1
407
1
391
72
0
329
1
401
1
402
72
1
327
0
399
1
421
70
0
324
1
394
1
439
70
0
320
1
390
1
450
69
1
319
0
388
1
478
67
0
318
1
385
1
481
66
0
317
1
383
1
495
66
0
312
1
378
1
570
64
0
303
1
367
1
583
64
0
298
1
362
1
615
64
0
295
1
359
1
621
64
0
294
1
358
1
652
62
0
290
1
352
1
697
58
0
283
1
341
1
730
58
0
278
1
336
1
773
57
0
274
1
331
1
776
57
0
273
1
330
1
790
56
0
272
1
328
1
806
56
0
271
1
327
1
875
52
0
266
1
318
1
939
51
0
259
1
310
1
945
51
0
258
2
309
2
946
51
0
256
1
307
1
1001
49
1
251
0
300
1
1105
47
0
244
1
291
1
1186
42
0
228
1
270
1
1191
42
0
227
1
269
1

1210
1275
1357
1384
1388
1418
1509
1734
1820
2056
2291
2313
2369
2414
2421
2489
2557
3146
;
run;

42
39
37
37
36
36
35
31
28
25
22
21
21
19
18
15
15
3

0
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
0

223
215
208
203
202
200
187
159
140
113
91
89
81
80
79
71
66
17

1
0
1
0
1
1
1
1
1
1
1
1
0
0
1
1
0
1

265
254
245
240
238
236
222
190
168
138
113
110
102
99
97
86
81
20

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

data example7_8;
set example7_8;
col8=Yi1*(di/Yi);
col9=di1-Yi1*(di/Yi);
col10=di*(yi1/Yi)*(1-Yi1/Yi)*((Yi-di)/(Yi-1));
run;
proc means data=example7_8 sum;
var col9 col10;
run;

data Female;
set dog.sec1_7;
if Gender=2;
run;
/*to obtain Yi1 and di1*/
proc lifetest data=Female atrisk ;
time time*delta(0);
where race=1;
run;
/*to obtain Yi2 and di2*/
proc lifetest data=female atrisk;
time time*delta(0);
where race=2;
run;
/*to obtain Yi and di*/
proc lifetest data=female atrisk;
time time*delta(0);
run;

/* combine the three pieces of data above together */


data example7_8;
input ti Yi1 di1 Yi2 di2 Yi di ;
datalines;
2
59
0
279
1
338
1
3
59
0
278
1
337
1
7
59
0
276
1
335
1
10
59
0
274
2
333
2
21
58
0
270
1
328
1
40
58
1
267
0
325
1

45
50
52
62
68
78
97
104
106
121
143
154
209
229
273
297
344
366
470
490
614
793
840
852
864
929
943
1013
1016
1164
1196
1326
1331
1473
1777
1835
1877
1940
2034
2108
2171
2276
2301
2567
2650
2795
;
run;

57
56
56
56
56
56
55
55
55
52
51
51
51
51
47
47
45
44
42
42
41
37
37
37
37
30
29
26
26
24
24
21
21
20
15
15
15
15
13
13
13
11
10
7
7
5

1
0
0
0
0
0
0
0
1
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0

265
264
262
261
259
258
255
254
252
250
247
245
238
237
227
225
219
218
206
205
199
179
178
177
176
171
171
167
166
161
160
147
146
138
120
112
110
106
96
87
85
76
76
58
54
41

0
1
1
1
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
1
1
0
0
0
1
0
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
0
1

322
320
318
317
315
314
310
309
307
302
298
296
289
288
274
272
264
262
248
247
240
216
215
214
213
201
200
193
192
185
184
168
167
158
135
127
125
121
109
100
98
87
86
65
61
46

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

data example7_8;
set example7_8;
col8=Yi1*di/Yi;
col9=di1-Yi1*di/Yi;
col10=di*(yi1/Yi)*(1-Yi1/Yi)*((Yi-di)/(Yi-1));
run;
proc means data=example7_8 sum;
var col9 col10;
run;

/* the chi-square value from the hand calculation above can be obtained by
lifetest*/
proc lifetest data=dog.sec1_7 ;
time time*delta(0);
test race;
strata Gender;
run;

proc

Answer (b):
Group Male:
Variable

Sum

col9

-1.0998326

col10

12.4670848

Group Female:
Variable

Sum

col9

5.7861738

col10

6.9066296

The statistic for the stratified test will be:


2 =

(5.78 1.09)
(12.46 + 6.9)

= 1.065

Univariate Chi-Squares for the Log-Rank Test


Variable
race

Test Standard Chi-Square


Pr >
Label
Statistic
Error
Chi-Square
-4.6863

4.4021

1.1333

0.2871 race

For a 5% level of significance we accept the null hypothesis and we declare


there is no significant difference between both curves.
(c) Compare the results from (a) and (b).
Both from the manual and from the computational (supported by the plots)
we can conclude that both results are consistent, but the stratified test is
more accurate in recognize the patterns of both curves. This might be
because the stratified test is accounting for the variance between genders
when comparing races so is able to isolate that effect.

You might also like