| /* ----------------------------------------------------------------------- *//** |
| * |
| * 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 ANOVA. |
| * |
| * Example taken from: |
| * http://www.itl.nist.gov/div898/handbook/prc/section4/prc433.htm |
| * -------------------------------------------------------------------------- */ |
| |
| CREATE TABLE nist_anova_test ( |
| id SERIAL, |
| resistance FLOAT8[] |
| ); |
| |
| COPY nist_anova_test(resistance) FROM stdin; |
| {6.9,8.3,8.0} |
| {5.4,6.8,10.5} |
| {5.8,7.8,8.1} |
| {4.6,9.2,6.9} |
| {4.0,6.5,9.3} |
| \. |
| |
| CREATE TABLE one_way_anova_nist AS |
| SELECT (one_way_anova(level, value)).* FROM ( |
| SELECT level, resistance[level] AS value |
| FROM |
| nist_anova_test, ( |
| SELECT * FROM generate_series(1,3) level |
| ) q |
| ) q; |