在機率論與統計學中,共變異數(英語:Covariance)用於衡量隨機變數間的相關程度。
「Covariance」的各地常用譯名 |
---|
中國大陸 | 協方差 |
---|
臺灣 | 共變異數 |
---|
港澳 | 協方差 |
---|
日本、韓國 | 共分散 |
---|
兩變數X與Y在3種不同的共變異數情況下的關係
定義 —
設
為樣本空間,
是定義在
的事件族
上的機率。(換句話說,
是個機率空間)
若
與
是定義在
上的兩個實數隨機變數, 期望值分別為:
![{\displaystyle \operatorname {E} (X)=\int _{\Omega }X\,dP=\mu }](https://wikimedia.org/api/rest_v1/media/math/render/svg/d2343d09d1605ab0ddc7b56659bd456aa30ebc7e)
![{\displaystyle \operatorname {E} (Y)=\int _{\Omega }Y\,dP=\nu }](https://wikimedia.org/api/rest_v1/media/math/render/svg/cabeb0d60fe98340cb5799d179b964327b771b4b)
則兩者間的共變異數定義為:
![{\displaystyle \operatorname {cov} (X,Y)=\operatorname {E} [(X-\mu )(Y-\nu )]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/febbdfd744a73d469d33f9a075509210acb3e566)
根據測度積分的線性性質,上面的原始定義可以進一步簡化為:
![{\displaystyle {\begin{aligned}\operatorname {cov} (X,Y)&=\int _{\Omega }(X-\mu )(Y-\nu )\,dP\\&=\int _{\Omega }X\cdot Y\,dP-\mu \int _{\Omega }Y\,dP-\nu \int _{\Omega }X\,dP+\mu \nu \\&=\operatorname {E} (X\cdot Y)-\mu \nu \end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/527c19a137f63e65f91539a9ec70bc880d3b4f0f)
共變異數矩陣[編輯]
共變異數的定義可以推廣到兩列隨機變數之間
定義 —
設
是機率空間,
與
是定義在
上的兩列實數隨機變數序列(也可視為有序對或行向量)
若二者對應的期望值分別為:
![{\displaystyle E(x_{i})=\int _{\Omega }x_{i}\,dP=\mu _{i}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/1cb2536f97a10b488685f9abfe7865a276030b89)
![{\displaystyle E(y_{j})=\int _{\Omega }y_{j}\,dP=\nu _{j}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c13bfc6c82f4bbb2d5eaab7386e41f3f0a73bc17)
則這兩列隨機變量間的共變異數定義成一個
矩陣
![{\displaystyle \operatorname {\mathbf {cov} } (X,Y):={\left[\,\operatorname {cov} (x_{i},y_{j})\,\right]}_{m\times n}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/e1336ef2012f40c3146fdc7e36b7d175842ba429)
以上的定義,以矩形來表示就是:
![{\displaystyle \operatorname {\mathbf {cov} } (X,Y):={\begin{bmatrix}\operatorname {cov} (x_{1},y_{1})&\dots &\operatorname {cov} (x_{1},y_{n})\\\vdots &\ddots &\vdots \\\operatorname {cov} (x_{m},y_{1})&\dots &\operatorname {cov} (x_{m},y_{n})\end{bmatrix}}={\begin{bmatrix}\operatorname {E} (x_{1}y_{1})-\mu _{1}\nu _{1}&\dots &\operatorname {E} (x_{1}y_{n})-\mu _{1}\nu _{n}\\\vdots &\ddots &\vdots \\\operatorname {E} (x_{m}y_{1})-\mu _{m}\nu _{1}&\dots &\operatorname {E} (x_{m}y_{n})-\mu _{m}\nu _{n}\end{bmatrix}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a7cbc6b5a06a280ab857d5c684dc84e8b0ad4e5c)
統計獨立[編輯]
計算性質[編輯]
如果
與
是實數隨機變數,
與
是常數,那麼根據共變異數的定義可以得到:
,
,
,
對於隨機變數序列
與
,有
,
對於隨機變數序列
,有
。
相關係數[編輯]
取決於共變異數的相關性
![{\displaystyle \eta ={\dfrac {\operatorname {cov} (X,Y)}{\sqrt {\operatorname {var} (X)\cdot \operatorname {var} (Y)}}}\ ,}](https://wikimedia.org/api/rest_v1/media/math/render/svg/786d2c7152089bcd6eadb4412445f39a58d4a0f2)
更準確地說是線性相依性,是一個衡量線性獨立的無量綱數,其取值在
之間。相關性
時稱為「完全線性相依」(相關性
時稱為「完全線性負相關」),此時將
對
作Y-X 散點圖,將得到一組精確排列在直線上的點;相關性數值介於-1到1之間時,其絕對值越接近1表明線性相依性越好,作散點圖得到的點的排布越接近一條直線。
相關性為0(因而共變異數也為0)的兩個隨機變數又被稱為是不相關的,或者更準確地說叫作「線性獨立」、「線性不相關」,這僅僅表明
與
兩隨機變數之間沒有線性相依性,並非表示它們之間一定沒有任何內在的(非線性)函數關係,和前面所說的「
、
二者並不一定是統計獨立的」說法一致。