← Math & statistics

Linear Regression & Correlation

Paste x,y[,w] or upload a CSV to run OLS, WLS, or robust Theil–Sen. Inspect 95% confidence/prediction bands, residuals vs fitted values, t/F tests, CSV/LaTeX exports, and a transparent step log in one view.

Other languages 日本語 | English | 简体中文 | 繁體中文 | 繁體中文(香港) | Español | Español (LatAm) | Español (México) | Português (Brasil) | Português (Portugal) | Bahasa Indonesia | Tiếng Việt | 한국어 | Français | Deutsch | Italiano | Русский | हिन्दी | العربية | বাংলা | اردو | Türkçe | ไทย | Polski | Filipino | Bahasa Melayu | فارسی | Nederlands | עברית | Čeština

Input & options

Summary

Run the calculation to see metrics and the step log.

MetricValue

How it’s calculated

    Visualisation

    Scatter plot, regression line, and 95% bands
    Residuals vs fitted values to spot patterns and leverage

    Teacher notes

    How to use this regression calculator

    Paste paired x,y data, check the decimal and separator settings, then choose the estimator and intercept rule you want to compare. The page is built to show both the fitted line and the diagnostics that explain whether the model is actually useful.

    Start with the input format

    Use one row per observation. If your locale uses commas for decimals, confirm that the separator setting still matches the dataset, otherwise the parser can split one number into two columns by mistake.

    How to read the result

    The summary table reports slope, intercept, correlation, and fit statistics. The scatter plot shows whether the line is visually plausible, while the residual plot helps you spot curvature, outliers, or changing variance.

    When to switch method

    Use OLS for the default least-squares fit, WLS when weights are meaningful, and Theil-Sen when you want a more robust slope against outliers. Comparing the methods is often more informative than looking at one fit in isolation.

    Common mistakes to avoid

    Related tools

    FAQ

    How is Weighted Least Squares implemented?

    We recompute weighted means and covariances using w, derive the fitted line, and propagate weights to residual sums and Cook’s distance so diagnostics reflect the weighting scheme.

    What does the shareable URL include?

    The URL stores decimal, delimiter, estimator, intercept, and band options. Data is not embedded, so share the dataset separately when collaborating.

    Why is the dataset not included in the shareable URL?

    The URL stores parsing and model options only. That keeps links short and avoids accidental disclosure of data you may not want embedded in a public address bar.

    Why can a fit with high R² still be misleading?

    R² only summarizes how much of the variance is explained by the fitted line. A high R² can still hide outliers, curvature, grouped structure, or residual patterns that tell you the linear model is incomplete.

    When should I use Theil-Sen instead of OLS?

    Use Theil-Sen when a few outliers strongly tilt the ordinary least-squares line or when you want a robust slope for exploratory analysis. It is slower, but it is often easier to defend on noisy classroom or field data.

    How to interpret the diagnostics

    Slope and intercept

    The slope tells you how much y changes for one unit of x under the fitted model. The intercept is meaningful only if x = 0 is a sensible point in your context, so do not over-interpret it automatically.

    Residual plot

    Use the residual plot to check whether the line leaves a pattern behind. Curvature, fan shapes, or a few extreme points usually matter more than one summary number.

    Bands and uncertainty

    The confidence band is about the mean fitted line, while the prediction band is about future observations. If you are teaching the difference, turning both on and off is often the clearest demonstration.

    Teacher note

    This page works best when students compare the raw scatter, the fitted line, and the residual view together. The model is only trustworthy when those three views tell a coherent story.

    How it’s calculated

    • Fits OLS/WLS or Theil–Sen to your x,y[,w] data and computes slope/intercept.
    • Diagnostics include 95% bands, residuals and tests; CSV/LaTeX are derived from the same model.
    • The URL or file export preserves the dataset and options to reproduce results.