Dieser Artikel oder Abschnitt bedarf einer grundsätzlichen Überarbeitung. Näheres sollte auf der
Diskussionsseite angegeben sein. Bitte hilf mit, ihn zu
verbessern , und entferne anschließend diese Markierung.
Der Verschiebungssatz (auch Satz von Steiner oder Steinerscher Verschiebungssatz genannt) ist eine Rechenregel für die Ermittlung der Summe der Abweichungsquadrate bzw. der empirischen Varianz .
Kurzgefasst besagt er, dass für
n
{\displaystyle n}
Zahlen
x
1
,
…
,
x
n
{\displaystyle x_{1},\dotsc ,x_{n}}
und deren arithmetisches Mittel
x
¯
{\displaystyle {\overline {x}}}
gilt:
S
Q
x
=
∑
i
=
1
n
(
x
i
−
x
¯
)
2
=
(
∑
i
=
1
n
x
i
2
)
−
n
x
¯
2
=
(
∑
i
=
1
n
x
i
2
)
−
1
n
(
∑
i
=
1
n
x
i
)
2
{\displaystyle SQ_{x}=\sum _{i=1}^{n}\left(x_{i}-{\overline {x}}\right)^{2}=\left(\sum _{i=1}^{n}x_{i}^{2}\right)-n{\overline {x}}^{2}=\left(\sum _{i=1}^{n}x_{i}^{2}\right)-{\frac {1}{n}}\left(\sum _{i=1}^{n}x_{i}\right)^{2}}
.
Damit kann man
S
Q
x
{\displaystyle SQ_{x}}
berechnen, ohne das Mittel
x
¯
{\displaystyle {\overline {x}}}
bereits vorab zu kennen und ohne alle Stichprobenwerte speichern zu müssen.
Bei der Berechnung mit Gleitkommazahlen kann es jedoch zu einer numerischen Auslöschung kommen, wenn
x
¯
2
{\displaystyle {\overline {x}}^{2}}
erheblich größer ist als die Varianz, die Daten also nicht zentriert sind.[1] Daher bietet sich die Verwendung dieser Formel primär für analytische Betrachtungen an, nicht für die Verwendung mit realen Daten. Eine mögliche Abhilfe[2] ist, vorab eine Näherung
x
~
≈
x
¯
{\displaystyle {\tilde {x}}\approx {\overline {x}}}
für das Mittel zu bestimmen und damit zu berechnen:
S
Q
x
=
∑
i
=
1
n
(
x
i
−
x
¯
)
2
=
∑
i
=
1
n
(
x
i
−
x
~
)
2
−
1
n
(
∑
i
=
1
n
(
x
i
−
x
~
)
)
2
{\displaystyle SQ_{x}=\sum _{i=1}^{n}\left(x_{i}-{\overline {x}}\right)^{2}=\sum _{i=1}^{n}(x_{i}-{\tilde {x}})^{2}-{\frac {1}{n}}\left(\sum _{i=1}^{n}(x_{i}-{\tilde {x}})\right)^{2}}
.
Falls die Näherung
x
~
{\displaystyle {\tilde {x}}}
nahe genug an dem echten Mittel
x
¯
{\displaystyle {\overline {x}}}
liegt, ist die Genauigkeit mit dieser Formel gut. Weitere numerisch stabilere Berechnungsmethoden finden sich in der Literatur.[2] [1]
Erläuterung am Fall einer endlichen Folge von Zahlen: Das Stichprobenmittel
Bearbeiten
Der Verschiebungssatz wird zunächst am einfachsten Fall vorgeführt: Es seien die Werte
x
1
,
x
2
,
…
,
x
n
{\displaystyle x_{1},x_{2},\ldots ,x_{n}}
gegeben, beispielsweise eine Stichprobe . Es wird die Summe der Abweichungsquadrate dieser Werte gebildet:
S
Q
x
=
∑
i
=
1
n
(
x
i
−
x
¯
)
2
,
{\displaystyle SQ_{x}=\sum _{i=1}^{n}(x_{i}-{\overline {x}})^{2}\ ,}
wobei
x
¯
:=
1
n
(
x
1
+
x
2
+
…
+
x
n
)
=
1
n
∑
i
=
1
n
x
i
{\displaystyle {\overline {x}}:={\frac {1}{n}}(x_{1}+x_{2}+\ldots +x_{n})={\frac {1}{n}}\sum _{i=1}^{n}{x_{i}}}
das arithmetische Mittel der Zahlen ist. Der Verschiebungssatz ergibt sich aus[3]
S
Q
x
=
∑
i
=
1
n
(
x
i
2
−
2
x
i
x
¯
+
x
¯
2
)
=
(
∑
i
=
1
n
x
i
2
)
−
2
x
¯
(
∑
i
=
1
n
x
i
)
+
n
x
¯
2
{\displaystyle SQ_{x}=\sum _{i=1}^{n}(x_{i}^{2}-2x_{i}{\overline {x}}+{\overline {x}}^{2})=\left(\sum _{i=1}^{n}x_{i}^{2}\right)-2{\overline {x}}\left(\sum _{i=1}^{n}x_{i}\right)+n{\overline {x}}^{2}}
=
(
∑
i
=
1
n
x
i
2
)
−
2
x
¯
⋅
n
x
¯
+
n
x
¯
2
=
(
∑
i
=
1
n
x
i
2
)
−
n
x
¯
2
{\displaystyle \quad =\left(\sum _{i=1}^{n}x_{i}^{2}\right)-2{\overline {x}}\cdot n{\overline {x}}+n{\overline {x}}^{2}=\left(\sum _{i=1}^{n}x_{i}^{2}\right)-n{\overline {x}}^{2}}
.
Im Rahmen der Qualitätssicherung werden fortlaufend Kaffeepäckchen gewogen. Für die ersten vier Päckchen erhielt man die Werte (in g)
x
i
{\displaystyle x_{i}}
505
,
500
,
495
,
505
{\displaystyle 505,500,495,505}
Das durchschnittliche Gewicht beträgt
x
¯
=
505
+
500
+
495
+
505
4
=
501
,
25
{\displaystyle {\overline {x}}={\frac {505+500+495+505}{4}}=501{,}25}
Es ist
S
Q
x
=
(
505
−
501
,
25
)
2
+
(
500
−
501
,
25
)
2
+
(
495
−
501
,
25
)
2
+
(
505
−
501
,
25
)
2
=
14,062
5
+
1,562
5
+
39,062
5
+
14,062
5
=
68
,
75
.
{\displaystyle {\begin{aligned}SQ_{x}&=(505-501{,}25)^{2}+(500-501{,}25)^{2}+(495-501{,}25)^{2}+(505-501{,}25)^{2}\\&=14{,}0625+1{,}5625+39{,}0625+14{,}0625\\&=68{,}75\,.\end{aligned}}}
Für die Anwendung des Verschiebungssatzes berechnet man
q
1
=
∑
i
=
1
n
x
i
=
505
+
500
+
495
+
505
=
2.005
{\displaystyle q_{1}=\sum _{i=1}^{n}x_{i}=505+500+495+505=2.005}
und
q
2
=
∑
i
=
1
n
x
i
2
=
255.025
+
250.000
+
245.025
+
255.025
=
1.005.075
{\displaystyle q_{2}=\sum _{i=1}^{n}x_{i}^{2}=255.025+250.000+245.025+255.025=1.005.075}
S
Q
x
=
q
2
−
1
4
q
1
2
=
68
,
75
{\displaystyle SQ_{x}=q_{2}-{\frac {1}{4}}q_{1}^{2}=68{,}75}
Man kann damit beispielsweise die (korrigierte) empirische Varianz als „durchschnittliches“ Abweichungsquadrat bestimmen:
s
2
=
1
n
−
1
S
Q
x
,
{\displaystyle s^{2}={\frac {1}{n-1}}SQ_{x}\,,}
im Beispiel
s
2
=
1
4
−
1
68
,
75
≈
22
,
9
.
{\displaystyle s^{2}={\frac {1}{4-1}}68{,}75\approx 22{,}9\,.}
Kommt nun ein weiteres Päckchen in die Stichprobe, so reicht es zur Neuberechnung der Stichprobenvariation mit Hilfe des Verschiebungssatzes, lediglich die Werte für
q
1
{\displaystyle q_{1}}
und
q
2
{\displaystyle q_{2}}
neu zu berechnen. Beim fünften Päckchen werde das Gewicht 510 g gemessen. Dann gilt:
q
1
neu
=
q
1
+
510
=
2.005
+
510
=
2.515
,
{\displaystyle q_{1}^{\text{neu}}=q_{1}+510=2.005+510=2.515\,,}
q
2
neu
=
q
2
+
510
2
=
1.005.075
+
260.100
=
1.265.175
,
{\displaystyle q_{2}^{\text{neu}}=q_{2}+510^{2}=1.005.075+260.100=1.265.175\,,}
sowie
S
Q
neu
=
q
2
neu
−
1
5
(
q
1
neu
)
2
=
130
.
{\displaystyle SQ^{\text{neu}}=q_{2}^{\text{neu}}-{\frac {1}{5}}\left(q_{1}^{\text{neu}}\right)^{2}=130\,.}
Die Stichprobenvarianz der neuen, größeren Stichprobe ist dann
s
neu
2
=
1
5
−
1
S
Q
neu
=
130
/
4
=
32
,
5
.
{\displaystyle s_{\text{neu}}^{2}={\frac {1}{5-1}}SQ^{\text{neu}}=130/4=32{,}5\,.}
Stichprobenkovarianz
Bearbeiten
Die Summe der Abweichungsprodukte zweier Merkmale
x
{\displaystyle x}
und
y
{\displaystyle y}
ist gegeben durch
S
P
x
y
:=
∑
i
=
1
n
(
x
i
−
x
¯
)
(
y
i
−
y
¯
)
.
{\displaystyle SP_{xy}:=\sum _{i=1}^{n}(x_{i}-{\overline {x}})(y_{i}-{\overline {y}})\ .}
Hier ergibt der Verschiebungssatz
S
P
x
y
=
∑
i
=
1
n
(
x
i
y
i
)
−
n
x
¯
y
¯
.
{\displaystyle SP_{xy}=\sum _{i=1}^{n}(x_{i}y_{i})-n{\overline {x}}{\overline {y}}\ .}
Die korrigierte Stichprobenkovarianz berechnet sich dann als „durchschnittliches“ Abweichungsprodukt
s
x
y
=
1
n
−
1
S
P
x
y
.
{\displaystyle s_{xy}={\frac {1}{n-1}}SP_{xy}\ .}
Die Varianz einer Zufallsvariablen
Var
(
X
)
=
E
(
(
X
−
E
(
X
)
)
2
)
{\displaystyle \operatorname {Var} (X)=\operatorname {E} ((X-\operatorname {E} (X))^{2})}
lässt sich mit dem Verschiebungssatz auch angeben als[4]
Var
(
X
)
=
E
(
X
2
)
−
(
E
(
X
)
)
2
.
{\displaystyle \operatorname {Var} (X)=\operatorname {E} (X^{2})-(\operatorname {E} (X))^{2}\ .}
Dieses Resultat wird auch als Satz von König -Huygens bezeichnet. Es ergibt sich aus der Linearität des Erwartungswertes :
E
(
(
X
−
E
(
X
)
)
2
)
=
E
(
X
2
−
2
X
E
(
X
)
+
E
(
X
)
2
)
=
E
(
X
2
)
−
E
(
2
X
E
(
X
)
)
+
E
(
E
(
X
)
2
)
=
E
(
X
2
)
−
2
E
(
X
)
E
(
X
)
+
E
(
X
)
2
=
E
(
X
2
)
−
E
(
X
)
2
.
{\displaystyle {\begin{aligned}\operatorname {E} {\bigl (}(X-\operatorname {E} (X))^{2}{\bigr )}&=\operatorname {E} {\bigl (}X^{2}-2X\operatorname {E} (X)+\operatorname {E} (X)^{2}{\bigr )}\\&=\operatorname {E} (X^{2})-\operatorname {E} {\bigl (}2X\operatorname {E} (X){\bigr )}+\operatorname {E} {\bigl (}\operatorname {E} (X)^{2}{\bigr )}\\&=\operatorname {E} (X^{2})-2\operatorname {E} (X)\operatorname {E} (X)+\operatorname {E} (X)^{2}\\&=\operatorname {E} (X^{2})-\operatorname {E} (X)^{2}.\end{aligned}}}
Eine allgemeinere Darstellung des Verschiebungssatzes ergibt sich aus:
Var
(
X
)
=
E
(
(
X
−
c
)
2
)
−
(
E
(
X
)
−
c
)
2
,
c
∈
R
{\displaystyle \operatorname {Var} (X)=\operatorname {E} \left((X-c)^{2}\right)-\left(\operatorname {E} (X)-c\right)^{2},\quad c\in \mathbb {R} }
.
Man erhält bei einer diskreten Zufallsvariablen
X
{\displaystyle X}
mit den Ausprägungen
x
i
,
i
=
1
,
…
,
n
{\displaystyle x_{i},\,i=1,\dots ,n}
und der dazugehörigen Wahrscheinlichkeit
P
(
X
=
x
j
)
=
p
j
{\displaystyle \operatorname {P} (X=x_{j})=p_{j}}
dann für
Var
(
X
)
=
E
(
(
X
−
E
(
X
)
)
2
)
=
∑
j
p
j
(
x
j
−
∑
i
p
i
x
i
)
2
=
∑
i
p
i
x
i
2
−
(
∑
i
p
i
x
i
)
2
.
{\displaystyle \operatorname {Var} (X)=\operatorname {E} ((X-\operatorname {E} (X))^{2})=\sum _{j}p_{j}\left(x_{j}-\sum _{i}p_{i}x_{i}\right)^{2}=\sum _{i}p_{i}x_{i}^{2}-\left(\sum _{i}p_{i}x_{i}\right)^{2}\ .}
Mit der speziellen Wahl
p
i
=
1
n
{\displaystyle p_{i}={\frac {1}{n}}}
ergibt sich
E
(
X
)
=
x
¯
=
1
n
∑
i
x
i
{\displaystyle \operatorname {E} (X)={\overline {x}}={\frac {1}{n}}\sum _{i}x_{i}}
und die obige Formel
1
n
∑
i
(
x
i
−
x
¯
)
2
=
1
n
∑
i
x
i
2
−
x
¯
2
.
{\displaystyle {\frac {1}{n}}\sum _{i}\left(x_{i}-{\overline {x}}\right)^{2}={\frac {1}{n}}\sum _{i}x_{i}^{2}-{\overline {x}}^{2}.}
Für eine stetige Zufallsvariable
X
{\displaystyle X}
und der dazugehörigen Dichtefunktion
f
{\displaystyle f}
ist
Var
(
X
)
=
E
(
(
X
−
E
(
X
)
)
2
)
=
∫
−
∞
∞
(
x
−
E
(
X
)
)
2
f
(
x
)
d
x
.
{\displaystyle \operatorname {Var} (X)=\operatorname {E} ((X-\operatorname {E} (X))^{2})=\int _{-\infty }^{\infty }(x-\operatorname {E} (X))^{2}\,f(x)\,\mathrm {d} x\ .}
Man erhält hier mit dem Verschiebungssatz
Var
(
X
)
=
E
(
(
X
−
E
(
X
)
)
2
)
=
∫
−
∞
∞
x
2
f
(
x
)
d
x
−
E
(
X
)
2
.
{\displaystyle \operatorname {Var} (X)=\operatorname {E} ((X-\operatorname {E} (X))^{2})=\int _{-\infty }^{\infty }x^{2}f(x)\,\mathrm {d} x-\operatorname {E} (X)^{2}\ .}
Die Kovarianz zweier Zufallsvariablen
X
{\displaystyle X}
und
Y
{\displaystyle Y}
Cov
(
X
,
Y
)
=
E
(
(
X
−
E
(
X
)
)
⋅
(
Y
−
E
(
Y
)
)
)
{\displaystyle \operatorname {Cov} (X,Y)=\operatorname {E} ((X-\operatorname {E} (X))\cdot (Y-\operatorname {E} (Y)))}
lässt sich mit dem Verschiebungssatz als
Cov
(
X
,
Y
)
=
E
(
X
Y
)
−
E
(
X
)
E
(
Y
)
{\displaystyle \operatorname {Cov} (X,Y)=\operatorname {E} (XY)-\operatorname {E} (X)\operatorname {E} (Y)}
angeben.
Für diskrete Zufallsvariablen erhält man für
Cov
(
X
,
Y
)
=
∑
j
∑
k
(
x
j
−
E
(
X
)
)
(
y
k
−
E
(
Y
)
)
⋅
f
(
x
j
,
y
k
)
{\displaystyle \operatorname {Cov} (X,Y)=\sum _{j}\sum _{k}(x_{j}-\operatorname {E} (X))(y_{k}-\operatorname {E} (Y))\cdot f(x_{j},y_{k})}
entsprechend zu oben
Cov
(
X
,
Y
)
=
∑
j
∑
k
x
j
y
k
f
(
x
j
,
y
k
)
−
E
(
X
)
⋅
E
(
Y
)
,
{\displaystyle \operatorname {Cov} (X,Y)=\sum _{j}\sum _{k}x_{j}\,y_{k}\,f(x_{j},y_{k})-\operatorname {E} (X)\cdot \operatorname {E} (Y)\ ,}
mit
f
(
x
j
,
y
k
)
{\displaystyle f(x_{j},y_{k})}
als gemeinsamer Wahrscheinlichkeit, dass
X
=
x
j
{\displaystyle X=x_{j}}
und
Y
=
y
k
{\displaystyle Y=y_{k}}
ist.
Bei stetigen Zufallsvariablen ergibt sich mit
f
(
x
,
y
)
{\displaystyle f(x,y)}
als gemeinsamer Dichtefunktion von
X
{\displaystyle X}
und
Y
{\displaystyle Y}
an der Stelle
x
{\displaystyle x}
und
y
{\displaystyle y}
für die Kovarianz
Cov
(
X
,
Y
)
=
∫
−
∞
∞
∫
−
∞
∞
(
x
−
E
(
X
)
)
(
y
−
E
(
Y
)
)
⋅
f
(
x
,
y
)
d
y
d
x
{\displaystyle \operatorname {Cov} (X,Y)=\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }(x-\operatorname {E} (X))(y-\operatorname {E} (Y))\cdot f(x,y)\,\mathrm {d} y\,\mathrm {d} x}
entsprechend zu oben
Cov
(
X
,
Y
)
=
∫
−
∞
∞
∫
−
∞
∞
x
y
f
(
x
,
y
)
d
y
d
x
−
E
(
X
)
⋅
E
(
Y
)
{\displaystyle \operatorname {Cov} (X,Y)=\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }xy\,f(x,y)\,\mathrm {d} y\,\mathrm {d} x-\operatorname {E} (X)\cdot \operatorname {E} (Y)\,}
↑ a b Erich Schubert, Michael Gertz: Numerically stable parallel computation of (co-)variance . In: Proceedings of the 30th International Conference on Scientific and Statistical Database Management - SSDBM '18 . ACM Press, Bozen-Bolzano, Italy 2018, ISBN 978-1-4503-6505-5 , S. 1–12 , doi :10.1145/3221269.3223036 (acm.org [abgerufen am 7. Dezember 2019]).
↑ a b Tony F. Chan, Gene H. Golub, Randall J. LeVeque: Algorithms for computing the sample variance: analysis and recommendations . In: The American Statistician Vol. 37, No. 3 (Aug., 1983), S. 242–247
↑ Hans-Friedrich Eckey, Reinhold Kosfeld, Christian Dreger: Statistik: Grundlagen — Methoden — Beispiele , S. 86
↑ Ansgar Steland: Basiswissen Statistik , S. 116