BSTA 6652 Survival Analysis Parametric Methods
/* Parametric models: AFT modeling */
/* Data described in Chapter 3 of P. Allison, "Survival Analysis
Using the SAS System." */
options ls =79;
data recidall;
input week arrest fin age race wexp mar paro prio educ emp1-emp52;
cards;
20 … 1
;
data recid;
set recidall;
drop emp1-emp52;
run;
/* Checking for the distribution of Y using strata fin */
proclifetestdata=recid outsurv=out;
time week*arrest(0);
strata fin;
run;
data b;
set out;
s=survival;
logits=log((1-s)/s); /* for log-logistic model */
logneglog=log(-log(s)); /* for weibull model */
lnorm=probit(1-s); /* for lognormal model; probit: inverse function of cdf of N(0,1) */
lweek=log(week);
run;
procgplotdata=b;
symbol1value=circle i=join;
plot logits*lweek=fin logneglog*lweek=fin lnorm*lweek=fin;
run;
/* Initial AFT model selection */
procliferegdata=recid;
class educ;
model week*arrest(0)=fin age race wexp mar paro prio educ
/ dist=gamma; /* generalized gamma distribution */
run;
procliferegdata=recid;
class educ;
model week*arrest(0)=fin age race wexp mar paro prio educ
/ dist=lnormal; /* log-normal */
run;
procliferegdata=recid;
class educ;
model week*arrest(0)=fin age race wexp mar paro prio educ
/ dist=llogistic; /* log-logistic */
run;
procliferegdata=recid;
class educ;
model week*arrest(0)=fin age race wexp mar paro
prio educ/dist=weibull; /* weibull */
run;
/* backward model selection */
/* Weibull is selected by minimal AIC and L-R tests */
/* drop paro by Wald test p-value */
procliferegdata=recid;
class educ;
model week*arrest(0)=fin age race wexp mar
prio educ/dist=weibull;
PROBPLOT;/* check for goodness of fit of the initial model */
run;
/* drop wexp */
procliferegdata=recid;
class educ;
model week*arrest(0)=fin age race mar
prio educ/dist=weibull; run;
/* drop educ */
procliferegdata=recid;
model week*arrest(0)=fin age race mar
prio/dist=weibull; run;
/* drop race */
procliferegdata=recid;
model week*arrest(0)=fin age mar
prio/dist=weibull; run;
/* drop mar */
/* the final model */
procliferegdata=recid;
model week*arrest(0)=fin age
prio/dist=weibull; run;
/* Final model with covariance matrix, median survival times and residuals */
procliferegdata=recid;
model week*arrest(0)=fin age prio
/dist=weibull covb;
outputout=a cdf=f xbeta=xb p=median STD=se;
probplot; run;
procprintdata=a; run;
/* residual analysis */
data res;
set a;
e=-log(1-f); run;
proclifetestdata=res plots=(ls) notable graphics;
time e*arrest(0);
symbol1v=none; run;
SAS Outputs:
Name of Distribution Gamma
Fit Statistics-2 Log Likelihood / 633.200
AIC (smaller is better) / 661.200
Name of Distribution Lognormal
Fit Statistics-2 Log Likelihood / 641.576
AIC (smaller is better) / 667.576
Name of Distribution Weibull
Fit Statistics-2 Log Likelihood / 633.370
AIC (smaller is better) / 659.370
Name of Distribution LLogistic
Fit Statistics-2 Log Likelihood / 634.109
AIC (smaller is better) / 660.109
1 | Page
BSTA 6652 Survival Analysis Parametric Methods
Weibull is selected;
check its probability plot:
All points are within the confidence band, so it fits fine. Initial model is Weibull AFT full model.
1 | Page
BSTA 6652 Survival Analysis Parametric Methods
Backward model selection:
Initial model:
Type III Analysis of Effects
Wald
Effect DF Chi-Square Pr > ChiSq
fin 1 4.2905 0.0383
age 1 5.1329 0.0235
race 1 1.3376 0.2475
wexp 1 0.3172 0.5733
mar 1 1.2359 0.2663
paro 1 0.2400 0.6242
prio 1 7.2105 0.0072
educ 4 4.5800 0.3332
Final model: It must be confirmed with L-R tests.
Name of Distribution Weibull
Fit Statistics-2 Log Likelihood / 643.002
AIC (smaller is better) / 653.002
Type III Analysis of Effects
Wald
Effect DF Chi-Square Pr > ChiSq
fin 1 3.3064 0.0690
age 1 9.6566 0.0019
prio 1 12.0751 0.0005
Analysis of Parameter Estimates
Standard 95% Confidence Chi-
Parameter DF Estimate Error Limits Square Pr > ChiSq
Intercept 1 3.7738 0.3581 3.0720 4.4755 111.08 <.0001
fin 1 0.2495 0.1372 -0.0194 0.5184 3.31 0.0690
age 1 0.0478 0.0154 0.0176 0.0779 9.66 0.0019
prio 1 -0.0698 0.0201 -0.1092 -0.0304 12.08 0.0005
Scale 1 0.7141 0.0637 0.5995 0.8506
Weibull Shape 1 1.4004 0.1250 1.1756 1.6681
Estimated Covariance MatrixIntercept / fin / age / prio / Scale
Intercept / 0.128202 / -0.004620 / -0.005069 / -0.001772 / -0.000258
fin / -0.004620 / 0.018828 / -0.000046101 / -0.000219 / 0.001239
age / -0.005069 / -0.000046101 / 0.000236 / -0.000000992 / 0.000247
prio / -0.001772 / -0.000219 / -0.000000992 / 0.000403 / -0.000316
Scale / -0.000258 / 0.001239 / 0.000247 / -0.000316 / 0.004062
Residual analysis for final model:
Probability plot for final model:
1 | Page