METHOD / WORKED GUIDE
A useful fit starts
with visible assumptions.
Fitline answers one arithmetic question: which straight line, with an intercept, gives the smallest sum of squared vertical residuals for the numeric pairs you enter? It keeps the data, fitted values and remaining differences together.
Start with one meaning for each column
Each nonblank row contains an x value followed by its corresponding y value. Choose a comma or whitespace between them, and enter the pair only once unless you intend repeated rows to count again. All x values must use the same unit, and all y values must use the same unit. The two variables can have different units: a slope then has y-units per x-unit. Fitline does not convert physical units or infer what a column measures.
The input accepts two to one hundred pairs. These are software limits, not a recommendation for a study size. Signed plain decimal numbers may have up to nine decimal places and absolute value at most one billion. Enter a leading zero in a value such as 0.25. Headers, unit suffixes, thousands separators and exponent notation are rejected. Blank lines are ignored; incomplete or extra-column rows are rejected rather than silently repaired.
What the line minimises
Write the fitted value as ŷ = a + bx. For one observation, its residual is the entered y minus that fitted value. A positive residual means the observation lies above the line at its x coordinate. A negative residual means it lies below. Squaring each residual and adding those squares gives SSE. The selected coefficients minimise that total over lines of this form.
a = ȳ − bx̄
residual = y − (a + bx)
The implementation uses equivalent sum-and-product rational equations. It treats each permitted decimal string as an exact fraction. For example, 0.1 is represented as one tenth rather than an approximate binary floating-point input. This avoids cancellation from subtracting large approximate sums. It does not make an uncertain measurement more precise, remove outliers, or decide that a straight line is a suitable description.
Worked example: three pairs, one residual total
The restored example is (1,2), (2,3) and (3,5). Its x mean is 2 and its y mean is 10/3. The sum of centred x/y products is 3; the sum of squared centred x values is 2. The resulting slope is 3/2, and the intercept is 1/3. Thus the line is ŷ = 1/3 + (3/2)x.
At the three entered x values, the fitted values are 11/6, 10/3 and 29/6. Subtracting them from the entered y values produces residuals 1/6, −1/3 and 1/6. Their sum is zero, and their squared sum is 1/6. The displayed rounded coefficients are convenient to read, while the exact fractions in the result and local report let you reproduce the arithmetic without rounding each intermediate step.
What R² describes, and when it is unavailable
For this model with an intercept, Fitline computes R² as 1 − SSE/SST, where SST is the sum of squared differences between each y and the entered y mean. The three-pair example has SST = 14/3 and R² = 27/28, approximately 0.9642857143. This compares the fitted line's residual total with the constant-mean comparison for these particular rows.
R² is not a probability that the line is correct. It is not a percentage of future observations that will be predicted accurately, and it does not supply the sign of the slope. An exact downward line can also have R² = 1. Read the slope and the plotted data rather than treating one statistic as a complete description.
If every entered y is 7 but the x values include 0,1 and 2, the fitted line is a = 7 and b = 0, with SSE = 0. SST is also zero, so the R² ratio is undefined. The tool reports R² as unavailable instead of choosing an arbitrary zero or one. The constant line and its residuals remain usable arithmetic results.
Repeated x values and repeated rows
Different observations can share an x value. For example, (1,1), (1,3) and (3,5) produce a = 1/2 and b = 3/2. The fitted y at x = 1 is 2, so those two observations have residuals −1 and +1. The third has residual zero; SSE is 2. The tool retains all three observations, even when two x coordinates coincide on the drawing.
By contrast, if every x is identical, a unique slope cannot be found for a line of the requested form. A vertical arrangement can be drawn, but it is not a unique y = a + bx fit. Fitline rejects this state and clears usable outputs. It does not silently switch to vertical regression or add an artificial difference to the x values.
Line evaluation is a separate conditional calculation
The optional evaluation field substitutes one x into the fitted equation. Leave it blank when you do not need that calculation; blank does not mean x = 0. With the example fit, entering x = 10 gives 46/3. Because ten is outside the entered range of one through three, the result is labelled outside range. This label identifies the arithmetic context; it does not certify whether a real process follows the line there.
Even an evaluation within the observed range can be unsuitable for a real decision if the model, measurements or sampling are inappropriate. Fitline supplies no prediction interval, confidence interval, significance test or uncertainty estimate. It does not choose data exclusions, establish causation or validate a forecasting, medical, financial or engineering decision.
Read the drawing alongside the table
The local diagram places each entered pair as a point and draws the fitted line only across the entered x range. Dashed segments illustrate vertical residuals. The plot is a drawing of numeric inputs, without a measured physical scale or uncertainty bands. Normalised coordinates are rounded for display, so very close points can overlap. The per-row table and exact text/CSV remain the reference for their distinct values.
The chart handles a constant y range by centring the row of points rather than dividing by zero. A graph that looks flat at a particular screen width does not imply an exact zero slope; inspect the coefficient's fraction. Values smaller than the ten-place decimal display can round to zero while their exact fraction remains nonzero.
What local reports retain
Copy and Text include the exact coefficients, SSE, R² availability, entered range, optional evaluation and every row's fitted value and residual. CSV uses one record per input row with explicit exact-value column names and repeats the shared model coefficients for convenient reference. Fractions in those fields are fraction strings; software importing CSV may apply its own automatic date or number formatting. Set those columns to text if you want to preserve their literal form.
The calculator uses no account, file upload, cloud document or stored data session. A download is generated in your browser, and Copy uses the browser clipboard with a selectable-text fallback if clipboard access is blocked. Restoring the example, reloading or closing the page can discard current entries. Your browser may separately remember form values under its own preferences.
Mathematical references
The least-squares criterion and straight-line coefficient equations were checked against the NIST/SEMATECH Engineering Statistics Handbook. The mathematical definitions of residuals and R² were cross-checked with OpenStax's regression chapter. This tool's code, examples, diagrams and explanatory prose are original; no endorsement or statistical certification is claimed.