Intermediate

線性迴歸計算器

利用最小平方迴歸將最佳擬合直線配適到成對資料,並預測新值。
Comma or space separated
Must match the count of X values
Optional
Slope (b)
0.8000

方程式: y = 0.8x + 1.8

Intercept (a)
1.8
0.7273
Predicted y at x = 6
6.6
DataDataDataDataData
Step by step
  1. 1

    Mean of X (x̄)

    sum of X ÷ 5 = 3
  2. 2

    Mean of Y (ȳ)

    sum of Y ÷ 5 = 4.2
  3. 3

    Σ(x − x̄)(y − ȳ)

    8
    Sum of cross-deviations; numerator of the slope formula.
  4. 4

    Σ(x − x̄)²

    10
    Sum of squared x-deviations; denominator of the slope.
  5. 5

    Slope b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)²

    8 ÷ 10 = 0.8000
計算結果僅為一般資訊用途的估算值,並非專業建議——在仰賴重要結果之前,請務必自行獨立查證。 閱讀完整免責聲明.
快速解答

此計算機如何運作?

線性迴歸找出穿過資料的最小平方直線 y = bx + a。斜率 b = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)²,截距 a = ȳ − b·x̄。R² 衡量擬合品質(0 到 1),ŷ = a + b·x 可預測任意 x 的新值。

公式
b = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)²; a = ȳ − b·x̄; ŷ = a + b·x
How this is calculated

以逗號或空格分隔,輸入 X 值和對應的 Y 值;兩個列表的長度必須相同且至少有兩個點。每個 X 與相同位置的 Y 配對形成資料集。

斜率 b 計算為交叉偏差乘積之和 Σ(x−x̄)(y−ȳ) 除以 X 偏差平方和 Σ(x−x̄)²。截距則為 a = ȳ − b·x̄,使直線通過均值點 (x̄, ȳ)。相關係數 r = Σ(x−x̄)(y−ȳ) / √(Σ(x−x̄)²·Σ(y−ȳ)²),R² = r² 表示直線所解釋的 Y 變異比例。

可選的預測欄位在你選擇的任意 X 處計算 ŷ = a + b·x₀。注意最小平方法假設大致線性關係,且對離群值敏感;垂直(X 變異為零)資料集沒有定義的斜率,不返回結果。R² 接近 1 表示緊密擬合,接近 0 則表示幾乎無線性關係。

常見問題

R²(決定係數)是相關係數的平方,範圍從 0 到 1。它是配適直線所解釋的 Y 變異比例;1 代表完美擬合,0 代表無線性關係。

至少需要兩個點來定義一條直線。更多的點可提供更可靠的擬合。X 和 Y 列表必須包含相同數量的值。

這發生在列表少於兩個匹配值、包含非數值輸入,或所有 X 值相同(零變異)使斜率無定義時。

也稱為

線性迴歸
最小平方法
最佳擬合線
迴歸線
斜率截距
regression
迴歸計算機
線性回歸

APA

TG we-Calculate Editorial Team. (2026). 線性迴歸計算器 [Online calculator]. TG we-Calculate. https://we-calculate.com/zh-tw/calculator/linear-regression-calculator

Chicago

TG we-Calculate Editorial Team. "線性迴歸計算器." TG we-Calculate. 2026. https://we-calculate.com/zh-tw/calculator/linear-regression-calculator.

IEEE

TG we-Calculate Editorial Team, "線性迴歸計算器," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/zh-tw/calculator/linear-regression-calculator

BibTeX

@misc{wecalculate_linear_regression_calculator, title = {線性迴歸計算器}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/zh-tw/calculator/linear-regression-calculator}}, year = {2026}, note = {TG we-Calculate} }

這個計算機對您有幫助嗎?