残差平方和

残差平方和

残差平方和

此条目可参照英语维基百科相应条目来扩充。 (2021年1月4日)若您熟悉来源语言和主题,请协助参考外语维基百科扩充条目。请勿直接提交机械翻译,也不要翻译不可靠、低品质内容。依版权协议,译文需在编辑摘要注明来源,或于讨论页顶部标记{{Translated page}}标签。

残差平方和(residual sum of squares,缩写:RSS)在统计学上是指将所有做预测时的误差值平方加起来得出的数:

R S S = ∑ i = 1 n e i 2 {\displaystyle RSS=\sum _{i=1}^{n}e_{i}^{2}\,} 906768373f696bf4c8cd115e3ca8f7fad5ae3a46.svg_-1

它是衡量数据与估计模型之间差异的尺度。较小的残差平方和表示模型能良好地拟合数据。在确定参数和选择模型时,残差平方和是一种最优性准则。通常,总的方差=已经被模型解释了的平方和+残差平方和。

残差平方和这个数值在机器学习上是普通最小二乘法算法的重心。

与皮尔逊相关系数的关系

对于两变量x和y, 它们的数据组的均值分别记为 x ¯ , y ¯ {\displaystyle {\bar {x}},{\bar {y}}} db179b1f7c0b394fec0b825e99ab2b0ac30258bb.svg_,则两数据组的皮尔逊相关系数为 r = S x y S x x S y y {\displaystyle r={\frac {S_{xy}}{\sqrt {S_{xx}S_{yy}}}}} b75e9bb6cb9aa0b543c741b69ce51fa59f4173c5.svg_,其中, 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})} f01705374639e5ea817e2f5345563322ba3f109c.svg_ S x x = ∑ i = 1 n ( x ¯ − x i ) 2 {\displaystyle S_{xx}=\sum _{i=1}^{n}({\bar {x}}-x_{i})^{2}} 97b7d765e2dd15bbb39da15a3f10d6fe1c414488.svg_ S y y = ∑ i = 1 n ( y ¯ − y i ) 2 {\displaystyle S_{yy}=\sum _{i=1}^{n}({\bar {y}}-y_{i})^{2}} 9d6b97e6557990211a1cf6d82f7df54acc1bb7a3.svg_.

给定最小二乘回归线方程为 y ^ = a x + b = f ( x ) {\displaystyle {\hat {y}}=ax+b=f(x)} ee05a31a19b7834162871a022a9e8ff2eb78caf6.svg_, 其中 b = y ¯ − a x ¯ {\displaystyle b={\bar {y}}-a{\bar {x}}} 59e305cf105d5bba1e0e6fd0630d7f53bdd9199c.svg_ ; a = S x y S x x {\displaystyle a={\frac {S_{xy}}{S_{xx}}}} b1ca58b68cf4a01b636b1249ae4d61fcaddb31cc.svg_. 则这时残差平方和可以表示为:

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}}} 5836407a2da838f1c020ae822005a218a92daa56.svg_

通过皮尔逊相关系数的公式,可以得到 RSS = S y y ( 1 − r 2 ) {\displaystyle \operatorname {RSS} =S_{yy}(1-r^{2})} 65582d5aaea1935171dd2f04afb19ed64d7c42de.svg_.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注