CSV Regression

Fit a simple linear regression and get slope, intercept, R², and residuals.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Pick an X column and a Y column from your CSV and fit a straight line by ordinary least squares. You get the slope, intercept, R-squared, the number of pairs used, and the predicted value and residual for every row.

How to use

1
Step 1
Paste the CSV or drop a file.
2
Step 2
Enter the X column and the Y column.
3
Step 3
Press Process and read the fit and residuals.

How it works

Least squares chooses the line that minimises the sum of squared vertical distances to the points. Slope = covariance(x, y) / variance(x), and the intercept makes the line pass through the means. R-squared is the share of the variance in y that the line explains. Rows with a missing x or y are left out.

y = slope · x + intercept      R² = 1 − SS_res / SS_tot

Worked example

A trend with one outlier

Input
x: 1..7 y: 2.1, 3.9, 6.2, 7.8, 10.1, 12.2, 30
Output
slope 3.7214, intercept -4.5571, R² 0.7414, n 7
Walkthrough
The last point (7, 30) has a residual of 8.51, the largest of all, and pulls the slope up. Without it the slope would be close to 2.

Limitations

  • Simple linear regression with one predictor only.
  • No confidence intervals, p-values or significance tests.
  • Both columns must be numeric; otherwise there is an error.

Questions

How do I run a linear regression on a CSV?
Enter the X and Y column names and press Process. The slope, intercept and R-squared are returned.
What does R-squared mean?
The proportion of the variation in y explained by the line, from 0 to 1.
Does it support multiple regression?
No, one predictor only.
What are residuals?
The difference between each actual y and the value the line predicts.

Features

  • Slope, intercept, R²
  • Per-row residuals
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • What Is A RESTful API?

    Traversy Media

    APIs are how most data tools receive payloads.

    Watch on YouTube
  • Finding mean, median, and mode

    Khan Academy

    Descriptive stats for quick data summaries.

    Watch on YouTube