線性迴歸擬合

🔮 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。