1.1 - 8.10 - CoxHazardRatio Example: No Reference Values - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

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

  • CoxCoeffModel: lungcancer_coef, output by CoxPH Example
  • PredictorValues: 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.

PredictorValues: lc_new_predictors
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 CoxCoeffModel DIMENSION
  ON lc_new_predictors AS PredictorValues PARTITION BY 1
  USING
  PredictFeatureNames ('trt','celltype','karno','diagtime','age','prior')
  PredictFeatureColumns ('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   test     adeno               60            5      63 yes                       1.0
  3 stella test     smallcell    70        3  72 no    test     adeno               60            5      63 yes       0.44362587713756574
  1 john   standard squamous     30        4  63 yes   test     adeno               60            5      63 yes        0.6027271149571112
  2 james  standard large        80       12  41 no    test     adeno               60            5      63 yes       0.19687899554247046
  4 steffi test     adeno        60        5  63 yes   test     smallcell           70            3      72 no         2.2541516433900584
  3 stella test     smallcell    70        3  72 no    test     smallcell           70            3      72 no                        1.0
  1 john   standard squamous     30        4  63 yes   test     smallcell           70            3      72 no         1.3586383166963207
  2 james  standard large        80       12  41 no    test     smallcell           70            3      72 no        0.44379511135104377
  4 steffi test     adeno        60        5  63 yes   standard squamous            30            4      63 yes        1.6591256228304212
  3 stella test     smallcell    70        3  72 no    standard squamous            30            4      63 yes        0.7360310597095557
  1 john   standard squamous     30        4  63 yes   standard squamous            30            4      63 yes                       1.0
  2 james  standard large        80       12  41 no    standard squamous            30            4      63 yes       0.32664698610162896
  4 steffi test     adeno        60        5  63 yes   standard large               80           12      41 no          5.079261996662724
  3 stella test     smallcell    70        3  72 no    standard large               80           12      41 no         2.2532920584810046
  1 john   standard squamous     30        4  63 yes   standard large               80           12      41 no         3.0614089293598203
  2 james  standard large        80       12  41 no    standard large               80           12      41 no                        1.0

Download a zip file of all examples and a SQL script file that creates their input tables from the attachment in the left sidebar.