Home · Fantasy Tools

📈 Regression Analysis Sandbox

Bring your own two columns of numbers — a pitcher's spin rate against contact rate, a quarterback's passing velocity against a coverage grade, any pair of measurements you have collected yourself — and this sandbox fits the straight line that best describes them, shows its work, and charts it. It loads none of this site's data files and claims none of this site's data: every number on this page is computed in your browser from the points you type or paste, and nothing is uploaded, stored or sent anywhere.

The method — ordinary least squares (OLS), exactly as computed:
x̄ = Σx ÷ n and ȳ = Σy ÷ n (the two means).
Slope b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²
Intercept a = ȳ − b·x̄
Pearson r = Σ(x − x̄)(y − ȳ) ÷ √( Σ(x − x̄)² × Σ(y − ȳ)² ), and r² = r × r.
Fitted value ŷ = a + b·x; residual = y − ŷ.
r² reads as the share of the variation in y that this straight line accounts for in the points you supplied. It describes your sample; it does not prove that x causes y, and a line fitted to a handful of points is a description, not a forecast.
Worked example check: the pre-filled sample points (1, 2), (2, 3), (3, 5), (4, 4), (5, 6) give x̄ = 3 and ȳ = 4, Σ(x − x̄)(y − ȳ) = 9, Σ(x − x̄)² = 10 and Σ(y − ȳ)² = 10, so slope = 0.9000, intercept = 1.3000, r = 0.9000, r² = 0.8100. If your screen shows exactly that with the sample in place, the arithmetic is working.

The pre-filled points are illustrative sample data — five made-up points chosen so the arithmetic can be checked by hand. They are not measurements of anything. Delete them and paste your own: one point per line, the first two numbers on a line are x and y (commas, tabs, semicolons or spaces all work, so pasting a small CSV is fine — a header row is skipped automatically, and any words on a line are kept as that point's label). Plain decimal numbers only; thousands separators are not read.

Your data

Result — ordinary least squares

Chart — scatter & fitted line

Points, fitted values & residuals

#Labelxyŷ (fitted)Residual (y − ŷ)
Reading your points…

The CSV export carries your points with their fitted values and residuals; the PNG export is the chart above, exactly as drawn. Both are generated in your browser from your own numbers — this page has no data of its own to export.

About the Regression Analysis Sandbox

The Regression Analysis Sandbox fits the straight line that best describes two columns of numbers you bring yourself — a pitcher's spin rate against contact rate, a quarterback's passing velocity against a coverage grade, any paired measurements you have collected. Paste the pairs (or a small CSV), and the sandbox computes the ordinary least-squares line, draws the scatter with the fitted line on canvas, and lets you predict ŷ at any x.

Every formula is printed on the page and the arithmetic is checkable by hand: the means x̄ and ȳ, the slope b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², the intercept, and the correlation r and r² that say how much of the variation in y the line accounts for. The page opens with a pre-filled five-point sample, labelled illustrative, whose results you can verify with a pencil: slope 0.9000, intercept 1.3000, r 0.9000, r² 0.8100 — and a perfect-line check returns r = 1.0000. Your chart exports as a PNG and your data with its fitted values as a CSV.

The sandbox is deliberately honest about its scope: it loads none of this site's data files and claims none of this site's data. Every number on the page is computed in your browser from the points you type or paste; nothing is uploaded, stored or sent anywhere. It fits one straight line to one pair of variables — it does not establish causation, and r² says how tightly the points hug the line, not whether x causes y. Bring good measurements and it will show you, precisely, what they say.

Frequently asked questions

What does the Regression Analysis Sandbox compute?

An ordinary least-squares (OLS) fit on your own paired data: slope, intercept, the correlation r and r², a scatter chart with the fitted line, a ŷ-at-x predictor, and PNG/CSV exports. All formulas are printed on the page.

Does the sandbox use this site's player data?

No. It runs entirely on the numbers you type or paste (or a small CSV), computed in your browser; nothing is uploaded or stored. The pre-filled five points are a labelled illustrative sample whose arithmetic you can check by hand.