blob: d34b96a2ad408eacf3b65cf725a1a48e3a38a23b [file] [log] [blame]
/* ----------------------------------------------------------------------- *//**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*//* ----------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------
* Robust variance for Cox proportional hazard survival regression
* -------------------------------------------------------------------------- */
DROP TABLE IF EXISTS bladder;
CREATE TABLE bladder(
id INTEGER,
rx INTEGER,
num INTEGER,
sz INTEGER,
stop INTEGER,
event INTEGER,
enum INTEGER);
COPY bladder FROM STDIN;
1 1 1 3 1 0 1
1 1 1 3 1 0 2
1 1 2 3 1 1 3
6 1 1 1 14 0 4
85 2 2 3 59 0 1
85 2 1 2 59 1 2
85 2 2 3 59 1 3
85 2 1 3 59 0 4
\.
drop table if exists bladder_coxph_out;
drop table if exists bladder_coxph_out_summary;
select coxph_train('bladder', 'bladder_coxph_out', 'stop', 'ARRAY[rx, sz, num]', 'event=1', NULL, NULL);
-- robust variance
drop table if exists bladder_rv_coxph_out;
select robust_variance_coxph('bladder_coxph_out', 'bladder_rv_coxph_out');
-- cluster variance (id)
drop table if exists bladder_cv_coxph_out;
select clustered_variance_coxph('bladder_coxph_out', 'bladder_cv_coxph_out', 'id');