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

Function to compute p-values from correlations #1

Merged
merged 2 commits into from
Jul 20, 2021

Conversation

boaguilar
Copy link
Collaborator

No description provided.

Copy link
Owner

@jrossthomson jrossthomson left a 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
Copy link
Collaborator

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 )
Copy link
Collaborator

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)
Copy link
Collaborator Author

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?

@jrossthomson jrossthomson merged commit 503e017 into master Jul 20, 2021
@jrossthomson jrossthomson deleted the statslib-boris branch July 20, 2021 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants