Loading…

Linear Regression ( Trendline ) and Correlation

Biology • Bio Lab Math and Data Analysis

View all topics

Linear regression (trendline) and correlation

Blanks are ignored. Rows without at least two numeric values are skipped and reported. You can load a CSV/text file and paste/replace the textarea contents.
Auto detects common separators per line. Use a hint if your file is unusual.
You can also drag the \(x_0\) marker on the scatter plot (after calculating) to update the prediction.
Residuals help spot patterns (nonlinearity, changing variance). A random cloud around 0 is a good sign.
Ready

Rate this calculator

0.0 /5 (0 ratings)
Be the first to rate.
Your rating
You can update your rating any time.

Frequently Asked Questions

How does the calculator find the linear regression trendline?

It uses least squares to minimize the sum of squared residuals. The slope is b = Sxy / Sxx and the intercept is a = ybar - b xbar, where Sxy = sum((x - xbar)(y - ybar)) and Sxx = sum((x - xbar)^2).

What is the difference between correlation r and r squared (r^2)?

r measures the strength and direction of a linear association and ranges from -1 to 1. r^2 is the fraction of variability in y explained by a linear model in x for simple linear regression.

How do I predict y at a specific x value (x0)?

Enter x0 in the Predict at x0 field and calculate to get y-hat(x0) = a + b x0. After calculation, you can also drag the x0 marker on the scatter plot to update the prediction.

Why is a residual plot useful for checking a trendline?

Residuals are e = y - y-hat. A good linear fit usually shows residuals scattered around 0 without clear structure, while curvature or a funnel shape can indicate nonlinearity or changing variance.

What happens if all x values are the same?

Then Sxx = 0, so the slope cannot be computed because there is no variation in x. You need at least two distinct x values to fit a regression line.