|
Version 4.0.5 (July 2011)
SAS macro %BICSurvTimeDependent
Computing the BIC (Bayesian Information Criterion) in Survival Models with time-dependent covariates
Model selection for Cox proportional hazards models is made easy in R
through the use of Chris Volinsky's bic.surv function.
However, this function does not accommodate time dependent covariates.
When one or more of the independent variables varies with time, however,
there is to my knowledge no R or SAS function or macro available, hence the need for %BICSurvTimeDependent.
Unlike the BIC functions available for R which use Occam's Razor to pare down the total number of models reported, %BICSurvTimeDependent does not have this capability. Thus, every possible model (i.e., 2p models for p covariates) derived from the list of independent variables (see indep in argument's list below) is fit, which may make %BICSurvTimeDependent long or even impossible to run when the number of independent variables is large. %BICSurvTimeDependentReport is a SAS macro included in the downloadable file that reports %BICSurvTimeDependent output in a reader-friendly fashion. See example below for an illustration of combined use of these two macros. Menu
Top Syntax
%BICSurvTimeDependent(outModels=, outParms=, data=, time0=, time1=, cens=, indep=, force=, ties=exact, level=0.95);
Top %BICSurvTimeDependent arguments list
Top Example
Consider the problem where the survival is modeled through age at diagnosis, gender and three time-dependent variables (x, y and z). The data set mySurvData was prepared beforehand such that the values for x, y and z are constant over the time intervals delimited by time points time0 and time1. Censoring variable Deceased was also redefined to indicate patients status at the end of each time interval. BIC model selection is run through the SAS macro call:
%BICSurvTimeDependent(outModels=bicModels, outParms=bicParms, data=mySurvData, time0=time0, time1=time1, cens=Deceased, indep=gender AgeAtDiagnosis x y z);
where the arguments bicModels and bicParms are output data sets, which can be printed, used or modified if necessary:
proc print data=bicModels; run;
minus2log n Obs Model Converged BIC L p Events 1 AgeAtDiagnosis,x,y,z,gender 1 548.299 526.327 5 81 2 AgeAtDiagnosis,x,y,z 1 549.100 531.522 4 81 3 AgeAtDiagnosis,x,y,gender 1 566.694 549.116 4 81 4 AgeAtDiagnosis,x,y 1 568.853 555.670 3 81 5 AgeAtDiagnosis,x,z,gender 1 611.691 594.113 4 81 6 AgeAtDiagnosis,x,z 1 611.017 597.834 3 81 7 AgeAtDiagnosis,x,gender 1 695.492 682.309 3 81 8 AgeAtDiagnosis,x 1 695.365 686.576 2 81 9 AgeAtDiagnosis,y,z,gender 1 544.323 526.745 4 81 10 AgeAtDiagnosis,y,z 1 545.147 531.964 3 81 11 AgeAtDiagnosis,y,gender 1 562.592 549.409 3 81 12 AgeAtDiagnosis,y 1 564.691 555.902 2 81 13 AgeAtDiagnosis,z,gender 1 607.692 594.509 3 81 14 AgeAtDiagnosis,z 1 606.928 598.139 2 81 15 AgeAtDiagnosis,gender 1 697.108 688.319 2 81 16 AgeAtDiagnosis 1 697.058 692.664 1 81 17 x,y,z,gender 1 559.678 542.100 4 81 18 x,y,z 1 563.481 550.298 3 81 19 x,y,gender 1 578.293 565.110 3 81 20 x,y 1 583.515 574.726 2 81 21 x,z,gender 1 646.419 633.236 3 81 22 x,z 1 649.349 640.560 2 81 23 x,gender 1 746.003 737.214 2 81 24 x 1 749.835 745.441 1 81 25 y,z,gender 1 556.631 543.448 3 81 26 y,z 1 561.146 552.357 2 81 27 y,gender 1 573.899 565.110 2 81 28 y 1 579.218 574.824 1 81 29 z,gender 1 642.537 633.748 2 81 30 z 1 645.766 641.372 1 81 31 gender 1 747.543 743.149 1 81 32 NULL 1 750.246 750.246 0 81 Note that while running, %BICSurvTimeDependent prints proc phreg output (for each of the 32 models) to Sas output window: however, every relevant information for the computation of BIC values is stored in the output data sets, and the output window can thus be ignored. The sas macro %BICSurvTimeDependentReport (included in the downloadable file below) conveniently produces a comprehensive HTML version of the BIC output.
ods listing close;
ods html file="c:\users\pbelisle\My Documents\Home\MyProject\log\BICSurvTimeDependent.html" style=mystyle; title 'BIC (Bayesian Information Criterion) results'; %BICSurvTimeDependentReport(parms=bicParms, models=bicModels); ods html close; title; ods listing; which should look like this:
Note that only 8 (of the 32 possible models) were included in the report, since by default only the models with probability ≥ 1% are printed; to include all models in the report, call %BICSurvTimeDependentReport with the inclusive option where= (left empty), as in:
%BICSurvTimeDependentReport(parms=bicParms, models=bicModels, where=);
Top Interaction terms
Interaction terms of order 2 are allowed in the model. Class variables, however, are not allowed in interaction terms in the actual version.
%BICSurvTimeDependent(outModels=bicModels, outParms=bicParms, data=mySurvData, time0=time0, time1=time1, cens=Deceased, indep=gender AgeAtDiagnosis x y z AgeAtDiagnosis*x);
Top Download
%BICSurvTimeDependent is a free SAS macro. Download version 4.0.5 now. |