Teradata Package for R Function Reference | 17.00 - CoxSurvival - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
CoxSurvival

Description

The CoxSurvival function takes as input the coefficient and linear prediction tbl_teradata generated by the function CoxPH (td_coxph_mle) and outputs a tbl_teradata of survival probabilities.

Usage

  td_cox_survival_mle (
      object = NULL,
      cox.model.table = NULL,
      predict.table = NULL,
      predict.feature.names = NULL,
      predict.feature.columns = NULL,
      accumulate = NULL,
      cox.model.table.sequence.column = NULL,
      object.sequence.column = NULL,
      predict.table.sequence.column = NULL
  )

Arguments

object

Required Argument.
Specifies the coefficients tbl_teradata of the model generated by td_coxph_mle.
This argument can accept either a tbl_teradata or an object of "td_coxph_mle" class.

cox.model.table

Required Argument.
Specifies the name of the Cox linear predictor model tbl_teradata generated by td_coxph_mle function.

predict.table

Required Argument.
Specifies the name of the predict tbl_teradata, which contains new prediction feature values for survival calculation.

predict.feature.names

Required Argument.
Specifies the names of features in the Cox model.
Types: character OR vector of characters

predict.feature.columns

Required Argument.
Specifies the names of the columns that contain the values for the features in the Cox model, one column name for each feature name. The ith feature name corresponds to the ith column name. For example, consider this pair of arguments: "predict.feature.names" ("name", "age"), "predict.feature.columns" ("c1", "c2"). The predictive values of the feature "name" are in column "c1", and the predictive values of the feature "age" are in column "c2".
Types: character OR vector of Strings (character)

accumulate

Optional Argument.
Specifies the names of the columns in "predict.table" argument that the function copies to the output tbl_teradata.
Types: character OR vector of Strings (character)

cox.model.table.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "cox.model.table". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

object.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "object". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

predict.table.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "predict.table". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

Value

Function returns an object of class "td_cox_survival_mle" which is a named list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator using following names:

  1. survival.probability

  2. output

Examples

  
    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("coxsurvival_example", "lungcancer","lc_new_predictors")

    # Create object(s) of class "tbl_teradata".
    lungcancer <- tbl(con, "lungcancer")
    lc_new_predictors <- tbl(con, "lc_new_predictors")

    td_coxph_out <- td_coxph_mle(data = lungcancer,
                            feature.columns = c("trt","celltype","karno","diagtime","age","prior"),
                            time.interval.column = "time_int",
                            event.column = "status",
                            categorical.columns = c("trt","celltype","prior")
                            )

    # Linear model predictor tbl_teradata and coefficient tbl_teradata that are generated from
    # the td_coxph_mle() function are used to determine the survival probabilities of 
    # the new patients.
    # Example 1 - Pass generated coefficient tbl_teradata and linear predictor tbl_teradata.
    td_cox_survival_out <- td_cox_survival_mle(object = td_coxph_out$coefficient.table,
                                            cox.model.table = td_coxph_out$linear.predictor.table,
                                            predict.table = lc_new_predictors,
                                            predict.feature.names = c("trt", "celltype", "karno",
                                                                      "diagtime", "age", "prior"),
                                            predict.feature.columns = c("trt", "celltype", "karno", 
                                                                        "diagtime", "age", "prior"),
                                            accumulate = c("id", "name")
                                            )

    # Example 2 - Pass output of td_coxph_mle() directly as object argument.
    td_cox_survival_out <- td_cox_survival_mle(object = td_coxph_out,
                                            cox.model.table = td_coxph_out$linear.predictor.table,
                                            predict.table = lc_new_predictors ,
                                            predict.feature.names = c("trt", "celltype", "karno",
                                                                      "diagtime", "age", "prior"),
                                            predict.feature.columns = c("trt", "celltype", "karno",
                                                                        "diagtime", "age", "prior"),
                                            accumulate = c("id", "name")
                                            )