殘差平方和(英語:Residual sum of squares,縮寫:RSS)在統計學上是指將所有做預測時的誤差值平方加起來得出的數: R S S = ∑ i = 1 n e i 2 {\displaystyle RSS=\sum _{i=1}^{n}e_{i}^{2}\,} 此條目可參照英語維基百科相應條目來擴充。 (2021年1月4日) 它是衡量數據與估計模型之間差異的尺度。較小的殘差平方和表示模型能良好地擬合數據。在確定參數和選擇模型時,殘差平方和是一種最優性準則。通常,總的方差=已經被模型解釋了的平方和+殘差平方和。 殘差平方和這個數值在機器學習上是普通最小二乘法等演算法的重心。 Remove ads與皮爾遜相關係數的關係 對於兩變量x和y, 它們的數據組的均值分別記為 x ¯ , y ¯ {\displaystyle {\bar {x}},{\bar {y}}} ,則兩數據組的皮爾遜相關係數為 r = S x y S x x S y y {\displaystyle r={\frac {S_{xy}}{\sqrt {S_{xx}S_{yy}}}}} ,其中, S x y = ∑ i = 1 n ( x ¯ − x i ) ( y ¯ − y i ) {\displaystyle S_{xy}=\sum _{i=1}^{n}({\bar {x}}-x_{i})({\bar {y}}-y_{i})} ; S x x = ∑ i = 1 n ( x ¯ − x i ) 2 {\displaystyle S_{xx}=\sum _{i=1}^{n}({\bar {x}}-x_{i})^{2}} ; S y y = ∑ i = 1 n ( y ¯ − y i ) 2 {\displaystyle S_{yy}=\sum _{i=1}^{n}({\bar {y}}-y_{i})^{2}} . 給定最小二乘回歸線方程為 y ^ = a x + b = f ( x ) {\displaystyle {\hat {y}}=ax+b=f(x)} , 其中 b = y ¯ − a x ¯ {\displaystyle b={\bar {y}}-a{\bar {x}}} ; a = S x y S x x {\displaystyle a={\frac {S_{xy}}{S_{xx}}}} . 則這時殘差平方和可以表示為: RSS = ∑ i = 1 n ( y i − f ( x i ) ) 2 = ∑ i = 1 n ( y i − ( a x i + b ) ) 2 = ∑ i = 1 n ( y i − a x i − y ¯ + a x ¯ ) 2 = ∑ i = 1 n ( a ( x ¯ − x i ) − ( y ¯ − y i ) ) 2 = a 2 S x x − 2 a S x y + S y y = S y y − a S x y = S y y ( 1 − S x y 2 S x x S y y ) {\displaystyle {\begin{aligned}\operatorname {RSS} &=\sum _{i=1}^{n}(y_{i}-f(x_{i}))^{2}=\sum _{i=1}^{n}(y_{i}-(ax_{i}+b))^{2}=\sum _{i=1}^{n}(y_{i}-ax_{i}-{\bar {y}}+a{\bar {x}})^{2}\\[5pt]&=\sum _{i=1}^{n}(a({\bar {x}}-x_{i})-({\bar {y}}-y_{i}))^{2}=a^{2}S_{xx}-2aS_{xy}+S_{yy}=S_{yy}-aS_{xy}=S_{yy}\left(1-{\frac {S_{xy}^{2}}{S_{xx}S_{yy}}}\right)\end{aligned}}} 通過皮爾遜相關係數的公式,可以得到 RSS = S y y ( 1 − r 2 ) {\displaystyle \operatorname {RSS} =S_{yy}(1-r^{2})} . Remove adsLoading related searches...Wikiwand - on Seamless Wikipedia browsing. On steroids.Remove ads