Modérateur : Groupe des modérateurs
$cov
v1 v2 v3 v4 v5 v6 v7
v1 3549.883 3368.899 3549.525 4002.251 5333.255 6423.897 1162.7572
v2 3368.899 3831.673 3706.116 3951.556 5412.253 6576.100 1259.0951
v3 3549.525 3706.116 3871.077 4028.697 5914.789 7056.121 1328.2872
v4 4002.251 3951.556 4028.697 4747.734 6029.531 7137.475 1245.9447
v5 5333.255 5412.253 5914.789 6029.531 11259.882 11222.380 1872.0820
v6 6423.897 6576.100 7056.121 7137.475 11222.380 14140.341 2379.8745
v7 1162.757 1259.095 1328.287 1245.945 1872.082 2379.874 616.4975
$center
[1] 0
$n.obs
[1] 80
$wt
[1] 0.0021916451 0.0173045873 0.0196710064 0.0191484333 0.0193617751 0.0187069259 0.0180839094 0.0178525393 0.0180694118 0.0171497332 0.0170479240 0.0167372413 0.0162735880
[14] 0.0159204808 0.0156896081 0.0155054082 0.0144728760 0.0140761170 0.0133207632 0.0122511350 0.0105632521 0.0089934535 0.0084907880 0.0081803703 0.0095023566 0.0112243512
[27] 0.0130485016 0.0143378765 0.0164140098 0.0182673877 0.0188111405 0.0189329959 0.0183600278 0.0190222889 0.0191143705 0.0187674684 0.0202371987 0.0209865879 0.0215920328
[40] 0.0214298117 0.0211446261 0.0200654456 0.0192538995 0.0192692247 0.0192451381 0.0194778169 0.0189749639 0.0184780265 0.0171281010 0.0166063065 0.0160911819 0.0153433216
[53] 0.0147167418 0.0138852146 0.0132397709 0.0123850663 0.0119401628 0.0111610405 0.0105077936 0.0093575603 0.0079230791 0.0064068025 0.0053096346 0.0043342365 0.0037333129
[66] 0.0028615993 0.0020212537 0.0017473491 0.0016628587 0.0012631358 0.0011051628 0.0011325475 0.0010951335 0.0010602228 0.0009216152 0.0008545537 0.0008393508 0.0008383071
[79] 0.0007493485 0.0007577143
$cor
v1 v2 v3 v4 v5 v6 v7
v1 1.0000000 0.9134541 0.9575189 0.9748866 0.8435647 0.9066957 0.7859888
v2 0.9134541 1.0000000 0.9622964 0.9264688 0.8239806 0.8933965 0.8192164
v3 0.9575189 0.9622964 1.0000000 0.9397353 0.8958936 0.9537185 0.8598257
v4 0.9748866 0.9264688 0.9397353 1.0000000 0.8246572 0.8711068 0.7282657
v5 0.8435647 0.8239806 0.8958936 0.8246572 1.0000000 0.8893815 0.7105461
v6 0.9066957 0.8933965 0.9537185 0.8711068 0.8893815 1.0000000 0.8060434
v7 0.7859888 0.8192164 0.8598257 0.7282657 0.7105461 0.8060434 1.0000000
center either a logical or a numeric vector specifying the centers to be used when computing covariances. If TRUE, the (weighted) mean of each variable is used, if FALSE, zero is used. If center is numeric, its length must equal the number of columns of x.
method string specifying how the result is scaled, see ‘Details’ below.
By default, method = "unbiased", The covariance matrix is divided by one minus the sum of squares of the weights, so if the weights are the default (1/n) the conventional unbiased estimate of the covariance matrix with divisor (n - 1) is obtained. This differs from the behaviour in S-PLUS which corresponds to method = "ML" and does not divide.
$cov
v1 v2 v3 v4 v5 v6 v7
v1 1.0000000 0.58163327 0.8622519 0.8991349 0.38785959 0.5677345 0.30720788
v2 0.5816333 1.00000000 0.5171192 0.7157036 -0.04696801 0.1391073 0.30231069
v3 0.8622519 0.51711917 1.0000000 0.7618955 0.50929085 0.7001930 0.53993404
v4 0.8991349 0.71570362 0.7618955 1.0000000 0.32491999 0.4113968 0.12428375
v5 0.3878596 -0.04696801 0.5092909 0.3249200 1.00000000 0.5176850 0.08420861
v6 0.5677345 0.13910728 0.7001930 0.4113968 0.51768501 1.0000000 0.32096163
v7 0.3072079 0.30231069 0.5399340 0.1242838 0.08420861 0.3209616 1.00000000
$center
[1] 0
$n.obs
[1] 80
$wt
[1] 0.0021916451 0.0173045873 0.0196710064 0.0191484333 0.0193617751 0.0187069259 0.0180839094 0.0178525393 0.0180694118 0.0171497332 0.0170479240 0.0167372413 0.0162735880
[14] 0.0159204808 0.0156896081 0.0155054082 0.0144728760 0.0140761170 0.0133207632 0.0122511350 0.0105632521 0.0089934535 0.0084907880 0.0081803703 0.0095023566 0.0112243512
[27] 0.0130485016 0.0143378765 0.0164140098 0.0182673877 0.0188111405 0.0189329959 0.0183600278 0.0190222889 0.0191143705 0.0187674684 0.0202371987 0.0209865879 0.0215920328
[40] 0.0214298117 0.0211446261 0.0200654456 0.0192538995 0.0192692247 0.0192451381 0.0194778169 0.0189749639 0.0184780265 0.0171281010 0.0166063065 0.0160911819 0.0153433216
[53] 0.0147167418 0.0138852146 0.0132397709 0.0123850663 0.0119401628 0.0111610405 0.0105077936 0.0093575603 0.0079230791 0.0064068025 0.0053096346 0.0043342365 0.0037333129
[66] 0.0028615993 0.0020212537 0.0017473491 0.0016628587 0.0012631358 0.0011051628 0.0011325475 0.0010951335 0.0010602228 0.0009216152 0.0008545537 0.0008393508 0.0008383071
[79] 0.0007493485 0.0007577143
$cor
v1 v2 v3 v4 v5 v6 v7
v1 1.0000000 0.58163327 0.8622519 0.8991349 0.38785959 0.5677345 0.30720788
v2 0.5816333 1.00000000 0.5171192 0.7157036 -0.04696801 0.1391073 0.30231069
v3 0.8622519 0.51711917 1.0000000 0.7618955 0.50929085 0.7001930 0.53993404
v4 0.8991349 0.71570362 0.7618955 1.0000000 0.32491999 0.4113968 0.12428375
v5 0.3878596 -0.04696801 0.5092909 0.3249200 1.00000000 0.5176850 0.08420861
v6 0.5677345 0.13910728 0.7001930 0.4113968 0.51768501 1.0000000 0.32096163
v7 0.3072079 0.30231069 0.5399340 0.1242838 0.08420861 0.3209616 1.00000000
Code : Tout sélectionner
set.seed(100)
x <- rnorm(100,5)
dim(x) <- c(20,5)
poids <- runif(20)
poids <- poids/sum(poids)
# moyenne pondérée
mn <- colSums(x*poids)
# variance pondérée
vn <- colSums(poids*t(t(x)-mn)^2)
diag(cov.wt(x, poids, method="ML")$cov)
# centrée et reduire :
xcr <- t((t(x)-mn)/sqrt(vn))
# comparaison avec le tableau d'ade4
all.equal(as.matrix(dudi.pca(x, row.w=poids, scannf=F)$tab), xcr, check.attr=F)
[1] TRUE
Code : Tout sélectionner
all.equal(cor(x), cor(xcr))
[1] TRUE
Retourner vers « Questions en cours »
Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité