Statistics: correlation_test

### Function Reference: `correlation_test`

statistics: h = correlation_test (x, y)
statistics: [h, pval] = correlation_test (y, x)
statistics: [h, pval, stats] = correlation_test (y, x)
statistics: […] = correlation_test (y, x, Name, Value)

Perform a correlation coefficient test whether two samples x and y come from uncorrelated populations.

`h = correlation_test (y, x)` tests the null hypothesis that the two samples x and y come from uncorrelated populations. The result is h = 0 if the null hypothesis cannot be rejected at the 5% significance level, or h = 1 if the null hypothesis can be rejected at the 5% level. y and x must be vectors of equal length with finite real numbers.

The p-value of the test is returned in pval. stats is a structure with the following fields:

| Field |  | Value
--- | --- | --- | ---
| `method` |  | the type of correlation coefficient used for the test
| `df` |  | the degrees of freedom (where applicable)
| `corrcoef` |  | the correlation coefficient
| `stat` |  | the test’s statistic
| `dist` |  | the respective distribution for the test
| `alt` |  | the alternative hypothesis for the test

`[…] = correlation_test (…, name, value)` specifies one or more of the following name/value pairs:

| Name | Value
--- | --- | ---
| `"alpha"` | the significance level. Default is 0.05.
| `"tail"` | a string specifying the alternative hypothesis

| `"both"` | corrcoef is not 0 (two-tailed, default)
| `"left"` | corrcoef is less than 0 (left-tailed)
| `"right"` | corrcoef is greater than 0 (right-tailed)

| `"method"` | a string specifying the correlation coefficient used for the test

| `"pearson"` | Pearson’s product moment correlation (Default)
| `"kendall"` | Kendall’s rank correlation tau
| `"spearman"` | Spearman’s rank correlation rho

See also: regression_ftest, regression_ttest

Source Code: correlation_test