Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike1 #295

Open
wants to merge 140 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
288897f
First pass at adding Statslib
jrossthomson Aug 4, 2020
a2b6348
Merge branch 'master' of https://github.com/jrossthomson/bigquery-uti…
jrossthomson Aug 4, 2020
2705f30
Interim update.
jrossthomson Aug 5, 2020
3321b42
Fixed KW test cases.
jrossthomson Aug 6, 2020
23c8491
Merge branch 'statslib'
jrossthomson Aug 6, 2020
757d08b
Fixed kw.
jrossthomson Sep 1, 2020
2625f15
Added Linear Regression
jrossthomson Sep 16, 2020
7270810
Merge branch 'statslib'
jrossthomson Sep 16, 2020
d9b33a8
Merge remote-tracking branch 'upstream/master'
jrossthomson Sep 16, 2020
4be0d71
Merge branch 'master' into master
jrossthomson Oct 27, 2020
c6ad383
Merge remote-tracking branch 'upstream/master'
imathews Feb 2, 2021
aa18c13
Use jstat from bq_js_libs
imathews Feb 2, 2021
9a63ff2
fix typo
imathews Feb 2, 2021
65279b5
Update kruskal_wallis.sql
jrossthomson Feb 8, 2021
8cc1879
Update linear_regression.sql
jrossthomson Feb 8, 2021
ddd43ad
Merge branch 'master' into master
jrossthomson Feb 8, 2021
21ced84
Update udfs/statslib/pvalue.sql
jrossthomson Feb 8, 2021
04acaa4
Delete .init
jrossthomson Feb 8, 2021
568cb96
Update .gitignore
jrossthomson Feb 8, 2021
d18cd99
Merge branch 'master' of https://github.com/jrossthomson/bigquery-utils
drj-ross Feb 8, 2021
9570dcb
Update udfs/statslib/kruskal_wallis.sql
jrossthomson Feb 9, 2021
14cad12
Update udfs/statslib/pvalue.sql
jrossthomson Feb 9, 2021
2470574
Update udfs/statslib/linear_regression.sql
jrossthomson Feb 9, 2021
076d9a3
Update udfs/statslib/kruskal_wallis.sql
jrossthomson Feb 9, 2021
43f066d
Update udf_test_utils.py
jrossthomson Feb 9, 2021
c738145
reverted file
drj-ross Feb 9, 2021
0229cf0
Merge branch 'master' of https://github.com/jrossthomson/bigquery-utils
drj-ross Feb 9, 2021
8457323
Delete key.json
jrossthomson Feb 9, 2021
bbc53a8
Moved statslib to community
drj-ross Feb 9, 2021
b6d337d
Merge branch 'master' of https://github.com/jrossthomson/bigquery-utils
drj-ross Feb 9, 2021
f7c6d77
trying to revert again
drj-ross Feb 12, 2021
d4cc039
fixed newline
drj-ross Feb 12, 2021
6705fc5
Delete BigQueryUtils.code-workspace
jrossthomson Feb 22, 2021
c668b7f
Update udfs/community/pvalue.sql
jrossthomson Feb 22, 2021
befd864
Update udfs/community/linear_regression.sql
jrossthomson Feb 22, 2021
ad2accc
Update udfs/community/linear_regression.sql
jrossthomson Feb 22, 2021
00690a9
Update udfs/community/kruskal_wallis.sql
jrossthomson Feb 22, 2021
4b54467
Update udfs/community/README.md
jrossthomson Feb 22, 2021
b22b52e
Update udfs/community/README.md
jrossthomson Feb 22, 2021
bd0c6dd
Update udfs/community/README.md
jrossthomson Feb 22, 2021
6095ed2
Update README.md
jrossthomson Feb 25, 2021
67d21f1
Update README.md
jrossthomson Feb 25, 2021
d294925
Update README.md
jrossthomson Feb 25, 2021
dbac294
Update test_cases.yaml
jrossthomson Feb 25, 2021
c4f90ed
Merge branch 'master' into master
danieldeleo Feb 26, 2021
9d762e4
Function to compute p-values from correlations
boaguilar Apr 27, 2021
6d89173
Additional UDFs
boaguilar May 10, 2021
844e020
fix(test): handle jslibs bundling, reference in local testing
imathews May 11, 2021
18e81c7
Merge branch 'master' into fix-jslibs_testing
imathews May 11, 2021
78162c4
Merge pull request #5 from jrossthomson/fix-jslibs_testing
jrossthomson May 11, 2021
11efd37
Adding info about testing js_libs locally.
drj-ross May 11, 2021
6136a96
Merge branch 'statslib-boris' into add-boris
drj-ross May 11, 2021
ac48d5a
Removed typo
drj-ross May 12, 2021
d56baa5
fix(tests): remove NaN test, property reference for JS methods
imathews Jun 8, 2021
6b34d8b
isb-cgc functions fixed
boaguilar Jun 22, 2021
fd4c19d
feat: implement jstat_udf
imathews Jun 22, 2021
73575a3
Merge branch 'GoogleCloudPlatform:master' into add-boris
jrossthomson Jul 20, 2021
6413d21
Merge pull request #8 from jrossthomson/feat-jstat_udf
jrossthomson Jul 20, 2021
503e017
Merge pull request #1 from jrossthomson/statslib-boris
jrossthomson Jul 20, 2021
8846916
Merge branch 'master' into add-boris
jrossthomson Jul 20, 2021
369f0fd
Merge pull request #9 from jrossthomson/add-boris
jrossthomson Jul 20, 2021
f230b4e
Trying to fix mann_whitney and normal_cdf
drj-ross Jul 20, 2021
60f8868
Merge pull request #10 from jrossthomson/ross
jrossthomson Jul 20, 2021
d31de79
Added t_test; Student's T
drj-ross Jul 20, 2021
e0f42e2
Added T test to docs.
drj-ross Jul 20, 2021
5699b1b
Renamed pvalue.sql to chisquare_cdf
drj-ross Jul 20, 2021
b4e7d94
wip: implement basic piping for chi-square
imathews Aug 17, 2021
a6b902b
fix: use string concatenation to return proper chi-square results
imathews Aug 17, 2021
ccc349d
feat: add linear_regression stored procedure
imathews Aug 17, 2021
8c38aa6
Merge pull request #13 from jrossthomson/ross
jrossthomson Aug 17, 2021
bd9c943
implement assertions in unit tests, finalize argument signature
imathews Aug 18, 2021
892016a
Merge branch 'master' into feat-chi_square_procedure
imathews Aug 18, 2021
f28951e
Merge pull request #14 from jrossthomson/feat-chi_square_procedure
jrossthomson Aug 31, 2021
a6a5682
feat: implement bh_multiple_tests
imathews Sep 28, 2021
2c44d79
feat: pass temp_table_name parameter to bh_multiple_tests
imathews Sep 28, 2021
a5a5886
Merge pull request #15 from jrossthomson/feat-BH_multi_test_stored_proc
jrossthomson Sep 28, 2021
3b0e045
Documentation for new procedures
boaguilar Oct 7, 2021
c1303f0
Merge pull request #16 from jrossthomson/boaguilar-documentation
jrossthomson Oct 12, 2021
4be3705
Remove commenting of line in run.sh
jrossthomson Oct 12, 2021
00cfa80
Merge remote-tracking branch 'upstream/master'
jrossthomson Oct 12, 2021
402266f
Updated sql files to be sqlx
jrossthomson Oct 12, 2021
ec5f181
Added fix to man
jrossthomson Oct 12, 2021
ce741b4
pvalue to chi_square_cdf fixes
jrossthomson Oct 12, 2021
e2b898d
fixed test case
jrossthomson Oct 12, 2021
ea03c46
Merge remote-tracking branch 'upstream/master'
jrossthomson Oct 26, 2021
55e03e8
Update udfs/community/t_test.sqlx
jrossthomson Oct 26, 2021
70d83c8
Update udfs/community/t_test.sqlx
jrossthomson Oct 26, 2021
9e3716c
Update udfs/community/p_fisherexact.sqlx
jrossthomson Oct 26, 2021
021a623
Update udfs/community/p_fisherexact.sqlx
jrossthomson Oct 26, 2021
6a77652
Update udfs/community/p_fisherexact.sqlx
jrossthomson Oct 26, 2021
7823f31
Update udfs/community/p_fisherexact.sqlx
jrossthomson Oct 26, 2021
e713b91
Update udfs/community/p_fisherexact.sqlx
jrossthomson Oct 26, 2021
093a50a
Delete cloudbuild_js_libs.yaml
jrossthomson Oct 26, 2021
0a543b5
Merge branch 'master' of https://github.com/jrossthomson/bigquery-utils
jrossthomson Oct 26, 2021
defd086
Added MannWhitney and Fisher tests.
jrossthomson Oct 28, 2021
ab7a8f3
Update README.md
boaguilar Nov 9, 2021
9d0268e
Update README.md
boaguilar Nov 9, 2021
9babfd0
Update README.md
boaguilar Nov 9, 2021
3fdc93b
test of statistical udfs
boaguilar Nov 9, 2021
2d05271
updated udf
boaguilar Nov 9, 2021
c5dc8ea
Merge pull request #18 from jrossthomson/boris-udfs
jrossthomson Nov 9, 2021
2ff252c
Update stored_procedures/bh_multiple_tests.sql
jrossthomson Dec 9, 2021
ecc2876
Update udfs/community/t_test.sqlx
jrossthomson Dec 9, 2021
5e14246
Update udfs/community/p_fisherexact.sqlx
jrossthomson Dec 9, 2021
118ae00
Update udfs/community/normal_cdf.sqlx
jrossthomson Dec 9, 2021
d3fee52
Update udfs/community/mannwhitneyu.sqlx
jrossthomson Dec 9, 2021
7598414
Update udfs/community/kruskal_wallis.sqlx
jrossthomson Dec 9, 2021
1dc1697
Update udfs/community/jstat.sqlx
jrossthomson Dec 9, 2021
73e5c8a
Update udfs/community/corr_pvalue.sqlx
jrossthomson Dec 9, 2021
e841e67
Update udfs/community/chisquare_cdf.sqlx
jrossthomson Dec 9, 2021
056cd55
Update stored_procedures/linear_regression.sql
jrossthomson Dec 9, 2021
fcce830
Update stored_procedures/chi_square.sql
jrossthomson Dec 9, 2021
72db4f5
Added license header
jrossthomson Dec 9, 2021
82e6229
Added linear regression
jrossthomson Dec 9, 2021
5321ad1
fixed index links.
jrossthomson Dec 9, 2021
7eb70f5
fixed index names
jrossthomson Dec 10, 2021
7ee7333
Added Unit tests.
jrossthomson Dec 21, 2021
663ce64
Fixed Link
jrossthomson Dec 21, 2021
24cc148
Fixed function name.
jrossthomson Dec 21, 2021
cd5bead
Reinstating t-test
jrossthomson Dec 21, 2021
18c5eea
Fixed link normal_cdf
jrossthomson Dec 21, 2021
3df1af1
Merge branch 'master' into master
danieldeleo Jan 4, 2022
13ef72e
trailing newline
danieldeleo Jan 4, 2022
faf5a9a
Merge branch 'GoogleCloudPlatform:master' into master
jrossthomson Jan 6, 2022
5efa96b
Anova created.
jrossthomson Jan 18, 2022
46406ab
Merge branch 'master' of https://github.com/jrossthomson/bigquery-utils
jrossthomson Jan 18, 2022
bf2b246
feat: implement t-test paired stored proc
imathews Feb 15, 2022
7e81768
feat: t_tests
imathews Feb 15, 2022
dbbeeca
Merge pull request #27 from jrossthomson/feat-t_test_stored_proc
jrossthomson Feb 17, 2022
a8448c0
added testing version of ANOVA
jrossthomson Apr 12, 2022
9eb551f
Merge branch 'master' of https://github.com/jrossthomson/bigquery-utils
jrossthomson Apr 12, 2022
cd9fb06
commented out config temporarily
jrossthomson Apr 12, 2022
0c20220
Added Anova. Trying to get testing to go through.
jrossthomson May 11, 2022
1d814d3
Merge branch 'master' of https://github.com/GoogleCloudPlatform/bigqu…
jrossthomson Jun 9, 2022
7343a6b
Merge branch 'GoogleCloudPlatform-master'
jrossthomson Jun 9, 2022
59bb000
Added Anova f test
jrossthomson Jun 9, 2022
5dba308
test
jrossthomson Jun 9, 2022
a3fce9b
Working anova f test
jrossthomson Jul 19, 2022
1a5facb
added anovaftest
jrossthomson Aug 4, 2022
9c53365
updated link addresses
jrossthomson Aug 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
224 changes: 224 additions & 0 deletions stored_procedures/t_test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
/*
* Copyright 2021 Google LLC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright 2021 Google LLC
* Copyright 2022 Google LLC

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update all other new files as well to 2022

*
* Licensed 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.
*/

-- @param STRING pop1_table table name (or subquery) that contains the first population
-- @param STRING pop1_variable name of the measurement column in our first table
-- @param STRING pop2_table table name (or subquery) that contains the second population
-- @param STRING pop2_variable name of the measurement column in our second table
-- @return STRUCT<t_value FLOAT64, dof FLOAT64, p_value FLOAT64>

CREATE OR REPLACE PROCEDURE bqutil.procedure.t_test(pop1_table STRING, pop1_variable STRING, pop2_table STRING, pop2_variable STRING, OUT result STRUCT<t_value FLOAT64, dof FLOAT64, p_value FLOAT64> )
BEGIN
EXECUTE IMMEDIATE """
WITH pop1 AS (
SELECT `""" || pop1_variable || """` AS value
FROM """ || pop1_table ||"""
), pop2 as (
SELECT `""" || pop2_variable || """` AS value
FROM """ || pop2_table || """
)
SELECT STRUCT(
ABS(x1 - x2) / Sqrt((st1 * st1 / n1) + (st2 * st2 / n2)) AS t_value,
n1 + n2 - 2 AS dof,
bqutil.fn.pvalue(ABS(x1 - x2) / Sqrt((st1 * st1 / n1) + (st2 * st2 / n2)), n1 + n2 - 2) AS p_value
)
FROM (
SELECT
AVG(value) x1,
STDDEV(value) st1,
COUNT(value) AS n1
FROM pop1
)
CROSS JOIN
(
SELECT
AVG(value) x2,
STDDEV(value) st2,
COUNT(value) AS n2
FROM pop2
)
""" INTO result;
END;

-- a unit test of t_test_paired
BEGIN
DECLARE result STRUCT<t_value FLOAT64, dof FLOAT64, p_value FLOAT64>;
CREATE TEMP TABLE iris (sepal_length FLOAT64, sepal_width FLOAT64, petal_length FLOAT64, petal_width FLOAT64, species STRING)
AS
SELECT 5.1 AS sepal_length,
3.5 AS sepal_width,
1.4 AS petal_length,
0.2 AS petal_width,
'setosa' AS species
UNION ALL SELECT 4.9,3.0,1.4,0.2,'setosa'
UNION ALL SELECT 4.7,3.2,1.3,0.2,'setosa'
UNION ALL SELECT 4.6,3.1,1.5,0.2,'setosa'
UNION ALL SELECT 5.0,3.6,1.4,0.2,'setosa'
UNION ALL SELECT 5.4,3.9,1.7,0.4,'setosa'
UNION ALL SELECT 4.6,3.4,1.4,0.3,'setosa'
UNION ALL SELECT 5.0,3.4,1.5,0.2,'setosa'
UNION ALL SELECT 4.4,2.9,1.4,0.2,'setosa'
UNION ALL SELECT 4.9,3.1,1.5,0.1,'setosa'
UNION ALL SELECT 5.4,3.7,1.5,0.2,'setosa'
UNION ALL SELECT 4.8,3.4,1.6,0.2,'setosa'
UNION ALL SELECT 4.8,3.0,1.4,0.1,'setosa'
UNION ALL SELECT 4.3,3.0,1.1,0.1,'setosa'
UNION ALL SELECT 5.8,4.0,1.2,0.2,'setosa'
UNION ALL SELECT 5.7,4.4,1.5,0.4,'setosa'
UNION ALL SELECT 5.4,3.9,1.3,0.4,'setosa'
UNION ALL SELECT 5.1,3.5,1.4,0.3,'setosa'
UNION ALL SELECT 5.7,3.8,1.7,0.3,'setosa'
UNION ALL SELECT 5.1,3.8,1.5,0.3,'setosa'
UNION ALL SELECT 5.4,3.4,1.7,0.2,'setosa'
UNION ALL SELECT 5.1,3.7,1.5,0.4,'setosa'
UNION ALL SELECT 4.6,3.6,1.0,0.2,'setosa'
UNION ALL SELECT 5.1,3.3,1.7,0.5,'setosa'
UNION ALL SELECT 4.8,3.4,1.9,0.2,'setosa'
UNION ALL SELECT 5.0,3.0,1.6,0.2,'setosa'
UNION ALL SELECT 5.0,3.4,1.6,0.4,'setosa'
UNION ALL SELECT 5.2,3.5,1.5,0.2,'setosa'
UNION ALL SELECT 5.2,3.4,1.4,0.2,'setosa'
UNION ALL SELECT 4.7,3.2,1.6,0.2,'setosa'
UNION ALL SELECT 4.8,3.1,1.6,0.2,'setosa'
UNION ALL SELECT 5.4,3.4,1.5,0.4,'setosa'
UNION ALL SELECT 5.2,4.1,1.5,0.1,'setosa'
UNION ALL SELECT 5.5,4.2,1.4,0.2,'setosa'
UNION ALL SELECT 4.9,3.1,1.5,0.1,'setosa'
UNION ALL SELECT 5.0,3.2,1.2,0.2,'setosa'
UNION ALL SELECT 5.5,3.5,1.3,0.2,'setosa'
UNION ALL SELECT 4.9,3.1,1.5,0.1,'setosa'
UNION ALL SELECT 4.4,3.0,1.3,0.2,'setosa'
UNION ALL SELECT 5.1,3.4,1.5,0.2,'setosa'
UNION ALL SELECT 5.0,3.5,1.3,0.3,'setosa'
UNION ALL SELECT 4.5,2.3,1.3,0.3,'setosa'
UNION ALL SELECT 4.4,3.2,1.3,0.2,'setosa'
UNION ALL SELECT 5.0,3.5,1.6,0.6,'setosa'
UNION ALL SELECT 5.1,3.8,1.9,0.4,'setosa'
UNION ALL SELECT 4.8,3.0,1.4,0.3,'setosa'
UNION ALL SELECT 5.1,3.8,1.6,0.2,'setosa'
UNION ALL SELECT 4.6,3.2,1.4,0.2,'setosa'
UNION ALL SELECT 5.3,3.7,1.5,0.2,'setosa'
UNION ALL SELECT 5.0,3.3,1.4,0.2,'setosa'
UNION ALL SELECT 7.0,3.2,4.7,1.4,'versicolor'
UNION ALL SELECT 6.4,3.2,4.5,1.5,'versicolor'
UNION ALL SELECT 6.9,3.1,4.9,1.5,'versicolor'
UNION ALL SELECT 5.5,2.3,4.0,1.3,'versicolor'
UNION ALL SELECT 6.5,2.8,4.6,1.5,'versicolor'
UNION ALL SELECT 5.7,2.8,4.5,1.3,'versicolor'
UNION ALL SELECT 6.3,3.3,4.7,1.6,'versicolor'
UNION ALL SELECT 4.9,2.4,3.3,1.0,'versicolor'
UNION ALL SELECT 6.6,2.9,4.6,1.3,'versicolor'
UNION ALL SELECT 5.2,2.7,3.9,1.4,'versicolor'
UNION ALL SELECT 5.0,2.0,3.5,1.0,'versicolor'
UNION ALL SELECT 5.9,3.0,4.2,1.5,'versicolor'
UNION ALL SELECT 6.0,2.2,4.0,1.0,'versicolor'
UNION ALL SELECT 6.1,2.9,4.7,1.4,'versicolor'
UNION ALL SELECT 5.6,2.9,3.6,1.3,'versicolor'
UNION ALL SELECT 6.7,3.1,4.4,1.4,'versicolor'
UNION ALL SELECT 5.6,3.0,4.5,1.5,'versicolor'
UNION ALL SELECT 5.8,2.7,4.1,1.0,'versicolor'
UNION ALL SELECT 6.2,2.2,4.5,1.5,'versicolor'
UNION ALL SELECT 5.6,2.5,3.9,1.1,'versicolor'
UNION ALL SELECT 5.9,3.2,4.8,1.8,'versicolor'
UNION ALL SELECT 6.1,2.8,4.0,1.3,'versicolor'
UNION ALL SELECT 6.3,2.5,4.9,1.5,'versicolor'
UNION ALL SELECT 6.1,2.8,4.7,1.2,'versicolor'
UNION ALL SELECT 6.4,2.9,4.3,1.3,'versicolor'
UNION ALL SELECT 6.6,3.0,4.4,1.4,'versicolor'
UNION ALL SELECT 6.8,2.8,4.8,1.4,'versicolor'
UNION ALL SELECT 6.7,3.0,5.0,1.7,'versicolor'
UNION ALL SELECT 6.0,2.9,4.5,1.5,'versicolor'
UNION ALL SELECT 5.7,2.6,3.5,1.0,'versicolor'
UNION ALL SELECT 5.5,2.4,3.8,1.1,'versicolor'
UNION ALL SELECT 5.5,2.4,3.7,1.0,'versicolor'
UNION ALL SELECT 5.8,2.7,3.9,1.2,'versicolor'
UNION ALL SELECT 6.0,2.7,5.1,1.6,'versicolor'
UNION ALL SELECT 5.4,3.0,4.5,1.5,'versicolor'
UNION ALL SELECT 6.0,3.4,4.5,1.6,'versicolor'
UNION ALL SELECT 6.7,3.1,4.7,1.5,'versicolor'
UNION ALL SELECT 6.3,2.3,4.4,1.3,'versicolor'
UNION ALL SELECT 5.6,3.0,4.1,1.3,'versicolor'
UNION ALL SELECT 5.5,2.5,4.0,1.3,'versicolor'
UNION ALL SELECT 5.5,2.6,4.4,1.2,'versicolor'
UNION ALL SELECT 6.1,3.0,4.6,1.4,'versicolor'
UNION ALL SELECT 5.8,2.6,4.0,1.2,'versicolor'
UNION ALL SELECT 5.0,2.3,3.3,1.0,'versicolor'
UNION ALL SELECT 5.6,2.7,4.2,1.3,'versicolor'
UNION ALL SELECT 5.7,3.0,4.2,1.2,'versicolor'
UNION ALL SELECT 5.7,2.9,4.2,1.3,'versicolor'
UNION ALL SELECT 6.2,2.9,4.3,1.3,'versicolor'
UNION ALL SELECT 5.1,2.5,3.0,1.1,'versicolor'
UNION ALL SELECT 5.7,2.8,4.1,1.3,'versicolor'
UNION ALL SELECT 6.3,3.3,6.0,2.5,'virginica'
UNION ALL SELECT 5.8,2.7,5.1,1.9,'virginica'
UNION ALL SELECT 7.1,3.0,5.9,2.1,'virginica'
UNION ALL SELECT 6.3,2.9,5.6,1.8,'virginica'
UNION ALL SELECT 6.5,3.0,5.8,2.2,'virginica'
UNION ALL SELECT 7.6,3.0,6.6,2.1,'virginica'
UNION ALL SELECT 4.9,2.5,4.5,1.7,'virginica'
UNION ALL SELECT 7.3,2.9,6.3,1.8,'virginica'
UNION ALL SELECT 6.7,2.5,5.8,1.8,'virginica'
UNION ALL SELECT 7.2,3.6,6.1,2.5,'virginica'
UNION ALL SELECT 6.5,3.2,5.1,2.0,'virginica'
UNION ALL SELECT 6.4,2.7,5.3,1.9,'virginica'
UNION ALL SELECT 6.8,3.0,5.5,2.1,'virginica'
UNION ALL SELECT 5.7,2.5,5.0,2.0,'virginica'
UNION ALL SELECT 5.8,2.8,5.1,2.4,'virginica'
UNION ALL SELECT 6.4,3.2,5.3,2.3,'virginica'
UNION ALL SELECT 6.5,3.0,5.5,1.8,'virginica'
UNION ALL SELECT 7.7,3.8,6.7,2.2,'virginica'
UNION ALL SELECT 7.7,2.6,6.9,2.3,'virginica'
UNION ALL SELECT 6.0,2.2,5.0,1.5,'virginica'
UNION ALL SELECT 6.9,3.2,5.7,2.3,'virginica'
UNION ALL SELECT 5.6,2.8,4.9,2.0,'virginica'
UNION ALL SELECT 7.7,2.8,6.7,2.0,'virginica'
UNION ALL SELECT 6.3,2.7,4.9,1.8,'virginica'
UNION ALL SELECT 6.7,3.3,5.7,2.1,'virginica'
UNION ALL SELECT 7.2,3.2,6.0,1.8,'virginica'
UNION ALL SELECT 6.2,2.8,4.8,1.8,'virginica'
UNION ALL SELECT 6.1,3.0,4.9,1.8,'virginica'
UNION ALL SELECT 6.4,2.8,5.6,2.1,'virginica'
UNION ALL SELECT 7.2,3.0,5.8,1.6,'virginica'
UNION ALL SELECT 7.4,2.8,6.1,1.9,'virginica'
UNION ALL SELECT 7.9,3.8,6.4,2.0,'virginica'
UNION ALL SELECT 6.4,2.8,5.6,2.2,'virginica'
UNION ALL SELECT 6.3,2.8,5.1,1.5,'virginica'
UNION ALL SELECT 6.1,2.6,5.6,1.4,'virginica'
UNION ALL SELECT 7.7,3.0,6.1,2.3,'virginica'
UNION ALL SELECT 6.3,3.4,5.6,2.4,'virginica'
UNION ALL SELECT 6.4,3.1,5.5,1.8,'virginica'
UNION ALL SELECT 6.0,3.0,4.8,1.8,'virginica'
UNION ALL SELECT 6.9,3.1,5.4,2.1,'virginica'
UNION ALL SELECT 6.7,3.1,5.6,2.4,'virginica'
UNION ALL SELECT 6.9,3.1,5.1,2.3,'virginica'
UNION ALL SELECT 5.8,2.7,5.1,1.9,'virginica'
UNION ALL SELECT 6.8,3.2,5.9,2.3,'virginica'
UNION ALL SELECT 6.7,3.3,5.7,2.5,'virginica'
UNION ALL SELECT 6.7,3.0,5.2,2.3,'virginica'
UNION ALL SELECT 6.3,2.5,5.0,1.9,'virginica'
UNION ALL SELECT 6.5,3.0,5.2,2.0,'virginica'
UNION ALL SELECT 6.2,3.4,5.4,2.3,'virginica'
UNION ALL SELECT 5.9,3.0,5.1,1.8,'virginica';


CALL bqutil.procedure.t_test('iris', 'sepal_width', 'iris', 'petal_width', result);

-- We round to 11 decimals here because there appears to be some inconsistency in the function, likely due to floating point errors and the order of aggregation
ASSERT ROUND(result.t_value, 11) = 25.88834390257;
ASSERT result.dof = 298;
ASSERT result.p_value = 1.0;
END;

Loading