User Documentation
 All Files Functions Groups
cox_prop_hazards.sql_in File Reference

SQL functions for cox proportional hazards. More...

Go to the source code of this file.

Functions

cox_prop_hazards_result cox_prop_hazards_regr (varchar source, varchar indepColumn, varchar depColumn, varchar status, integer maxNumIterations=20, varchar optimizer="newton", float8 precision=0.0001)
 Compute cox-regression coefficients and diagnostic statistics. More...
 

Detailed Description

Date
July 2012
See Also
For a brief introduction to cox regression, see the module description Cox-Proportional Hazards Regression

Definition in file cox_prop_hazards.sql_in.

Function Documentation

cox_prop_hazards_result cox_prop_hazards_regr ( varchar  source,
varchar  indepColumn,
varchar  depColumn,
varchar  status,
integer  maxNumIterations = 20,
varchar  optimizer = "newton",
float8  precision = 0.0001 
)

To include an intercept in the model, set one coordinate in the independentVariables array to 1.

Parameters
sourceName of the source relation containing the training data
indepColumnName of the independent column
depColumnName of the dependent column measuring time of death
statusName of the column that determines right censoring support
maxNumIterationsThe maximum number of iterations
optimizerThe optimizer to use (either 'newton'/'newton' for the newton method
precisionThe difference between log-likelihood values in successive iterations that should indicate convergence. Note that a non-positive value here disables the convergence criterion, and execution will only stop after maxNumIterations iterations.
Returns
A composite value:
  • coef FLOAT8[] - Array of coefficients, \( \boldsymbol \beta \)
  • log_likelihood FLOAT8 - Log-likelihood \(l(\boldsymbol \beta)\)
  • std_err FLOAT8[] - Array of standard errors, \( \mathit{se}(c_1), \dots, \mathit{se}(c_k) \)
  • z_stats FLOAT8[] - Array of Wald z-statistics, \( \boldsymbol z \)
  • p_values FLOAT8[] - Array of Wald p-values, \( \boldsymbol p \)
  • condition_no FLOAT8 - The condition number of matrix \( H \) during the iteration immediately preceding convergence (i.e., \( H \) is computed using the coefficients of the previous iteration)
  • num_iterations INTEGER - The number of iterations before the algorithm terminated
  • Get vector of coefficients \( \boldsymbol \beta \) and all diagnostic statistics:
    SELECT * FROM cox_prop_hazards_regr(
       'sourceName', 'dependentVariable',
            'independentVariables'
       [, numberOfIterations [, 'optimizer' [, precision ] ] ]
    );
  • Get vector of coefficients \( \boldsymbol \beta \):
    SELECT (cox_prop_hazards_regr('sourceName',
    'dependentVariable', 'independentVariables')).coef;
  • Get a subset of the output columns, e.g., only the array of coefficients \( \boldsymbol \beta \), the log-likelihood of determination:
    SELECT coef, log_likelihood
    FROM cox_prop_hazards_regr('sourceName', 'dependentVariable',
    'independentVariables');

Definition at line 399 of file cox_prop_hazards.sql_in.