Data Input
Paste rows as x, y, weight or x y weight. If you prefer uncertainties, choose "σ mode" and use third column as σ.
Example Data Table
| x | y | weight |
|---|---|---|
| 1 | 1.1 | 1 |
| 2 | 1.9 | 1 |
| 3 | 3.2 | 1 |
| 4 | 3.8 | 0.5 |
| 5 | 5.1 | 2 |
| 6 | 6.0 | 1 |
| 7 | 7.1 | 1 |
| 8 | 7.9 | 0.7 |
| 9 | 9.2 | 1 |
| 10 | 10.0 | 1 |
Results
Enter data and click Compute to see results.
Formula Used
For data points (xi, yi) with weights wi, the weighted sums are
Sw=∑wi, Sx=∑wixi, Sy=∑wiyi, Sxx=∑wixi2, Sxy=∑wixiyi and Δ=SwSxx−Sx2.
The estimates are
a=(SxxSy−SxSxy)/Δ and b=(SwSxy−SxSy)/Δ.
Residual sum of squares: SSE=∑wi(yi−a−bxi)².
Weighted mean of y: \u017By= Sy/Sw; weighted total sum of squares: SST=∑wi(yi−\u017By)²; so R²=1−SSE/SST.
Residual variance (approx.): σ²≈SSE/(n−2). The covariance matrix of [a b]ᵀ is approximately σ²·(XᵀWX)⁻¹ where X has columns [1, x].
If the third column is measurement uncertainty σi, weights are computed as wi=1/σi².
How to Use
- Choose whether your third column is weights or measurement σ.
- Paste rows as x, y, w (w optional). Non-numeric lines are ignored.
- Click Compute to fit y = a + b x using weighted least squares.
- Review slope, intercept, standard errors, R², residuals, and leverage.
- Download your residual table as CSV or export a PDF summary.
- Use example data to see the expected format and outputs.
FAQs
Use weights when some points are more reliable or represent multiple observations. Larger weights give points more influence on the fitted line.
Yes. Choose σ mode and provide σ for each point. The calculator converts them to weights using w = 1/σ².
If the weighted variance of y is near zero, SST≈0 and R² is undefined. With poor fits or limited variation, R² can be very small.
The design becomes singular (Δ≈0). A slope cannot be estimated. Provide varied x values or remove degenerate rows.
We use σ²≈SSE/(n−2), then Var([a b])≈σ²·(XᵀWX)⁻¹. SEs are the square roots of the diagonal variances.
Residuals are weighted in SSE and SST. Leverage uses hi=wi[1 xi](XᵀWX)⁻¹[1 xi]ᵀ, highlighting influential points under weights.