| /* ----------------------------------------------------------------------- *//** |
| * |
| * 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 Mann-Whitney-test. |
| * |
| * Example taken from: |
| * http://www.itl.nist.gov/div898/handbook/prc/section3/prc35.htm |
| * -------------------------------------------------------------------------- */ |
| |
| CREATE TABLE nist_mw_example ( |
| id SERIAL, |
| group_a FLOAT8, |
| rank_a FLOAT8, |
| group_b FLOAT8, |
| rank_b FLOAT8 |
| ); |
| |
| COPY nist_mw_example(group_a, rank_a, group_b, rank_b) FROM stdin; |
| .55 8 .49 5 |
| .67 15.5 .68 17 |
| .53 7 .77 22 |
| .44 2 .62 12 |
| .65 13.5 .48 3.5 |
| .75 20.5 .59 9.5 |
| \. |
| |
| CREATE TABLE mw_test AS |
| SELECT (mw_test(from_first, value ORDER BY value)).* |
| FROM ( |
| SELECT TRUE AS from_first, group_a AS value |
| FROM nist_mw_example |
| UNION ALL |
| SELECT FALSE, group_b |
| FROM nist_mw_example |
| ) q; |