Report

Survival Models in SAS Learning Objectives What type of data merits these? What tools does SAS have? How do I do descriptive analysis? How do I do modelling? Is the model appropriate? A.Pope - Essay on Criticism Part ii Line 15 My Data Stops in the Middle • Outcome is typically a time duration until an event • Outcome is not observed for some proportion of the population • Often the outcome is death of a patient – Other examples • Failure of an electronic component • Divorce • Change cell phone provider SAS to the rescue • Exploratory – FREQ – UNIVARIATE – MEANS/SUMMARY – GPLOT • Time-to-event most commonly analysed using – LIFETEST – PHREG Baby’s First Dataset • • • • • • NSAPD: Mum’s and babes since 1980 All NS births since 1988 Comprehensive clinical and demographic data Includes gestational age at birth/delivery Spontaneous / Induced / No Labour Question: What factors associated with premature birth? How is this ‘time-to-event’? • Birth is the event • When birth would have happened is censored – Induced labour – Straight to Caesarean Section • Measured in weeks since LMP • A (large) set of known risk factors • Many captured in Atlee The Usual Suspects • • • • • • • Previous preterm delivery Multiples < 6 mos since last preg Surgery on cervix IVF Uterine abnormalities Smoking A Long Line-Up • • • • • • • • • • Chorioamnionitis Weight Gain UTI BP (G)DM Maternal Weight Previous Loss Antepartum Trauma A/P Bleeding Polyhydramnios This LIFE is a TEST This life is a test-it is only a test. If it had been an actual life, you would have received further instructions on where to go and what to do. Remember, this life is only a test. • proc lifetest • data = Work.ForSHRUG • plots = (s,ls,lls) • maxtime = 45; • time GA_Best * Spontaneous_Labour ( 0 ); • id Labour /* censoring = Induced / None */; • strata DLNumFet; • test Prev_PTD Overweight AdmitSmk; • /* latter two most interesting from population health perspective */ • run; The LIFETEST Procedure Stratum 4: # of Foetuses = Twins Product-Limit Survival Estimates GA_BEST Survival Failure Survival Standard Error 32.0000 0.9075 0.0925 0.00324 743 7111 S 33.0000 0.8837 0.1163 0.00359 927 6819 S 34.0000 0.8465 0.1535 0.00407 1210 6383 S 35.0000 0.7884 0.2116 0.00466 1638 5761 S 36.0000 0.7119 0.2881 0.00525 2176 4918 S 37.0000 0.6154 0.3846 0.00582 2784 3717 S 38.0000 0.4864 0.5136 0.00651 3417 2145 S 39.0000 0.3550 0.6450 0.00745 3821 861 S 40.0000 0.2125 0.7875 0.00837 4076 325 S 41.0000 0.0999 0.9001 0.00868 4186 76 S 42.0000 0.0543 0.9457 0.00859 4210 22 S 43.1430 0.0339 0.9661 0.00979 4214 6 S Number Number LABOUR Failed Left More Babies Arrive Sooner - Duh Test of Equality over Strata Test Chi-Square DF Pr > Chi-Square Log-Rank 12814.4469 3 <.0001 Wilcoxon 17518.2974 3 <.0001 -2Log(LR) 184.4172 3 <.0001 Lots of Data = Tiny p-values Rank Tests for the Association of GA_BEST with Covariates Pooled over Strata Univariate Chi-Squares for the Wilcoxon Test Variable Test Statistic Standard Error Chi-Square Pr > Chi-Square Label # Previous Preterm Deliveries PREV_PTD -512.1 21.2544 580.5 <.0001 Overweight 1074.1 58.7622 334.1 <.0001 ADMITSMK -18207.7 1727.7 111.1 <.0001 # Cigarettes / Day @ Admission Apply the “C” test Make the punishment fit the crime Smoking and weight matter … how much? • Hazards – not just for golf any more • Proportional Hazards REGression • Doesn’t assume functional form for baseline hazard • Does assume that effect of covariate proportional over time • Manifests itself as, e.g., parallel lines on plot Deciphering the code • proc phreg • data = Work.ForSHRUG • plots ( overlay timerange = 24, 44 )= • ( cumhaz survival ) /* interesting weeks */ • simple/* compare healthy/unhealthy */; • where Weighted_Ran > 0.9; • /* 10% of 'healthy' + 55% w/ 1 risk factor + */ Modelling – not just for the young and beautiful ! • model GA_Best * Spontaneous_Labour ( 0 ) = • Prev_PTD DLNumFet AdmitSmk Chorioamnionitis Gest_HT PrexHT Pre_Existing_Diabetes GDM DLAborts Overweight Underweight ; • assess var = ( Prev_PTD DLNumFet AdmitSmk Chorioamnionitis Gest_HT PrexHT GDM DLAborts Pre_Existing_Diabetes Overweight Underweight ) • ph; /* / resample seed = 19 */ /* takes 8 hours to run! */ Odious? NO – ODS – Yes! • ODS GRAPHICS ON; ODS GRAPHICS OFF; What about plurality? Transformational Experience On the other hand … But what about the question? Analysis of Maximum Likelihood Estimates Parameter DF Parameter Standard Estimate Error ChiSquare Pr > ChiSq Hazard Ratio Label PREV_PTD 1 0.47499 0.03067 239.8634 <.0001 1.608 # Previous Preterm Deliveries DLNUMFET 1 1.43623 0.05435 698.4233 <.0001 4.205 # of Foetuses 1.004 # Cigarettes / Day @ Admission ADMITSMK 1 0.00368 0.0005484 45.1439 <.0001 Assume makes an ass of u and me Chorioamnionitis 1 -0.05611 0.12410 0.2044 Gest_HT 1 -0.88739 0.13010 46.5222 <.0001 0.412 Gestational Hypertension PrexHT 1 -0.34641 0.10133 11.6869 0.0006 0.707 Pre_Existing_Diabete 1 -0.03388 0.11821 0.0821 0.7744 0.967 Pre-existing Diabetes GDM -0.08809 0.04698 3.5162 0.0608 0.916 Gestational Diabetes 0.0004 # of Pregnancies, Excl. 0.9845 1.000 the Present, with Nonviable Foetus DLABORTS 1 1 -0.0002450 0.01265 0.6512 0.945 Pre-existing Hypertension Criticism A little learning is a dangerous thing; Drink deep, or taste not the Pierian spring: There shallow draughts intoxicate the brain, And drinking largely sobers us again. Two of 372 rhyming couplets Competing Risks • Censoring must be non-informative • Here some covariates are associated with – Induction – No Labour – Need different models • Look at cumulative probability of 3 outcomes One last tidbit • %CIF macro • http://support.sas.com/kb/45/addl/fusion_45997_13_fusion_45997_12_cif.txt • Crude cumulative incidence function • No covariates • Endpoints (time to spontaneous labour, e.g.) subject to competing risks – Induction for reason associated with length of pregnancy – No Labour for … • Comes with confidence limits • Needs Base & IML ( in 9.2 also GRAPH ) • No recommendation Questions? • SHRUG.President@gmail.com • Ron.Dewar@HowDidIGetInvolved?ca • http://www.ats.ucla.edu/stat/examples/asa/test_proportionality.htm • http://www4.stat.ncsu.edu/~lu/ST790/homework/Biometrika-1993-LIN-557-72.pdf • http://escarela.com/archivo/anahuac/03o/residuals.pdf • SAS is a registered trademark or trademark of SAS Institute Inc. in Canada, the USA and other countries with dysfunctional political institutions.