SQL functions for cox proportional hazards.
More...
|
varchar | coxph_train () |
|
varchar | coxph_train (varchar message) |
|
void | coxph_train (varchar source_table, varchar output_table, varchar dependent_varname, varchar independent_varname, varchar right_censoring_status, varchar strata, varchar optimizer_params) |
| Compute cox-regression coefficients and diagnostic statistics. More...
|
|
CREATE FUNCTION MADlib | coxph_train (source_table VARCHAR--name of input table, output_table VARCHAR--name of output table, dependent_variable VARCHAR--name of dependent variable, independent_variable VARCHAR--name of independent variable, right_censoring_status VARCHAR--censored status, strata VARCHAR--stratification column names) RETURNS VOID AS $$SELECT MADlib.coxph_train($1 |
| Cox regresison training function. More...
|
|
CREATE FUNCTION MADlib | coxph_train (source_table VARCHAR--name of input table, output_table VARCHAR--name of output table, dependent_variable VARCHAR--name of dependent variable, independent_variable VARCHAR--name of independent variable, right_censoring_status VARCHAR--censored status) RETURNS VOID AS $$SELECT MADlib.coxph_train($1 |
| Cox regresison training function. More...
|
|
CREATE FUNCTION MADlib | coxph_train (source_table VARCHAR--name of input table, output_table VARCHAR--name of output table, dependent_variable VARCHAR--name of dependent variable, independent_variable VARCHAR--name of independent variable) RETURNS VOID AS $$SELECT MADlib.coxph_train($1 |
| Cox regresison training function. More...
|
|
- Date
- July 2012
- See Also
- For a brief introduction to cox regression, see the module description Cox-Proportional Hazards Regression
varchar coxph_train |
( |
varchar |
message) | |
|
void coxph_train |
( |
varchar |
source_table, |
|
|
varchar |
output_table, |
|
|
varchar |
dependent_varname, |
|
|
varchar |
independent_varname, |
|
|
varchar |
right_censoring_status, |
|
|
varchar |
strata, |
|
|
varchar |
optimizer_params |
|
) |
| |
To include an intercept in the model, set one coordinate in the independentVariables
array to 1.
- Parameters
-
source_table | Name of the source relation containing the training data |
output_table | Name of the output relation to contain the coxph_train model |
independent_varname | Name of the independent column |
dependent_varname | Name of the dependent column measuring time of death |
right_censoring_status | Name of the column that determines right censoring support |
strata | Comma-separated list of column names on which to stratify the data |
optimizer_params | Comma-separated list of parameters for the optimizer function |
- Returns
- An output table with following columns:
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 coxph_train(
'source_table', 'output_table',
'dependent_varname', 'independent_varname'
'right_censoring_status', 'strata'
);
- Get vector of coefficients \( \boldsymbol \beta \):
SELECT coef from 'output_table'
CREATE FUNCTION MADlib TRUE LANGUAGE sql VOLATILE |