Fit an ordinary least-squares straight line to paired x and y observations.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
The slope is Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)² and the intercept is ȳ minus slope × x̄. Predictions lie on that line, residuals are observed minus predicted, and R² is the squared Pearson correlation for this intercept model.
X values: [1,2,3,4,5] Y values: [2,4,5,4,5]
Slope: 0.6 Intercept: 2.2 R squared: 0.6 Equation: y = 0.6x + 2.2
Calibration exercises fit response against concentration, trend charts overlay a straight line, and classroom datasets inspect residuals.