我试图在R中使用ca库运行对应分析但是我收到以下错误:
Error in svd(S) : infinite or missing values in 'x'
In addition: Warning message:
In sqrt(eP) : NaNs produced
这是我的数据集
Dif_Aud Dif_Alc Dif_Shr Dif_Ats
DKIDS -17307 -105249 0.361 -2.26666666
CARTOON -14583 -132158 0.430 2.16666666
SPORTV -23820 -208902 -0.796 -1.53333333
MULTISHOW 3869 -30392 1.770 4.61666667
MEGAPIX -11683 -129625 0.086 -0.43333333
FOX -25429 -185373 -1.413 -7.56666666
TNT -12390 -116205 -0.250 -3.75000000
SPACE -7121 -89169 0.164 -0.43333333
VIVA -4720 -75378 0.390 0.86666667
DISNEY -14668 -96903 -0.644 -7.95000000
TC PREMIUM 675 25897 0.837 -1.98333333
UNIVERSAL -12952 -104380 -0.569 -6.55000000
TC PIPOCA 2017 51298 0.934 -4.30000000
AXN -6406 -60997 0.062 -0.90000000
DISCOVERY CHANNEL -7080 -86041 -0.029 -1.60000000
GNEWS -2457 -89800 0.408 4.76666667
FX -12896 -143305 -0.663 -2.13333334
GNT -1915 -75992 0.365 4.31666666
TC ACTION 103 13328 0.544 -2.25000000
NICK -5392 -61935 -0.018 -0.06666666
SPORTV_2 -4223 -83112 0.085 0.55000000
WARNER -6717 -68173 -0.218 -4.10000000
H&H -9809 -119686 -0.550 1.53333333
ANIMAL 1172 -21680 0.507 5.35000000
NATGEO -7404 -127921 -0.356 -1.10000000
ESPN BR -2676 -18278 0.060 -4.20000000
CINEMAX -5028 -96745 -0.180 -0.68333333
FOX SPORTS -10027 -73034 -0.709 -7.33333333
SONY -3979 -58269 -0.118 -2.25000000
HISTORY -8792 -110035 -0.608 -4.10000000
BOOMERANG -5084 -62047 -0.253 -0.93333334
TC FUN -3711 -36152 -0.129 -4.98333333
HBO 1088 22788 0.317 1.28333334
SPORTV 3 -2948 -95394 -0.093 0.68333334
FOX Life -2286 -52071 -0.034 5.83333334
GLOOB -6703 -73867 -0.482 -6.26666667
TLC -5305 -75255 -0.352 -2.90000000
DISNEY XD -4517 -51180 -0.292 -5.06666667
A&E -4565 -84667 -0.306 0.26666667
MTV -4399 -67367 -0.325 -2.48333334
当我在这个对象中运行svd时
> svd(analise)
$d
[1] 586218.63825 21265.02168 37.52027 16.15292 2.09432
$u
[,1] [,2] [,3] [,4] [,5]
[1,] 0.18150580 -0.35027170 0.121797235 0.20447594 0.384868406
[2,] 0.22677778 -0.10510095 0.143836533 0.28852816 0.284867160
[3,] 0.35858927 -0.20212370 0.138182724 0.21491424 -0.139866059
[4,] 0.05100616 0.31400723 0.171410051 -0.02997187 0.540177937
[5,] 0.22201573 0.01961012 0.078690335 0.04468443 0.116447686
[6,] 0.31888129 -0.38031298 0.096648971 -0.01609187 -0.312133863
[7,] 0.19933447 -0.07215610 0.042661241 -0.08183358 0.031594719
[8,] 0.15257935 0.05636619 0.097778029 -0.03556821 0.066439422
[9,] 0.12877513 0.10850103 0.112478175 -0.01871585 0.112140330
[10,] 0.16691197 -0.26319170 -0.009717159 -0.17637196 -0.016410347
[11,] -0.04409211 -0.08159895 0.275621286 -0.21061595 0.161254500
[12,] 0.17933927 -0.15016090 -0.044239995 -0.16177399 -0.004591287
[13,] -0.08744755 -0.12979959 0.281822798 -0.34298422 0.203065145
[14,] 0.10461689 -0.03330469 0.041209263 0.01183071 0.086216607
[15,] 0.14726006 0.04461236 -0.012883596 -0.04962331 0.082898454
[16,] 0.15291151 0.27750226 0.085394175 0.10865458 0.061302591
[17,] 0.24544303 0.02261448 -0.131671500 0.04754004 -0.026167394
[18,] 0.12937320 0.24252074 0.184695518 0.04960557 -0.048427775
[19,] -0.02265344 -0.05343815 0.198548356 -0.20309772 0.093648877
[20,] 0.10604926 0.01827305 -0.067679470 0.07265230 0.120310236
[21,] 0.14183223 0.16557921 0.026622370 -0.03989230 0.025396062
[22,] 0.11685437 -0.01649793 -0.052915136 -0.15331633 0.047792910
[23,] 0.20483755 0.06390800 -0.134978543 0.22219876 -0.029791010
[24,] 0.03663682 0.14964563 0.380769937 0.04887125 -0.181505291
[25,] 0.21844303 0.21251250 -0.092643024 -0.08459933 -0.041012944
[26,] 0.03146882 -0.04539684 0.128353670 -0.26946049 -0.033165280
[27,] 0.16511501 0.18748156 -0.001570025 -0.11028449 -0.067216665
[28,] 0.12563546 -0.15022985 -0.251560894 -0.14310074 0.085496472
[29,] 0.09959864 0.06840724 0.039239453 -0.16328892 -0.053525914
[30,] 0.18828443 0.06933826 -0.146343748 -0.14252305 -0.047378800
[31,] 0.10619065 0.03318379 -0.023171971 -0.01634178 -0.039357164
[32,] 0.06199126 -0.01572483 0.025775411 -0.27846041 -0.020303504
[33,] -0.03887708 -0.04867093 0.444702495 -0.11073835 -0.267501226
[34,] 0.16249057 0.27896568 0.092346466 -0.14899540 -0.168317704
[35,] 0.08880311 0.12058372 0.199176919 0.22020238 -0.219093227
[36,] 0.12652320 0.00904771 -0.196233272 -0.23869870 0.053669639
[37,] 0.12865898 0.08057232 -0.112181262 -0.12636002 -0.008495483
[38,] 0.08764355 0.01222865 -0.152791143 -0.20826849 0.071518275
[39,] 0.14452757 0.15636344 -0.103095883 0.01313241 -0.032957984
[40,] 0.11511785 0.08851215 -0.064381624 -0.13734630 -0.055181864
$v
[,1] [,2] [,3] [,4] [,5]
[1,] -2.161539e-05 1.969082e-04 9.783142e-01 -2.007724e-01 -5.090993e-02
[2,] -9.295601e-02 9.956700e-01 -3.248368e-04 -5.870256e-04 -3.671252e-05
[3,] -9.956702e-01 -9.295601e-02 5.866027e-06 4.406851e-05 2.142571e-06
[4,] -2.624744e-06 5.694367e-05 5.303213e-02 5.202400e-03 9.985793e-01
[5,] -1.532831e-05 6.408762e-04 2.002221e-01 9.796239e-01 -1.573699e-02
然后输入
dput(analise)
structure(list(Dif_Aud = c(-17307,
-14583, -23820, 3869, -11683, -25429, -12390, -7121, -4720, -14668,
675, -12952, 2017, -6406, -7080, -2457, -12896, -1915, 103, -5392,
-4223, -6717, -9809, 1172, -7404, -2676, -5028, -10027, -3979,
-8792, -5084, -3711, 1088, -2948, -2286, -6703, -5305, -4517,
-4565, -4399), Dif_Alc = c(-105249, -132158, -208902, -30392,
-129625, -185373, -116205, -89169, -75378, -96903, 25897, -104380,
51298, -60997, -86041, -89800, -143305, -75992, 13328, -61935,
-83112, -68173, -119686, -21680, -127921, -18278, -96745, -73034,
-58269, -110035, -62047, -36152, 22788, -95394, -52071, -73867,
-75255, -51180, -84667, -67367), Dif_Shr = c(0.361, 0.43, -0.796,
1.77, 0.0860000000000003, -1.413, -0.25, 0.164, 0.39, -0.644,
0.837, -0.569, 0.934, 0.0620000000000003, -0.0289999999999999,
0.408, -0.663, 0.365, 0.544, -0.018, 0.085, -0.218, -0.55, 0.507,
-0.356, 0.0600000000000001, -0.18, -0.709, -0.118, -0.608, -0.253,
-0.129, 0.317, -0.093, -0.034, -0.482, -0.352, -0.292, -0.306,
-0.325), Dif_Ats = c(-2.26666666000001, 2.16666666, -1.53333333,
4.61666667, -0.43333333, -7.56666666, -3.75, -0.43333333, 0.866666670000001,
-7.95, -1.98333333, -6.55, -4.3, -0.899999999999999, -1.6, 4.76666667,
-2.13333334, 4.31666666, -2.25, -0.0666666599999992, 0.550000000000001,
-4.1, 1.53333333, 5.35, -1.1, -4.2, -0.68333333, -7.33333333,
-2.25, -4.1, -0.933333340000001, -4.98333333, 1.28333334, 0.683333340000001,
5.83333334, -6.26666667, -2.9, -5.06666667, 0.266666669999999,
-2.48333334)), .Names = c("Dif_Aud", "Dif_Alc", "Dif_Shr",
"Dif_Ats"), row.names = c("DKIDS", "CARTOON", "SPORTV", "MULTISHOW",
"MEGAPIX", "FOX", "TNT", "SPACE", "VIVA", "DISNEY", "TC PREMIUM",
"UNIVERSAL", "TC PIPOCA", "AXN", "DISCOVERY CHANNEL", "GNEWS",
"FX", "GNT", "TC ACTION", "NICK", "SPORTV_2", "WARNER", "H&H",
"ANIMAL", "NATGEO", "ESPN BR", "CINEMAX", "FOX SPORTS", "SONY",
"HISTORY", "BOOMERANG", "TC FUN", "HBO", "SPORTV 3", "FOX Life",
"GLOOB", "TLC", "DISNEY XD", "A&E", "MTV"), class = "data.frame")
有没有人知道可能出现什么问题?
由于
答案 0 :(得分:2)
您无法对具有负值的数据执行CA,例如您显示的数据集。原始方法适用于非负频率/计数数据,例如您可能在列联表中找到。
我们不允许CA适用于素食主义包中具有非正行和的数据。同样,列总和需要是积极的。因此,总和也需要是正数,这三个总和用于对数据进行加权,作为CA的一部分。
您的数据显然不符合该方法的要求。
相反,考虑PCA,虽然您需要标准化输入数据,否则具有大值的变量将倾向于支配排序,因为它们往往会有更大的差异。