``` 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150``` ```(Q) Is there anyway to get 95% CIs at the failure points on a survival plot? ************************** (A) You need to save survival & SE, compute CL and graph all together. * This answer was provided by Marta Garcia-Granero on 2004/18/06. * (1) Solution for one group *. * Example dataset *. DATA LIST FREE /surtime(F8.0) status(F4.0). BEGIN DATA 65 1 156 0 100 1 134 1 16 1 108 1 121 1 4 1 69 1 143 0 56 1 26 1 22 1 1 1 1 1 5 1 65 1 65 1 17 1 7 1 16 1 22 1 3 1 4 1 2 1 3 1 8 1 4 1 3 1 30 1 4 1 43 1 56 1 END DATA. VALUE LABELS status 0 'Censored' 1 'Event'. * KM with /SAVE option, creates 2 variables: survival (sur_1) & SE (se_1) also, the survival plot is created (for comparison purposes)*. KM surtime /STATUS=status(1) /PRINT TABLE MEAN /PLOT SURVIVAL /SAVE SURVIVAL SE . * For censored data, survival&SE are not computed and previous event values are assigned *. SORT CASES BY surtime(A). IF (MISSING(sur_1)) sur_1 = LAG(sur_1) . IF (MISSING(se_1)) se_1 = LAG(se_1) . * Computes lower&upper CL, replacing absurd values (below 0 or over 1) by 0 or 1 *. COMPUTE lower = MAX((sur_1-1.96*se_1),0) . COMPUTE upper = MIN((sur_1+1.96*se_1),1) . EXECUTE. * Graph of survival with confidence limits (compare it with the one provided by KM) *. GRAPH /SCATTERPLOT(OVERLAY)=surtime WITH sur_1 lower upper. * Manual steps: now, edit the Chart: FORMAT -> INTERPOLATION: - Left Step - Untick "Display markers" - click OK. * Add titles to both axis, modify colours ... * Save the chart template to apply it next time: * GRAPH /SCATTERPLOT(OVERLAY)=surtime WITH sur_1 lower upper /TEMPLATE='C:\\temp\\surv.sct'. ************************** * (2) For 2 groups. A bit more complicated because SCATTERPLOT(OVERLAY) doesn't accept the keyword BY *. * Example dataset from Statistics at Square One (Swinscow&Campell) *. DATA LIST FREE/treatmen(F8.0) surtime(F8.1) status(F8.0). BEGIN DATA 1 1 0 1 5 0 1 6 1 1 6 1 1 9 0 1 10 1 1 10 1 1 10 0 1 12 1 1 12 1 1 12 1 1 12 1 1 12 0 1 13 0 1 15 0 1 16 0 1 20 0 1 24 1 1 24 0 1 27 0 1 32 1 1 34 0 1 36 0 1 36 0 1 44 0 0 3 0 0 6 1 0 6 1 0 6 1 0 6 1 0 8 1 0 8 1 0 12 1 0 12 1 0 12 0 0 15 0 0 16 0 0 18 0 0 18 0 0 20 1 0 22 0 0 24 1 0 28 0 0 28 0 0 28 0 0 30 1 0 30 0 0 33 0 0 42 1 END DATA. VAR LABELS treatmen 'Treatment' /surtime 'Survival time (months)' /status 'Survival'. VALUE LABELS treatmen 1'Gamma-Linoleic' 0'Control' /status 0 'Alive' 1 'Dead'. * Get survivals & SE for both groups *. TEMPORARY. SELECT IF (treatmen EQ 0). KM surtime /STATUS=status(1) /PRINT TABLE MEAN /SAVE SURVIVAL SE . TEMPORARY. SELECT IF (treatmen EQ 1). KM surtime /STATUS=status(1) /PRINT TABLE MEAN /SAVE SURVIVAL SE . * 95% CI limits *. DO REPEAT A=lower1 lower2 /B=upper1 upper2 /C=sur_1 sur_2 /D=se_1 se_2. - COMPUTE A = C-1.96*D . - COMPUTE B = C+1.96*D . END REPEAT. EXECUTE. * Correction of out of 0-1 range values *. DO IF (lower1 LT 0) AND (treatmen EQ 0). - COMPUTE lower1=0. END IF. DO IF upper1 GT 1 AND (treatmen EQ 0). - COMPUTE upper1=1. END IF. DO IF lower2 LT 0 AND (treatmen EQ 1). - COMPUTE lower2=0. END IF. DO IF upper2 GT 1 AND (treatmen EQ 1). - COMPUTE upper2=1. END IF. EXECUTE. * Filling missing survivals for censored data *. SORT CASES BY treatmen(A) surtime(A) . DO IF (\$casenum EQ 1) AND (MISSING(sur_1)). - COMPUTE sur_1=1. - COMPUTE lower1=1. - COMPUTE upper1=1. END IF. DO IF MISSING(sur_1) AND (treatmen EQ 0). - COMPUTE sur_1=LAG(sur_1). - COMPUTE lower1=LAG(lower1). - COMPUTE upper1=LAG(upper1). END IF. SORT CASES BY treatmen(D) surtime(A) . DO IF (\$casenum EQ 1) AND (MISSING(sur_2)). - COMPUTE sur_2=1. - COMPUTE lower2=1. - COMPUTE upper2=1. END IF. DO IF MISSING(sur_2) AND (treatmen EQ 1). - COMPUTE sur_2=LAG(sur_2). - COMPUTE lower2=LAG(lower2). - COMPUTE upper2=LAG(upper2). END IF. EXEC. * The sorting step is really important for the success of the graph *. SORT CASES BY surtime(A). GRAPH /SCATTERPLOT(OVERLAY)=surtime WITH sur_1 lower1 upper1 sur_2 lower2 upper2 /MISSING=VARIABLEWISE. Now, edit the Chart: FORMAT -> INTERPOLATION: - Left Step - Untick "Display markers" - click OK. ```
Related pages

...

Navigate from here