Вы находитесь на странице: 1из 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;

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 146 1 673 1 819 2 59 145 0 672 1 817 1 62 145 0 671 2 816 2 68 145 0 665 2 810 2 69 145 0 663 1 808 1 78 145 0 662 1 807 1 79 145 0 661 1 806 1 88 143 0 655 1 798 1 91 143 0 654 1 797 1 97 141 0 652 1 793 1 98 141 0 651 2 792 2 104 141 0 649 1 790 1 106 141 1 645 1 786 2 119 135 0 638 1 773 1 121 134 1 637 0 771 1 135 133 0 634 1 767 1 143 133 0 631 1 764 1 150 133 0 629 1 762 1 154 132 0 626 1 758 1 158 132 1 625 0 757 1 162 131 0 625 1 756 1 190 130 0 616 1 746 1 206 129 1 610 0 739 1 209 128 0 610 1 738 1 228 127 0 605 1 732 1 229 127 1 604 0 731 1 242 125 0 599 1 724 1 248 125 0 595 1 720 1 249 125 0 594 1 719 1 252 124 0 591 1 715 1 273 122 0 579 1 701 1 291 121 0 573 1 694 1 297 121 0 572 1 693 1 311 120 1 570 1 690 2 334 117 0 564 1 681 1 340 117 0 561 1 678 1 344 117 1 556 0 673 1 346 116 0 556 1 672 1 354 116 0 553 1 669 1 366 116 0 551 1 667 1 391 116 0 543 1 659 1 402 115 1 540 0 655 1 421 113 0 536 1 649 1 439 113 0 530 1 643 1 450 111 1 526 0 637 1 470 109 0 524 1 633 1 478 109 0 523 1 632 1 481 108 0 522 1 630 1 490 108 0 519 1 627 1 495 108 0 516 1 624 1 570 105 0 504 1 609 1 583 105 0 499 1 604 1 614 105 0 494 1 599 1 615 105 0 493 1 598 1 621 105 0 492 1 597 1 652 102 0 487 1 589 1 697 97 0 473 1 570 1 730 97 0 467 1 564 1 773 95 0 455 1 550 1 776 95 0 454 1 549 1 790 93 0 451 1 544 1 793 93 0 450 1 543 1 806 93 0 449 1 542 1 840 93 0 446 1 539 1 852 93 0 445 1 538 1 864 91 1 444 0 535 1 875 88 0 442 1 530 1 929 82 1 431 0 513 1 939 80 0 430 1 510 1 943 80 1 429 0 509 1 945 79 0 429 2 508 2
 946 79 0 427 1 506 1 1001 75 1 419 0 494 1 1013 73 0 418 1 491 1 1016 73 1 417 0 490 1 1105 72 0 407 1 479 1 1164 67 0 390 1 457 1 1186 66 0 388 1 454 1 1191 66 0 387 1 453 1 1196 66 1 386 0 452 1 1210 65 0 382 1 447 1 1275 62 1 368 0 430 1 1326 59 0 356 1 415 1 1331 59 0 355 1 414 1 1357 58 0 352 1 410 1 1384 58 1 344 0 402 1 1388 57 0 343 1 400 1 1418 57 0 341 1 398 1 1473 55 0 328 1 383 1 1509 54 0 323 1 377 1 1734 48 0 281 1 329 1 1777 46 0 267 1 313 1 1820 43 0 252 1 295 1 1835 43 0 251 1 294 1 1877 43 0 246 1 289 1 1940 42 0 238 1 280 1 2034 39 0 215 1 254 1 2056 38 0 204 1 242 1 2108 36 0 191 1 227 1 2171 36 1 185 0 221 1 2276 33 1 167 0 200 1 2291 32 0 167 1 199 1 2301 31 0 165 1 196 1 2313 31 0 163 1 194 1 2369 31 1 152 0 183 1 2414 28 1 148 0 176 1 2421 27 0 147 1 174 1 2489 22 0 134 1 156 1 2557 22 1 124 0 146 1 2567 21 0 124 1 145 1 2650 19 1 112 0 131 1 2795 12 0 85 1 97 1 3146 6 0 33 1 39 1

;

run;

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 proc lifetest*/ proc lifetest data=dog.sec1_7 ; time time*delta(0); strata race; run;

Rank Statistics

 race Log-Rank Wilcoxon 1 -4.6468 -1285.0 2 4.6468 1285.0

Covariance Matrix for the Log-Rank Statistics

 race 1 2 1 19.4303 -19.4303 2 -19.4303 19.4303
 Variable Sum col9 4.6468274 col10 19.4303000

So the test statistic will be:

4.64

2 = √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;

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 42 0 223 1 265 1 1275 39 1 215 0 254 1 1357 37 0 208 1 245 1 1384 37 1 203 0 240 1 1388 36 0 202 1 238 1 1418 36 0 200 1 236 1 1509 35 0 187 1 222 1 1734 31 0 159 1 190 1 1820 28 0 140 1 168 1 2056 25 0 113 1 138 1 2291 22 0 91 1 113 1 2313 21 0 89 1 110 1 2369 21 1 81 0 102 1 2414 19 1 80 0 99 1 2421 18 0 79 1 97 1 2489 15 0 71 1 86 1 2557 15 1 66 0 81 1 3146 3 0 17 1 20 1

;

run;

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 57 1 265 0 322 1 50 56 0 264 1 320 1 52 56 0 262 1 318 1 62 56 0 261 1 317 1 68 56 0 259 1 315 1 78 56 0 258 1 314 1 97 55 0 255 1 310 1 104 55 0 254 1 309 1 106 55 1 252 0 307 1 121 52 1 250 0 302 1 143 51 0 247 1 298 1 154 51 0 245 1 296 1 209 51 0 238 1 289 1 229 51 1 237 0 288 1 273 47 0 227 1 274 1 297 47 0 225 1 272 1 344 45 1 219 0 264 1 366 44 0 218 1 262 1 470 42 0 206 1 248 1 490 42 0 205 1 247 1 614 41 0 199 1 240 1 793 37 0 179 1 216 1 840 37 0 178 1 215 1 852 37 0 177 1 214 1 864 37 1 176 0 213 1 929 30 1 171 0 201 1 943 29 1 171 0 200 1 1013 26 0 167 1 193