线性回归拟合

🔮 Linear Regression Fit Calculator

Enter paired (x, y) sample data to fit the line y = ax + b by least squares, output the slope a, intercept b, correlation and goodness of fit, and predict y for any x.

📐 计算公式 / 原理
斜率 a = (nΣxy − ΣxΣy) / (nΣx² − (Σx)²);截距 b = (Σy − aΣx) / n;预测 ŷ = a·x + b
用最小二乘法对 5 对 (x, y) 样本拟合直线 y = ax + b:斜率 a 由 x、y 的协方差与 x 的方差之比求得,截距 b 保证回归线过样本均值点 (x̄, ȳ)。代入任意 x 即可预测 ŷ,用于趋势分析与数据建模。

📐 计算公式与说明

a = (nΣxy − ΣxΣy) / (nΣx² − (Σx)²)
b = (Σy − aΣx) / n

输入成对数据,可指定任意 x 预测 y。

📚 深度解析:统计功效与效应

💡 常见使用场景

功效估算
α=0.05、n=30/组、d=0.5:功效≈0.48,偏低(易漏检);增至 n=64/组 功效≈0.80 达标。
效应越大功效越高
d=0.8、n=30:功效≈0.86,已足。

❓ 常见问题(FAQ)

功效是什么?
真实效应存在时正确拒绝原假设的概率(1−β);通常要求 ≥0.8。
α、n、d、功效四者关系?
给定三者可求第四者;设计时常固定 α 与目标功效,反推所需 n 或 detectable d。