I am using this package to get correlation coefficient : https://godoc.org/gonum.org/v1/gonum/stat#Correlation

It works well but it does not give P value of the correlation. Other functions in this package are given above on the same page: https://godoc.org/gonum.org/v1/gonum/stat

Similarly, this package also has correlation function which returns coefficient but not P value.

How can I find P value of correlation coefficient in any of these situations? Thanks for your help.

  • $\begingroup$ 1. Is this for the null hypothesis that the population correlation is 0? Under the assumption of bivariate normality, or something else? 2. Note that a program-specific answer is probably not suitable for this site (see the help center under the section starting with the word "Programming"). $\endgroup$
    – Glen_b
    Commented Sep 8, 2019 at 7:53
  • 1
    $\begingroup$ The most obvious answer is "use a package that does it already", of which there are a number of free possibilities available. However, under the usual assumptions people tend to use for this situation, when testing a null of 0 correlation, it's reasonably simple to use a transformation to Student-t. $t_{n-2}=r{\sqrt {\frac {n-2}{1-r^{2}}}}$ $\endgroup$
    – Glen_b
    Commented Sep 8, 2019 at 8:01
  • $\begingroup$ See stats.stackexchange.com/questions/400146/… and stats.stackexchange.com/questions/122481/… and stats.stackexchange.com/questions/270612/… (and several others on site) $\endgroup$
    – Glen_b
    Commented Sep 8, 2019 at 8:08
  • $\begingroup$ Transformation to Student-t seems a good method and thanks for the links. Otherwise, I am not able to find a good statistics library in Go language: golang.org $\endgroup$
    – rnso
    Commented Sep 8, 2019 at 8:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.