Correlation
stats_correlationCompute Pearson or Spearman correlation between two paired variables to quantify their linear or monotonic relationship.
Instructions
Compute Pearson or Spearman correlation between two paired variables.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | First variable (numeric observations; same length as y). | |
| y | Yes | Second variable (numeric observations; same length as x). | |
| method | No | Correlation method: 'pearson' or 'spearman'. | pearson |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | Yes | Number of paired observations. | |
| method | Yes | Correlation method used. | |
| p_value | Yes | p-value for the correlation. | |
| statistic | Yes | Correlation coefficient (r for Pearson, rho for Spearman). |