Navigation

Operators and Keywords

Function List:

C++ API

: cor_test (x, y, alt, method)

Test whether two samples x and y come from uncorrelated populations.

The optional argument string alt describes the alternative hypothesis, and can be "!=" or "<>" (nonzero), ">" (greater than 0), or "<" (less than 0). The default is the two-sided case.

The optional argument string method specifies which correlation coefficient to use for testing. If method is "pearson" (default), the (usual) Pearson’s product moment correlation coefficient is used. In this case, the data should come from a bivariate normal distribution. Otherwise, the other two methods offer nonparametric alternatives. If method is "kendall", then Kendall’s rank correlation tau is used. If method is "spearman", then Spearman’s rank correlation rho is used. Only the first character is necessary.

The output is a structure with the following elements:

pval

The p-value of the test.

stat

The value of the test statistic.

dist

The distribution of the test statistic.

params

The parameters of the null distribution of the test statistic.

alternative

The alternative hypothesis.

method

The method used for testing.

If no output argument is given, the p-value is displayed.

Package: octave