| /* ----------------------------------------------------------------------- *//** |
| * |
| * 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. |
| * |
| *//* ----------------------------------------------------------------------- */ |
| |
| /* ----------------------------------------------------------------------------- |
| * Cox proportional hazard survival regression |
| * |
| * Both Example taken from: |
| * http://www.sph.emory.edu/~cdckms/CoxPH/prophaz2.html |
| * -------------------------------------------------------------------------- */ |
| |
| DROP TABLE IF EXISTS leukemia; |
| CREATE TABLE leukemia ( |
| id INTEGER NOT NULL, |
| grp DOUBLE PRECISION, |
| wbc DOUBLE PRECISION, |
| timedeath INTEGER, |
| status BOOLEAN |
| ); |
| |
| |
| INSERT INTO leukemia(id, grp, wbc, timedeath,status) VALUES |
| (0,0,1.45,35,TRUE), |
| (1,0,1.47,34,TRUE), |
| (3,0,2.2,32,TRUE), |
| (22,1,4.01,3,TRUE), |
| (23,1,4.91,2,TRUE), |
| (24,1,5,1,TRUE), |
| (25,NULL,4.01,3,TRUE); |
| |
| drop table if exists coxph_out; |
| drop table if exists coxph_out_summary; |
| select coxph_train('leukemia', 'coxph_out', 'timedeath', 'ARRAY[grp, wbc]', 'status', NULL, NULL); |