QCSunny Lab

Polynomial Regression多项式回归拟合

Paste points as "x, y" per line (spaces, commas or semicolons all separate). Degree 1 is plain linear regression.每行一个 "x, y" 点(逗号、空格、分号均可作分隔)。1 次即普通线性回归。

Fit a polynomial of degree 1–5 to (x, y) points by least squares: normal equations solved with partial-pivot Gaussian elimination, reported as the fitted equation, R², RMSE and per-degree coefficients.

Degree 1 is plain linear regression (same answers as the Descriptive Statistics tool); higher degrees trade extrapolation safety for local fit — watch RMSE, not just R², before believing a degree-5 curve through 6 points.

Frequently asked questions

Why does it refuse to fit sometimes?

The normal equations become singular when there are not enough distinct x values (or fewer points than coefficients) — the message says so instead of returning garbage coefficients.

Should I always pick the highest degree?

No. A degree-5 polynomial through 6 points has zero residual and zero predictive value. Prefer the lowest degree whose RMSE stops improving meaningfully.

中文说明

对 (x, y) 数据点做 1–5 次多项式最小二乘拟合:正规方程经列主元高斯消元求解,输出拟合方程、R²、RMSE 与各次系数。

1 次即普通线性回归(与描述统计工具同答案);更高次数用外推安全性换局部拟合——相信一条穿过 6 个点的 5 次曲线之前,先看 RMSE 而不只是 R²。

常见问题

为什么有时拒绝拟合?

当 x 取值不够分散(或点数少于系数个数)时正规方程奇异——工具会如实提示,而不是给出垃圾系数。

次数越高越好吗?

不是。穿过 6 个点的 5 次多项式残差为零、预测价值也为零。选 RMSE 不再明显下降的最低次数。