SAS Code for Residual Analysis and Proportional Hazard Assumption of Cox Model

Total Page:16

File Type:pdf, Size:1020Kb

SAS Code for Residual Analysis and Proportional Hazard Assumption of Cox Model

BSTA 6652 Survival Analysis Semiparametric Method-2

SAS Code for residual analysis and proportional hazard assumption of Cox model

/* Cox regression model */ /* Data described in Chapter 3 of P. Allison, "Survival Analysis Using the SAS System." */ 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;

/* residual analysis: Deviance & martingale residuals */ proc phreg data=recid; model week*arrest(0)=fin age prio/ties=exact covb; output out=c xbeta=risk_score resdev=dev resmart=mart; run; proc loess data=c; model mart=age; run;

/* exercise: do martingale plot for prio */ proc gplot data=c; title 'Deviance Residual Plot'; symbol value=dot i=none; plot dev*risk_score; run;

/* checking proportional hazard assumption */ /* wtressch gives scaled Sch. residual while ressch gives un-scaled one */ proc phreg data=recid; model week*arrest(0)=fin age prio/ ties=efron; output out=b wtressch=wtschfin wtschage wtschprio; run; proc gplot data=b; plot wtschfin*week wtschage*week wtschprio*week; symbol value=dot i=none; run; data nonprop; set b; lweek=log(week); week2=week**2; run; proc corr; var week lweek week2 wtschfin wtschage wtschprio; run;

1 BSTA 6652 Survival Analysis Semiparametric Method-2

SAS Output

2 BSTA 6652 Survival Analysis Semiparametric Method-2

Pearson Correlation Coefficients Prob > |r| under H0: Rho=0 Number of Observations week lweek week2 wtschfin wtschage wtschprio wtschfin 0.00842 0.05028 -0.00099 1.00000 -0.21967 -0.16399 Standardized 0.9292 0.5953 0.9917 0.0189 0.0813 Schoenfeld Residual 114 114 114 114 114 114 fin wtschage -0.22037 -0.24130 -0.19226 -0.21967 1.00000 -0.01809 Standardized 0.0185 0.0097 0.0404 0.0189 0.8485 Schoenfeld Residual 114 114 114 114 114 114 age wtschprio -0.07450 -0.00600 -0.09413 -0.16399 -0.01809 1.00000 Standardized 0.4308 0.9495 0.3191 0.0813 0.8485 Schoenfeld Residual 114 114 114 114 114 114 prio

3

Recommended publications