This example calculates four hazard ratios for each patient: using individual patient characteristics as a reference, and using the characteristics of each of the other three patients.
Input
- cox_coef_model: lungcancer_coef, output by CoxPH Example
- predicts: lc_new_predictors, a list of four patients diagnosed with lung cancer
This table includes all attributes used in the input to the CoxPH function.
id | name | trt | celltype | karno | diagtime | age | prior |
---|---|---|---|---|---|---|---|
1 | John | standard | squamous | 30 | 4 | 63 | yes |
2 | James | standard | large | 80 | 12 | 41 | no |
3 | Stella | test | smallcell | 70 | 3 | 72 | no |
4 | Steffi | test | adeno | 60 | 5 | 63 | yes |
SQL Call
SELECT * FROM CoxHazardRatio ( ON lungcancer_coef AS cox_coef_model DIMENSION ON lc_new_predictors AS predicts PARTITION BY 1 USING PredictFeatureNames ('trt','celltype','karno','diagtime','age','prior') PredictFeatureColumns ('trt','celltype','karno','diagtime','age','prior') Accumulate ('id','name') ) AS dt ORDER BY 1, 2, 3, 4, 5, 6, 7, 8;
Output
id | name | trt | celltype | karno | diagtime | age | prior | trt_ref | celltype_ref | karno_ref | diagtime_ref | age_ref | prior_ref | hazardratio |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | John | standard | squamous | 30 | 4 | 63 | yes | standard | squamous | 30 | 4 | 63 | yes | 1 |
1 | John | standard | squamous | 30 | 4 | 63 | yes | standard | large | 80 | 12 | 41 | no | 3.06140892935981 |
1 | John | standard | squamous | 30 | 4 | 63 | yes | test | smallcell | 70 | 3 | 72 | no | 1.35863831669632 |
1 | John | standard | squamous | 30 | 4 | 63 | yes | test | adeno | 60 | 5 | 63 | yes | 0.60272711495711 |
2 | James | standard | large | 80 | 12 | 41 | no | standard | large | 80 | 12 | 41 | no | 1 |
2 | James | standard | large | 80 | 12 | 41 | no | test | smallcell | 70 | 3 | 72 | no | 0.443795111351046 |
2 | James | standard | large | 80 | 12 | 41 | no | test | adeno | 60 | 5 | 63 | yes | 0.196878995542471 |
2 | James | standard | large | 80 | 12 | 41 | no | standard | squamous | 30 | 4 | 63 | yes | 0.32664698610163 |
3 | Stella | test | smallcell | 70 | 3 | 72 | no | test | smallcell | 70 | 3 | 72 | no | 1 |
3 | Stella | test | smallcell | 70 | 3 | 72 | no | standard | large | 80 | 12 | 41 | no | 2.25329205848099 |
3 | Stella | test | smallcell | 70 | 3 | 72 | no | test | adeno | 60 | 5 | 63 | yes | 0.443625877137564 |
3 | Stella | test | smallcell | 70 | 3 | 72 | no | standard | squamous | 30 | 4 | 63 | yes | 0.736031059709555 |
4 | Steffi | test | adeno | 60 | 5 | 63 | yes | test | adeno | 60 | 5 | 63 | yes | 1 |
4 | Steffi | test | adeno | 60 | 5 | 63 | yes | standard | large | 80 | 12 | 41 | no | 5.07926199666272 |
4 | Steffi | test | adeno | 60 | 5 | 63 | yes | standard | squamous | 30 | 4 | 63 | yes | 1.65912562283042 |
4 | Steffi | test | adeno | 60 | 5 | 63 | yes | test | smallcell | 70 | 3 | 72 | no | 2.25415164339007 |