Computes the Pearson correlation coefficient between two datasets, measuring linear relationship strength from -1 to 1. Access via MCP in Cursor or Windsurf for data analysis workflows, or call GET /v1/stats/correlation with your arrays. Returns precise correlation values plus significance testing — essential for validating feature relationships in ML pipelines.
curl "https://tinyfn.io/v1/stats/correlation" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/correlation', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/stats/correlation',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's statistics tools:
{
"mcpServers": {
"tinyfn-stats": {
"url": "https://tinyfn.io/mcp/stats",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Pass two arrays of equal length to the correlation tool. It returns the Pearson coefficient (-1 to 1), p-value, and sample size for statistical significance testing.
Strong negative linear relationship — as one variable increases, the other decreases predictably. Values closer to ±1 indicate stronger relationships, 0 means no linear correlation.
The tool requires complete data pairs. Remove or interpolate missing values before calling the correlation function to avoid calculation errors.
This tool calculates Pearson correlation for linear relationships. Pearson assumes normal distribution and measures linear correlation, while Spearman handles non-linear monotonic relationships.
Agents can validate feature relationships, identify redundant variables for dimensionality reduction, or assess model assumptions by correlating predictions with actual values in real-time.
Get your free API key and start using Calculate Correlation in seconds.
Get Free API Key