{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"correlation"},"result":{"entity_type":"calculator","id":"correlation","calculator_id":"correlation","canonical_url":"https://tttkmbb.com/statistics/correlation","name":"Correlation Coefficient Calculator","title":"Correlation Calculator – Pearson r, R² and Covariance of Two Variables","category":"statistics","category_name":"Statistics & Probability","tool_name":"calculate_correlation","featured_mcp_tool":false,"description":"Computes the Pearson product-moment correlation coefficient r, the coefficient of determination r², and the sample covariance for two paired lists of numbers, with a strength/direction interpretation.","use_when":"You have paired measurements of two numeric variables and want to quantify the strength and direction of their linear relationship.","do_not_use_when":"You need the fitted line or predictions (use linear-regression), the relationship is clearly non-linear or the data are ranks/ordinal (Spearman's rank correlation is more appropriate), or you only have one variable (use descriptive-statistics).","inputs":[{"name":"x_values","label":"x values","type":"number_list","required":true,"description":"Independent (explanatory) variable, one number per observation.","example":[1,2,3,4,5]},{"name":"y_values","label":"y values","type":"number_list","required":true,"description":"Dependent (response) variable, in the same order as x_values.","example":[2,4,5,4,5]}],"outputs":[{"name":"sample_size","label":"Number of pairs (n)","type":"integer","decimals":4,"description":"Number of (x, y) pairs."},{"name":"pearson_r","label":"Pearson r","type":"number","decimals":4,"description":"Linear correlation coefficient between −1 and 1."},{"name":"r_squared","label":"R²","type":"number","decimals":4,"description":"Coefficient of determination: fraction of the variance in y explained by a linear relationship with x."},{"name":"covariance","label":"Sample covariance","type":"number","decimals":4,"description":"Σ(x − x̄)(y − ȳ) / (n − 1)."},{"name":"interpretation","label":"Interpretation","type":"string","decimals":4,"description":"Strength (very weak < 0.2, weak < 0.4, moderate < 0.6, strong < 0.8, very strong ≥ 0.8 in |r|) and direction."}],"input_schema":{"type":"object","properties":{"x_values":{"description":"Independent (explanatory) variable, one number per observation.","type":"array","items":{"type":"number"},"minItems":3,"examples":[[1,2,3,4,5]]},"y_values":{"description":"Dependent (response) variable, in the same order as x_values.","type":"array","items":{"type":"number"},"minItems":3,"examples":[[2,4,5,4,5]]}},"additionalProperties":false,"required":["x_values","y_values"]},"output_schema":{"type":"object","properties":{"sample_size":{"description":"Number of (x, y) pairs.","type":"integer"},"pearson_r":{"description":"Linear correlation coefficient between −1 and 1.","type":"number"},"r_squared":{"description":"Coefficient of determination: fraction of the variance in y explained by a linear relationship with x.","type":"number"},"covariance":{"description":"Σ(x − x̄)(y − ȳ) / (n − 1).","type":"number"},"interpretation":{"description":"Strength (very weak < 0.2, weak < 0.4, moderate < 0.6, strong < 0.8, very strong ≥ 0.8 in |r|) and direction.","type":"string"}}},"formula":"r = Σ(x − x̄)(y − ȳ) / √(Σ(x − x̄)² · Σ(y − ȳ)²); r² = r × r; covariance = Σ(x − x̄)(y − ȳ) / (n − 1)","method":"Pearson's r measures linear association only; the strength bands follow the common convention (Evans 1996) and are a rough guide, not a significance test. r is undefined when either variable is constant.","sources":[{"name":"Wikipedia – Pearson correlation coefficient","url":"https://en.wikipedia.org/wiki/Pearson_correlation_coefficient","type":"reference","retrieved_at":"2026-09-23"},{"name":"NIST/SEMATECH e-Handbook of Statistical Methods, 4.1.4.1 Linear Least Squares Regression","url":"https://www.itl.nist.gov/div898/handbook/pmd/section1/pmd141.htm","type":"government","retrieved_at":"2026-09-23"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"x = 1..5, y = 2, 4, 5, 4, 5","inputs":{"x_values":[1,2,3,4,5],"y_values":[2,4,5,4,5]},"expected":{"sample_size":5,"pearson_r":0.7746,"r_squared":0.6,"covariance":1.5,"interpretation":"Strong positive linear correlation"},"url":"https://tttkmbb.com/api/v1/calculate/correlation?x_values=1%2C2%2C3%2C4%2C5&y_values=2%2C4%2C5%2C4%2C5"},{"name":"Perfect negative relationship","inputs":{"x_values":[1,2,3,4],"y_values":[10,8,6,4]},"expected":{"pearson_r":-1,"r_squared":1,"covariance":-3.3333,"interpretation":"Perfect negative linear correlation"},"url":"https://tttkmbb.com/api/v1/calculate/correlation?x_values=1%2C2%2C3%2C4&y_values=10%2C8%2C6%2C4"}],"faq":[{"q":"Does correlation imply causation?","a":"No. A high |r| shows that the variables move together linearly; it says nothing about which causes which or whether a third variable drives both."},{"q":"Is a given r statistically significant?","a":"That depends on n: the test statistic t = r·√((n − 2) / (1 − r²)) is compared with a t distribution with n − 2 degrees of freedom. For n = 5, |r| must exceed about 0.88 to be significant at the 5 % level."}],"tags":["correlation coefficient","pearson r","r squared","covariance","correlation between two variables"],"related":[{"calculator_id":"linear-regression","reason":"Fit the least-squares line and predict y from x."},{"calculator_id":"descriptive-statistics","reason":"Summary statistics of a single variable."}],"links":{"html":"https://tttkmbb.com/statistics/correlation","markdown":"https://tttkmbb.com/statistics/correlation.md","json":"https://tttkmbb.com/statistics/correlation.json","api":"https://tttkmbb.com/api/v1/calculate/correlation","schema":"https://tttkmbb.com/api/v1/calculators/correlation","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:23:56Z","next_actions":[{"tool":"run_calculator","calculator_id":"correlation","reason":"Run Correlation Coefficient Calculator with the inputs above."}],"links":{"markdown":"https://tttkmbb.com/statistics/correlation.md"}}