This example compares each of the four new patients in the table lc_new_predictors with each of the attribute reference values provided in the table lc_new_reference, and calculates a hazard ratio.
Input
- CoxCoeffModel: lungcancer_coef, output by CoxPH Example
- PredictorValues: lc_new_predictors, as in CoxHazardRatio Example: No Reference Values
- ReferenceValues: lc_new_reference, which has alternate sets of reference values for each attribute
id | trt | celltype | karno | diagtime | age | prior |
---|---|---|---|---|---|---|
1 | standard | squamous | 58 | 12 | 60 | yes |
2 | standard | smallcell | 54 | 8 | 58 | no |
3 | test | smallcell | 52 | 12 | 61 | no |
4 | test | adeno | 60 | 5 | 60 | yes |
5 | standard | adeno | 58 | 6 | 52 | yes |
6 | standard | large | 70 | 8 | 55 | no |
7 | test | squamous | 64 | 10 | 57 | yes |
8 | test | large | 60 | 8 | 62 | no |
SQL Call
SELECT * FROM CoxHazardRatio ( ON lungcancer_coef AS CoxCoeffModel DIMENSION ON lc_new_predictors AS PredictorValues PARTITION BY 1 ON lc_new_reference AS ReferenceValues PARTITION BY 1 USING PredictFeatureNames ('trt','celltype','karno','diagtime','age','prior') PredictFeatureColumns ('trt','celltype','karno','diagtime','age','prior') RefFeatureColumns ('trt','celltype','karno','diagtime','age','prior') Accumulate ('id','name') ) AS dt;
Output
id name trt celltype karno diagtime age prior trt_ref celltype_ref karno_ref diagtime_ref age_ref prior_ref hazardratio -- ------ -------- --------- ----- -------- --- ----- -------- ------------ --------- ------------ ------- --------- ------------------- 4 steffi test adeno 60 5 63 yes standard large 70 8 55 no 4.133930478527213 3 stella test smallcell 70 3 72 no standard large 70 8 55 no 1.833918534562352 1 john standard squamous 30 4 63 yes standard large 70 8 55 no 2.4916319907559776 2 james standard large 80 12 41 no standard large 70 8 55 no 0.8138840802548419 4 steffi test adeno 60 5 63 yes test squamous 64 10 57 yes 3.5775643751551955 3 stella test smallcell 70 3 72 no test squamous 64 10 57 yes 1.587100133944331 1 john standard squamous 30 4 63 yes test squamous 64 10 57 yes 2.1562950544106316 2 james standard large 80 12 41 no test squamous 64 10 57 yes 0.7043472806690806 4 steffi test adeno 60 5 63 yes test adeno 60 5 60 yes 0.974218736747829 3 stella test smallcell 70 3 72 no test adeno 60 5 60 yes 0.4321886416136069 1 john standard squamous 30 4 63 yes test adeno 60 5 60 yes 0.5871880485371804 2 james standard large 80 12 41 no test adeno 60 5 60 yes 0.19180320632956704 4 steffi test adeno 60 5 63 yes standard adeno 58 6 52 yes 1.1423866472468276 3 stella test smallcell 70 3 72 no standard adeno 58 6 52 yes 0.5067922784151168 1 john standard squamous 30 4 63 yes standard adeno 58 6 52 yes 0.6885474080606075 2 james standard large 80 12 41 no standard adeno 58 6 52 yes 0.22491193563108589 4 steffi test adeno 60 5 63 yes test smallcell 52 12 61 no 1.133822548592944 3 stella test smallcell 70 3 72 no test smallcell 52 12 61 no 0.502993022637895 1 john standard squamous 30 4 63 yes test smallcell 52 12 61 no 0.6833855935867441 2 james standard large 80 12 41 no test smallcell 52 12 61 no 0.22322584449038266 4 steffi test adeno 60 5 63 yes standard squamous 58 12 60 yes 4.048513897502304 3 stella test smallcell 70 3 72 no standard squamous 58 12 60 yes 1.796025528883085 1 john standard squamous 30 4 63 yes standard squamous 58 12 60 yes 2.4401491013053347 2 james standard large 80 12 41 no standard squamous 58 12 60 yes 0.7970673495799858 4 steffi test adeno 60 5 63 yes test large 60 8 62 no 2.3570666129296187 3 stella test smallcell 70 3 72 no test large 60 8 62 no 1.045655743632573 1 john standard squamous 30 4 63 yes test large 60 8 62 no 1.420667959372799 2 james standard large 80 12 41 no test large 60 8 62 no 0.46405690718027626 4 steffi test adeno 60 5 63 yes standard smallcell 54 8 58 no 1.5841279100453765 3 stella test smallcell 70 3 72 no standard smallcell 54 8 58 no 0.702760133591979 1 john standard squamous 30 4 63 yes standard smallcell 54 8 58 no 0.954796844944688 2 james standard large 80 12 41 no standard smallcell 54 8 58 no 0.3118815117405267
Download a zip file of all examples and a SQL script file that creates their input tables.