| /* ----------------------------------------------------------------------- *//** |
| * |
| * 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. |
| * |
| *//* ----------------------------------------------------------------------- */ |
| |
| /* ----------------------------------------------------------------------------- |
| * Test Wilcoxon signed-rank test. |
| * |
| * Example taken from: |
| * http://www-stat.stanford.edu/~susan/courses/s141/hononpara.pdf |
| * -------------------------------------------------------------------------- */ |
| |
| CREATE TABLE test_wsr ( |
| x DOUBLE PRECISION, |
| y DOUBLE PRECISION |
| ); |
| |
| INSERT INTO test_wsr VALUES (0.32,0.39); |
| INSERT INTO test_wsr VALUES (0.4,0.47); |
| INSERT INTO test_wsr VALUES (0.11,0.11); |
| INSERT INTO test_wsr VALUES (0.48,0.4); |
| |
| CREATE TABLE wsr_test AS |
| SELECT (wsr_test( |
| x - y, |
| 2 * 2^(-52) * greatest(x,y) |
| ORDER BY abs(x - y) |
| )).* |
| FROM test_wsr; |