0

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.

rnso
  • 8,893
  • 14
  • 50
  • 94
  • 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/on-topic] under the section starting with the word "Programming"). – Glen_b Sep 08 '19 at 07:53
  • 1
    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](https://en.wikipedia.org/wiki/Pearson_correlation_coefficient#Testing_using_Student's_t-distribution). $t_{n-2}=r{\sqrt {\frac {n-2}{1-r^{2}}}}$ – Glen_b Sep 08 '19 at 08:01
  • See https://stats.stackexchange.com/questions/400146/how-to-derive-the-formula-of-the-t-test-of-the-correlation-coefficient and https://stats.stackexchange.com/questions/122481/students-test-for-correlation-coef and https://stats.stackexchange.com/questions/270612/why-test-statistic-for-the-pearson-correlation-coefficient-is-frac-r-sqrtn-2 (and several others on site) – Glen_b Sep 08 '19 at 08:08
  • 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`: https://golang.org/ – rnso Sep 08 '19 at 08:09

0 Answers0