-
Notifications
You must be signed in to change notification settings - Fork 0
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
Function to compute p-values from correlations #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests to yaml file.
} else if (abs_r == 1.0 ) { | ||
return 0.0 | ||
} else { | ||
return NaN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have test case to ensure that NaN is converted properly (use BQ IS_NAN method in test)
-- Input: | ||
-- r: correlation value, n : number of samples | ||
-- Output: The p value of the correlation | ||
CREATE OR REPLACE FUNCTION fn.corr_pvalue(r FLOAT64, n INT64 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BQ doesn't formally support INT64 inputs... I think this is fine, I imagine it'll just throw an error if the int can't be accurately represented in javascript. Maybe worth confirming this in a test case?
CREATE OR REPLACE FUNCTION fn.corr_pvalue(r FLOAT64, n INT64 ) | ||
RETURNS FLOAT64 | ||
LANGUAGE js AS """ | ||
var abs_r = Math.abs(r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this statement "Math.abs(r)" is generating errors in the testing process(E AssertionError: TypeError: "myproject.Math_test_local_test.abs" is not a function at UDF$1(FLOAT64, INT64))
; but this works fine in the console. Is this the right way to call the abs() function?
No description provided.