Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский -
Scilabヘルプ >> Statistics > Descriptive Statistics > cov

cov

共分散行列

呼び出し手順

C = cov(x)
C = cov(x, 0)
C = cov(x, 1)
C = cov(x, y)
C = cov(x, y, 0)
C = cov(x, y, 1)

パラメータ

x

nobs x 1 またはnobs x nvar のdouble行列

y

nobs x 1 または nobs x nvar のdouble行列

C

doublesの正方行列, 経験的共分散

説明

x が nobs x 1 行列の場合, cov(x) はxの共分散を nobs-1 で正規化して返します.

x が nobs x nvar 行列の場合, cov(x) は xの列の nvar x nvar 共分散行列を nobs - 1で正規化して返します. ここで,xの各列は変数でxの各行は観測値です.

x と y が nobs x 1 の行列の場合, cov(x, y) は x および y の2 x 2 共分散行列, nobs-1で正規化したものを返します. ただし,nobsは観測値の数です.

cov(x, 0)cov(x) と同じ, cov(x, y, 0)cov(x, y)と同じです. この場合, 母集団が正規分布の場合, Cは共分散行列のバイアスなしの最良の推定値です.

cov(x, 1) および cov(x, y, 1) は nobs で正規化します. この場合, Cは観測量の平均に関する2次モーメント行列です.

XおよびYの共分散は次のように定義されます:

ただし, E は期待値です.

この関数は Matlabと互換性があります.

x = [1; 2];
y = [3; 4];
C = cov(x, y)
expected = [0.5, 0.5; 0.5, 0.5];
C = cov([x, y])
x = [230; 181; 165; 150; 97; 192; 181; 189; 172; 170];
y = [125; 99; 97; 115; 120; 100; 80; 90; 95; 125];
expected = [
1152.4556, -88.911111
-88.911111, 244.26667
];
C = cov(x, y)
C = cov([x, y])
// Source [3]
A = [
4.0 2.0 0.60
4.2 2.1 0.59
3.9 2.0 0.58
4.3 2.1 0.62
4.1 2.2 0.63
];
S = [
0.025 0.0075 0.00175
0.0075 0.007 0.00135
0.00175 0.00135 0.00043
];
C = cov(A)

参考文献

Wikipedia: Covariance matrix

[3] NIST/SEMATECH e-Handbook of Statistical Methods, 6.5.4.1. Mean Vector and Covariance Matrix

"Introduction to probability and statistics for engineers and scientists", Sheldon Ross

履歴

バージョン記述
5.5.0 mvvacov(廃止予定)を改善するために, cov 関数が追加されました
Scilab Enterprises
Copyright (c) 2011-2015 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jun 15 08:35:27 CEST 2016