Back to Portfolio

Linear Regression Playground

Interactive demonstration of the Ordinary Least Squares (OLS) algorithm. Adjust the parameters below to see how the model fits the data in real-time.

Model Parameters

1.0
0.0
2.0
50

Regression Analysis

Model Prediction
Actual Data

Estimated Equation

y = 1.0x + 0.0

Mean Squared Error

0.00

How it works

Linear regression attempts to model the relationship between two variables by fitting a linear equation to observed data. One variable is considered to be an explanatory variable, and the other is considered to be a dependent variable.

The visualizer above generates synthetic data points based on your inputs and adds random Gaussian noise. It then calculates the Line of Best Fit using the least squares method to minimize the sum of the squares of the vertical offsets.