You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,22 +38,20 @@ the probability that death has happened before time t.
38
38
39
39
Following is the syntax for the coxph_train() training function:
40
40
<pre class="syntax">
41
-
coxph_train(
42
-
source_table,
43
-
output_table,
44
-
dependent_variable,
45
-
independent_variable,
46
-
right_censoring_status,
47
-
strata,
48
-
optimizer_params
49
-
)
41
+
coxph_train( source_table,
42
+
output_table,
43
+
dependent_variable,
44
+
independent_variable,
45
+
right_censoring_status,
46
+
strata,
47
+
optimizer_params
48
+
)
50
49
</pre>
51
-
52
50
\b Arguments
53
51
<dl class="arglist">
54
52
<dt>source_table</dt>
55
53
<dd>TEXT. The name of the table containing input data.</dd>
56
-
<dt>out_table</dt>
54
+
<dt>output_table</dt>
57
55
<dd>TEXT. The name of the table where the output model is saved.
58
56
The output is saved in the table named by the <em>output_table</em> argument. It has the following columns:
59
57
<table class="output">
@@ -63,7 +61,7 @@ coxph_train(
63
61
</tr>
64
62
<tr>
65
63
<th>loglikelihood</th>
66
-
<td>FLOAT8. Log-likelihood value of the MLE estimate</td>
64
+
<td>FLOAT8. Log-likelihood value of the MLE estimate.</td>
67
65
</tr>
68
66
<tr>
69
67
<th>std_err</th>
@@ -79,29 +77,29 @@ coxph_train(
79
77
</tr>
80
78
<tr>
81
79
<th>hessian</th>
82
-
<td>The vectorized Hessian matrix computed using the final solution.</td>
80
+
<td>FLOAT8[]. The vectorized Hessian matrix computed using the final solution.</td>
83
81
</tr>
84
82
<tr>
85
83
<th>num_iterations</th>
86
-
<td>The number of iterations performed by the optimizer</td>
84
+
<td>INTEGER. The number of iterations performed by the optimizer.</td>
87
85
</tr>
88
86
</table>
89
87
</dd>
90
-
<dd> Additionally, an output summary table is also generated that contains
91
-
a summary of the parameters used for building the cox model. It is stored
88
+
<dd> Additionally, a summary output table is generated that contains
89
+
a summary of the parameters used for building the Cox model. It is stored
92
90
in a table named <em>output_table</em>_summary. It has the following columns:
93
91
<table class="output">
94
92
<tr>
95
93
<th>source_table</th>
96
-
<td>Source table name</td>
94
+
<td>The source table name.</td>
97
95
</tr>
98
96
<tr>
99
97
<th>dep_var</th>
100
-
<td>dependent variable name</td>
98
+
<td>The dependent variable name.</td>
101
99
</tr>
102
100
<tr>
103
101
<th>ind_var</th>
104
-
<td>independent variable name</td>
102
+
<td>The independent variable name.</td>
105
103
</tr>
106
104
<tr>
107
105
<th>right_censoring_status</th>
@@ -116,7 +114,7 @@ coxph_train(
116
114
117
115
<dt>dependent_variable</dt>
118
116
<dd>TEXT. A string containing the name of a column that contains
119
-
an array of numeric values, or a string expression in the format 'array[1, x1, x2, x3]',
117
+
an array of numeric values, or a string expression in the format 'ARRAY[1, x1, x2, x3]',
120
118
where <em>x1</em>, <em>x2</em> and <em>x3</em> are column names. Dependent
121
119
variables refer to the time of death. There is no need to pre-sort the data.</dd>
122
120
<dt>independent_variable</dt>
@@ -128,78 +126,60 @@ coxph_train(
128
126
expression (i.e., 'true', 'false', '0', '1') that applies to all observations,
129
127
or a Boolean expression such as 'column_name < 10' that can be evaluated for each
130
128
observation.</dd>
131
-
<dt>strata</dt>
132
-
<dd>VARCHAR, default: NULL, which does not do any stratifications. It should be a string that contains the column names separated by commas, which are the columns (strata ID variables) used to do stratification.</dd>
133
-
<dt>optimizer_params</dt>
129
+
<dt>strata (optional)</dt>
130
+
<dd>VARCHAR, default: NULL, which does not do any stratifications. A string of comma-separated column names that are the strata ID variables used to do stratification.</dd>
131
+
<dt>optimizer_params (optional)</dt>
134
132
<dd>VARCHAR, default: NULL, which uses the default values of optimizer parameters: max_iter=20, optimizer='newton', tolerance=1e-4. It should be a string that contains pairs of 'key=value' separated by commas.</dd>
135
133
</dl>
136
134
137
-
@anchor notes
138
-
@par Notes
139
-
140
-
- All table names can be optionally schema qualified (current_schemas() would be
141
-
used if a schema name is not provided) and all table and column names
142
-
should follow case-sensitivity and quoting rules per the database.
143
-
(For instance, 'mytable' and 'MyTable' both resolve to the same entity, i.e. 'mytable'.
144
-
If mixed-case or multi-byte characters are desired for entity names then the
145
-
string should be double-quoted; in this case the input would be '"MyTable"').
146
-
147
-
- The cox_prop_hazards_regr() and cox_prop_hazards() functions have been
148
-
deprecated; coxph_train() should be used instead.
149
-
150
135
@anchor cox_zph
151
-
@par Test the Proportional Hazards Assumption of a Cox Regression
136
+
@par Proportional Hazards Assumption Test Function
152
137
153
-
Proportional-Hazard models enable the comparison of various survival models.
138
+
The cox_zph() function tests the proportional hazards assumption (PHA) of a Cox regression.
139
+
140
+
Proportional-hazard models enable the comparison of various survival models.
154
141
These PH models, however, assume that the hazard for a given individual is a
155
142
fixed proportion of the hazard for any other individual, and the ratio of the
156
-
hazards is constant across time. We currently don't provide performing any
157
-
transformation of the time to compute the correlation.
143
+
hazards is constant across time. MADlib does not currently have support for
144
+
performing any transformation of the time to compute the correlation.
158
145
159
146
The <em>cox_zph()</em> function is used to test this assumption by computing the correlation
160
147
of the residual of the coxph_train model with time.
161
148
162
-
To display a brief summary of the PH assumption test function, call the \ref cox_zph()
163
-
function with no argument:
164
-
@verbatim
165
-
SELECT madlib.cox_zph();
166
-
@endverbatim
167
-
168
149
Following is the syntax for the cox_zph() function:
169
150
<pre class="syntax">
170
-
cox_zph(
171
-
cox_model_table,
172
-
output_table
173
-
)
151
+
cox_zph( cox_model_table,
152
+
output_table
153
+
)
174
154
</pre>
175
-
176
155
\b Arguments
177
156
<dl class="arglist">
178
157
<dt>cox_model_table</dt>
179
-
<dd>TEXT. The name of the table containing the Cox Proportional-Hazards model</dd>
158
+
<dd>TEXT. The name of the table containing the Cox Proportional-Hazards model.</dd>
180
159
181
160
<dt>output_table</dt>
182
-
<dd>TEXT. The name of the table where the test statistics are saved</dd>
161
+
<dd>TEXT. The name of the table where the test statistics are saved.
183
162
The output table is named by the <em>output_table</em> argument and has
184
-
the following columns
163
+
the following columns:
185
164
<table class="output">
186
165
<tr>
187
166
<th>rho</th>
188
167
<td>FLOAT8[]. Vector of the correlation coefficients between
189
-
survival time and the scaled Schoenfeld residuals</td>
168
+
survival time and the scaled Schoenfeld residuals.</td>
190
169
</tr>
191
170
<tr>
192
171
<th>chi_square</th>
193
-
<td> FLOAT8[]. Chi-square test statistic for the correlation analysis</td>
172
+
<td> FLOAT8[]. Chi-square test statistic for the correlation analysis.</td>
194
173
</tr>
195
174
<tr>
196
175
<th>p_value</th>
197
-
<td>FLOAT8[]. Two-side p-value for the chi-square statistic</td>
176
+
<td>FLOAT8[]. Two-side p-value for the chi-square statistic.</td>
198
177
</tr>
199
178
</table>
179
+
</dd>
200
180
</dl>
201
181
202
-
Additionally, the residual values are outputed in table named as <em>output_table</em>_residual.
182
+
Additionally, the residual values are outputted to the table named <em>output_table</em>_residual.
203
183
The table contains the following columns:
204
184
<table class="output">
205
185
<tr>
@@ -213,19 +193,31 @@ The table contains the following columns:
213
193
</tr>
214
194
<tr>
215
195
<th>scaled_reisdual</th>
216
-
<td>Residual values scaled by the variance of the coefficients</td>
196
+
<td>Residual values scaled by the variance of the coefficients.</td>
217
197
</tr>
218
198
</table>
219
199
200
+
@anchor notes
201
+
@par Notes
202
+
203
+
- Table names can be optionally schema qualified (current_schemas() is
204
+
used if a schema name is not provided) and table and column names
205
+
should follow case-sensitivity and quoting rules per the database.
206
+
For instance, 'mytable' and 'MyTable' both resolve to the same entity—'mytable'.
207
+
If mixed-case or multi-byte characters are desired for entity names then the
208
+
string should be double-quoted; in this case the input would be '"MyTable"'.
209
+
210
+
- The cox_prop_hazards_regr() and cox_prop_hazards() functions have been
211
+
deprecated; coxph_train() should be used instead.
212
+
220
213
@anchor examples
221
214
@examp
222
215
-# View online help for the proportional hazards training method.
223
216
<pre class="example">
224
217
SELECT madlib.coxph_train();
225
-
SELECT madlib.coxph_train('usage');
226
218
</pre>
227
219
228
-
-# Create an input data set:
220
+
-# Create an input data set.
229
221
<pre class="example">
230
222
DROP TABLE IF EXISTS sample_data;
231
223
CREATE TABLE sample_data (
@@ -262,16 +254,16 @@ COPY sample_data FROM STDIN DELIMITED BY '|';
0 commit comments