# Correlation and regression calculator > How strongly are two things related? Pearson's r, Spearman's ρ and the best-fit line of paired data, on a live scatter plot. Paste two columns of paired data to get Pearson's r, Spearman's ρ, the regression line, R² and a p-value, drawn on a scatter plot with residuals. - Page: https://how.box/correlation/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/correlation/?x={x}&y={y}&at={at} - `x` (text): The x values, separated by spaces, line breaks or semicolons. Example: `1 2 3 4`. - `y` (text): The y values, paired with x by position. Example: `52 55 61 58`. - `at` (number -1e12 to 1e12): The x at which to read the line. Example: `12`. Example answer: https://how.box/correlation/?x=1+2+3+4&y=52+55+61+58&at=12 A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `correlation_calculate`: Correlation and simple linear regression of paired data: x and y lists (3 to 500 entries each, same count, paired by position). - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"correlation_calculate","arguments":{"x":"1 2 3 4","y":"52 55 61 58","at":12}}}` - GET: https://how.box/mcp/run/correlation_calculate?x=1+2+3+4&y=52+55+61+58&at=12 ## How it works Correlation measures how closely two quantities move together along a straight line. Pearson's r runs from −1 (a perfect falling line) through 0 (no linear pattern) to +1 (a perfect rising line). Spearman's ρ is the same calculation on the ranks of the values, so it measures any steady rise or fall, not just a straight one, and is less affected by a single extreme point. The best-fit line y = a + b·x is the one that makes the squared vertical distances to the points (the residuals) as small as possible: b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², a = ȳ − b·x̄, where x̄ and ȳ are the means. R², the square of r, is the share of the variation in y that the line accounts for. For the example, hours of study 1 to 10 against exam scores, b = 303 ÷ 82.5 ≈ 3.67 points per hour, a ≈ 47.6 and r ≈ 0.976, so the line explains about 95 % of the spread in scores. The methods follow the NIST/SEMATECH e-Handbook of Statistical Methods. The p-value tests whether the true correlation could be zero, using t = r√((n − 2) ÷ (1 − r²)) with n − 2 degrees of freedom. A strong correlation does not show that one thing causes the other, a curved relationship can have r near 0, and a line should not be trusted far outside the range of the data. ## FAQ **What is a strong correlation?** As a rule of thumb, |r| above 0.7 is strong, 0.3 to 0.7 moderate, 0.1 to 0.3 weak and below 0.1 negligible. What counts as strong also depends on the field: in physics r = 0.9 can be poor, in social science r = 0.4 can matter. **What happens if some cells are not numbers?** The calculator leaves out the whole pair containing a non-number and lists the rejected entry. Check the remaining pairs, since dropping observations can change the relationship. **Should I sort my two columns first?** Keep each x value beside its matching y value. Sorting either column separately changes the pairs and can create a misleading correlation. **Why is no correlation shown when every y value is the same?** Correlation needs variation in both quantities. A constant y still gives a horizontal fitted line, but Pearson’s r and Spearman’s ρ are undefined. **How many pairs can I enter?** Enter between 3 and 500 matching pairs. A small sample can give an unstable result, so inspect the scatter plot as well as the coefficient. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)