Calculates covariance between two numerical datasets to measure their linear relationship. Access via MCP in Cursor or Windsurf, or REST at `/v1/stats/covariance`. Pass two arrays of equal length — returns precise covariance value showing how variables change together. Essential for correlation analysis and portfolio risk assessment.
curl "https://tinyfn.io/v1/stats/covariance" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/stats/covariance', {
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/covariance',
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 equal-length arrays to the covariance tool in your MCP-enabled editor. The tool returns the exact covariance value showing linear relationship strength.
Positive covariance means variables tend to increase together, negative means one increases as the other decreases. Zero indicates no linear relationship.
Yes, both datasets must have identical length. Mismatched arrays will return an error since covariance requires paired observations.
Covariance shows direction of relationship but not strength (units matter). Correlation normalizes this to -1 to +1 range for easier interpretation.
Absolutely. Covariance between asset returns helps assess diversification benefits and portfolio risk in quantitative finance models.
Get your free API key and start using Calculate Covariance in seconds.
Get Free API Key