CoxHazardRatio Example 3: Reference Values - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

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

refs: lc_new_reference
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 cox_coef_model DIMENSION
  ON lc_new_predictors AS predicts PARTITION BY 1
  ON lc_new_reference AS refs 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 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 58 12 60 yes 2.44014910130533
1 John standard squamous 30 4 63 yes standard smallcell 54 8 58 no 0.954796844944686
1 John standard squamous 30 4 63 yes test smallcell 52 12 61 no 0.683385593586743
1 John standard squamous 30 4 63 yes test adeno 60 5 60 yes 0.587188048537179
1 John standard squamous 30 4 63 yes standard adeno 58 6 52 yes 0.688547408060605
1 John standard squamous 30 4 63 yes standard large 70 8 55 no 2.49163199075597
1 John standard squamous 30 4 63 yes test squamous 64 10 57 yes 2.15629505441063
1 John standard squamous 30 4 63 yes test large 60 8 62 no 1.4206679593728
2 James standard large 80 12 41 no standard large 70 8 55 no 0.813884080254844
2 James standard large 80 12 41 no standard adeno 58 6 52 yes 0.224911935631086
2 James standard large 80 12 41 no standard smallcell 54 8 58 no 0.311881511740527
2 James standard large 80 12 41 no test large 60 8 62 no 0.464056907180278
2 James standard large 80 12 41 no test squamous 64 10 57 yes 0.704347280669083
2 James standard large 80 12 41 no test adeno 60 5 60 yes 0.191803206329567
2 James standard large 80 12 41 no test smallcell 52 12 61 no 0.223225844490383
2 James standard large 80 12 41 no standard squamous 58 12 60 yes 0.797067349579989
3 Stella test smallcell 70 3 72 no test squamous 64 10 57 yes 1.58710013394433
3 Stella test smallcell 70 3 72 no test smallcell 52 12 61 no 0.502993022637894
3 Stella test smallcell 70 3 72 no test adeno 60 5 60 yes 0.432188641613605
3 Stella test smallcell 70 3 72 no standard adeno 58 6 52 yes 0.506792278415114
3 Stella test smallcell 70 3 72 no standard large 70 8 55 no 1.83391853456235
3 Stella test smallcell 70 3 72 no test large 60 8 62 no 1.04565574363257
3 Stella test smallcell 70 3 72 no standard squamous 58 12 60 yes 1.79602552888308
3 Stella test smallcell 70 3 72 no standard smallcell 54 8 58 no 0.702760133591977