Coefficient of Determination Calculator
Fit a simple least-squares line to paired data and measure how much of the sample variation in Y is explained by X.
Paired data
Use a decimal point for fractional values. Enter at least 3 complete X – Y pairs; up to 30 pairs are supported.
Excel export is ready for the current example.
Regression results
75.00% of the sample variation in Y is explained by the fitted linear relationship with X.
Observed points and fitted line
The line explains 75.00% of the observed sample variation in Y. Points farther from the line contribute more to SSE because residuals are squared.
Point-by-point fit details
| Point | X | Y | Fitted Y | Residual | Residual² |
|---|---|---|---|---|---|
| 1 | 0.0000 | 1.0000 | 1.5000 | -0.5000 | 0.2500 |
| 2 | 2.0000 | 4.0000 | 3.0000 | 1.0000 | 1.0000 |
| 3 | 4.0000 | 4.0000 | 4.5000 | -0.5000 | 0.2500 |
Residual = observed Y – fitted Y. The squared residuals sum to SSE, while SSR + SSE equals SST for this least-squares model with an intercept.
How to use this coefficient of determination calculator
What this calculator does
This calculator fits the simple least-squares regression model ŷ = b₀ + b₁x to paired X and Y observations, then reports the coefficient of determination R². R² is the fraction of the observed sample variation in Y accounted for by the fitted linear relationship with X. It is a goodness-of-fit summary for this specific linear model; it does not prove causation, guarantee accurate future predictions, or establish that a linear model is the best possible description of the data. Penn State's regression notes define R² as SSR/SST and also as 1 – SSE/SST in a regression with an intercept; see the coefficient of determination section in STAT 501.
When to use it
Use the calculator when you want to summarize the strength of a straight-line relationship between two quantitative variables, check a classroom or hand-worked regression exercise, compare the fit of alternative linear specifications on the same response data, or inspect how individual residuals contribute to lack of fit. If the scatter plot is strongly curved, contains influential outliers, or mixes distinct groups, R² alone can be misleading.
How to calculate
- The calculator opens with three demonstration points: (0, 1), (2, 4), and (4, 4). The corresponding results and a validated Excel workbook are available immediately.
- Replace the X and Y values with your own paired observations. Both entries in a row must be complete. Use a period as the decimal separator; signed decimal values are accepted.
- Use Add point to append observations, up to 30 pairs. Clear a row with its Clear button; added blank rows are ignored until one side is filled.
- Read R² together with the regression equation, Pearson r, sums of squares, scatter plot, and residual table. These views update from the same current data model.
- Select Download Excel to export the current inputs and results as a real .xlsx workbook. Reset clears the demonstration data, results, added rows, and workbook state; Excel export stays disabled until at least three valid paired observations with usable variation are entered again.
Input guide
Paired data is the only statistical input collection. Each row contains an X value and its corresponding Y value; both are required for that row to count. Values may be positive, zero, or negative and may contain a decimal point, for example X = 2.5 and Y = – 1.2. At least three complete points are required. The X values cannot all be identical because a regression slope would be undefined, and the Y values cannot all be identical because SST would be zero, making R² undefined. Do not paste thousands separators, percent signs, units, or scientific notation into the fields. Adding points can increase or decrease R² depending on how closely the new observations align with the fitted line; a point far from the line usually increases SSE and can reduce R².
Output guide
Coefficient of determination, R² is shown as a decimal from 0 to 1 for this simple least-squares model. Explained variance is the same quantity expressed as a percentage, while Unexplained variance is 100% – R²×100%. Pearson correlation, r retains the direction of the linear relationship; in simple regression with an intercept, r² equals R². Mean of Y is the baseline response average. SSE sums squared residuals, SSR measures variation explained by the fitted line, and SST measures total variation around the Y mean. Point count is the number of complete pairs used. Fitted line gives the intercept and slope. The Observed points and fitted line chart shows the same observations and regression line, and the table lists each X, Y, fitted Y, residual, and squared residual. NIST's linear least-squares regression guidance provides broader context on least-squares fitting.
Worked example
For the startup data (0, 1), (2, 4), and (4, 4), the mean Y is 3. The least-squares line is ŷ = 1.5000 + 0.7500x, giving fitted Y values 1.5, 3.0, and 4.5. The residuals are – 0.5, 1.0, and – 0.5, so SSE = 0.25 + 1 + 0.25 = 1.5. SST = (1 – 3)² + (4 – 3)² + (4 – 3)² = 6. Therefore R² = 1 – 1.5/6 = 0.75, or 75.00% explained variation. The Pearson correlation is approximately 0.8660, whose square is also 0.75.
How to interpret R² responsibly
A larger R² means the fitted line accounts for more variation in the observed Y values, but “larger” is not automatically “better” in every application. The practical adequacy of a model depends on the field, measurement noise, intended decision, and whether the linear-model assumptions are reasonable. A high R² can coexist with curvature, outliers, extrapolation risk, or a relationship driven by a narrow data range. Conversely, a modest R² may still accompany a meaningful effect in noisy real-world data.
Inspect the scatter plot and residual table rather than treating R² as a standalone score. If residuals show a systematic pattern, the straight-line model may be missing structure. Penn State's discussion of R² cautions and correlation emphasizes that linear summaries can miss curvilinear relationships. For a concise formula-oriented definition, the NIST statistical glossary describes R-squared in terms of squared residuals relative to deviations from the mean.