Skip to content
Saha Hesap

Regression and Correlation

Fit a line or polynomial to paired X and Y data and calculate correlation, R² and residual standard deviation.

Association and fitting

Enter paired X and Y lists to calculate linear correlation and an ordinary least squares fit. Degree one fits a straight line. Higher degrees fit polynomials. Correlation r always measures linear association, even when the fitted polynomial has a higher degree.

Using the output

The calculation centers and scales X and solves the fit by QR decomposition. Polynomial coefficients are shown in both x and z = (x − c) / h. For X = 1, 2, 3, 4 and Y = 3, 5, 7, 9 the line is y = 1 + 2x and the residual sum of squares is zero. Residual standard deviation uses the number of observations minus the degree minus one as its divisor.

Limits

Increasing the degree does not by itself improve a model. Inspect outliers and residual patterns. A high R² does not establish causation or reliable future predictions. Constant Y produces undefined r and R². Nearly dependent columns and insufficient distinct X values are rejected.

Frequently asked questions

How do you calculate the correlation coefficient?

The paired data X = 1 2 3 4 5 and Y = 2 4 5 4 5 give a linear correlation coefficient of 0.774596669. Divide the centered cross product sum by the square root of the product of squared deviation sums, keeping the pairs aligned. This example shows a strong but imperfect positive relationship, and correlation does not establish causation and is sensitive to outliers.

Calculate with these values

Related calculators

Found a mistake or something missing?

If a value looks wrong, a size is missing or you need a feature, write to us and we will fix it.

Send an email