'Error when using DiceKriging function km: 'Error in t.default(T) : argument is not a matrix'

I'm attempting to apply the km function from the DiceKriging package to a multivariate dataset. When I use my entire dataset (dimensions = [938,13]), the algorithm runs without problem. When I use a smaller subset of this dataset (dimensions = [94,13]), I encounter this error: Error in t.default(T) : argument is not a matrix

I'm not sure what's causing this error to occur when analyzing the data subset. For reference, here's the data and code I'm running:

g<-km(design=sub.ev,response=sub.rv,covtype="matern5_2")

> sub.ev
1   -0.1519272795        1    0        0 27.769 27.45715 8.02   7.330 21.16 17.73979  0.000 4119.280 0.5338750
2   -0.1436123857        1    0        0 27.420 27.45715 8.04   6.895 20.19 17.73979  0.000 4119.280 0.5338750
3   -0.1144934053        1    0        0 27.021 27.45715 8.06   6.690 19.54 17.73979  0.000 4119.280 0.5338750
4   -0.1585420923        1    0        0 26.531 27.45715 8.09   6.160 18.64 17.73979  0.000 4119.280 0.5338750
5   -0.0588867480        1    0        0 26.107 27.45715 8.11   5.790 17.71 17.73979  0.000 4119.280 0.5338750
6   -0.0402306730        1    0        0 25.704 27.45715 8.15   5.840 17.26 17.73979  0.000 4119.280 0.5338750
7    0.0161781773        1    0        0 25.265 27.45715 8.18   5.390 16.77 17.73979  0.000 4119.280 0.5338750
8    0.0660891620        1    0        0 24.967 27.45715 8.21   5.425 16.18 17.73979  0.000 4119.280 0.5338750
9    0.0079745010        1    0        0 24.665 27.45715 8.24   5.250 16.51 17.73979  0.000 4119.280 0.5338750
10  -0.0191421967        1    0        0 24.416 27.45715 8.27   5.090 15.46 17.73979  0.000 4119.280 0.5338750
11   0.0364618430        1    0        0 24.232 27.45715 8.29   4.820 14.47 17.73979  0.000 4119.280 0.5338750
12   0.0160652203        1    0        0 24.077 27.45715 8.31   4.745 15.57 17.73979  0.000 4119.280 0.5338750
13   0.0763233707        1    0        0 23.906 27.45715 8.33   4.680 15.14 17.73979  0.000 4119.280 0.5338750
14   0.0211064293        1    0        0 23.794 27.45715 8.35   4.940 18.25 17.73979  0.000 4119.280 0.5338750
15   0.0166228227        1    0        0 23.642 27.45715 8.36   5.190 14.60 17.73979  0.000 4119.280 0.5338750
16   0.0022511447        1    0        0 23.531 27.45715 8.37   5.425 15.30 17.73979  0.000 4119.280 0.5338750
17  -0.0122220320        1    0        0 23.445 27.45715 8.39   6.110 14.79 17.73979  0.000 4119.280 0.5338750
18  -0.0057961107        1    0        0 23.442 27.45715 8.39   5.940 14.49 17.73979  0.000 4119.280 0.5338750
19  -0.0322631907        1    0        0 23.512 27.45715 8.39   5.380 14.38 17.73979  0.000 4119.280 0.5338750
95   0.0159845000        1    0        0 27.306 27.45715 8.24   7.380 17.14 17.73979  0.000 4119.280 0.5338750
96  -0.0437959553        1    0        0 27.054 27.45715 8.25   7.100 15.35 17.73979  0.000 4119.280 0.5338750
97  -0.0805486920        1    0        0 26.520 26.88009 8.27   6.900 14.87 16.96688  0.000 3725.365 0.5422500
98  -0.0941385073        1    0        0 26.306 26.88009 8.30   6.725 15.19 16.96688  0.000 3725.365 0.5422500
99  -0.1159254400        1    0        0 26.039 26.88009 8.32   6.590 15.42 16.96688  0.000 3725.365 0.5422500
100 -0.0362266430        1    0        0 25.637 26.88009 8.36   6.280 14.34 16.96688  0.000 3725.365 0.5422500
101  0.0326682983        1    0        0 25.299 26.88009 8.38   6.100 14.36 16.96688  0.000 3725.365 0.5422500
102  0.0471005793        1    0        0 24.742 26.88009 8.44   5.955 13.48 16.96688  0.000 3725.365 0.5422500
103 -0.0596346010        1    0        0 24.262 26.88009 8.49   5.530 12.91 16.96688  0.000 3725.365 0.5422500
104 -0.0043536683        1    0        0 23.856 26.88009 8.52   5.315 12.80 16.96688  0.000 3725.365 0.5422500
105 -0.0177714297        1    0        0 23.578 26.88009 8.54   5.240 13.01 16.96688  0.000 3725.365 0.5422500
106  0.0169363000        1    0        0 23.313 26.88009 8.56   5.225 12.69 16.96688  0.000 3725.365 0.5422500
107 -0.0170451183        1    0        0 23.023 26.88009 8.59   5.090 12.71 16.96688  0.000 3725.365 0.5422500
108  0.0231896353        1    0        0 22.755 26.88009 8.62   5.280 11.58 16.96688  0.000 3725.365 0.5422500
109  0.0053651757        1    0        0 22.510 26.88009 8.65   5.690 11.28 16.96688  0.000 3725.365 0.5422500
110  0.0281674793        1    0        0 22.342 26.88009 8.68   5.555 11.21 16.96688  0.000 3725.365 0.5422500
111  0.0009483843        1    0        0 22.168 26.88009 8.70   5.770 10.68 16.96688  0.000 3725.365 0.5422500
112  0.0147559413        1    0        0 22.151 26.88009 8.69   5.995 11.57 16.96688  0.000 3725.365 0.5422500
190 -0.0115338953        1    0        0 27.062 25.91990 8.21   8.000 15.35 14.07031  0.000 3949.390 0.5342917
191 -0.0189870410        1    0        0 26.545 25.91990 8.22   7.870 14.21 14.07031  0.000 3949.390 0.5342917
192 -0.0184237180        1    0        0 26.104 25.91990 8.25   7.795 20.04 14.07031  0.000 3949.390 0.5342917
193 -0.0319295797        1    0        0 25.859 25.91990 8.26   7.730 13.14 14.07031  0.000 3949.390 0.5342917
194 -0.0184753123        1    0        0 25.573 25.91990 8.30   7.585 12.93 14.07031  0.000 3949.390 0.5342917
195 -0.0197481060        1    0        0 25.005 25.91990 8.36   7.490 11.29 14.07031  0.000 3949.390 0.5342917
196 -0.0215467360        1    0        0 24.710 25.91990 8.39   7.245 11.10 14.07031  0.000 3949.390 0.5342917
197  0.0265223447        1    0        0 24.455 25.91990 8.42   7.240 11.44 14.07031  0.000 3949.390 0.5342917
198  0.0470763840        1    0        0 24.087 25.91990 8.45   7.225 11.42 14.07031  0.000 3949.390 0.5342917
199  0.0622169450        1    0        0 23.673 25.91990 8.48   7.260 11.20 14.07031  0.000 3949.390 0.5342917
200 -0.0104582193        1    0        0 23.301 25.91990 8.52   7.190 11.57 14.07031  0.000 3949.390 0.5342917
201  0.0121972077        1    0        0 23.005 25.91990 8.55   7.220 10.71 14.07031  0.000 3949.390 0.5342917
202  0.0219721027        1    0        0 22.745 25.91990 8.59   7.245 10.86 14.07031  0.000 3949.390 0.5342917
203  0.0208879210        1    0        0 22.576 25.91990 8.61   7.180 10.62 14.07031  0.000 3949.390 0.5342917
204  0.0192644400        1    0        0 22.417 25.91990 8.63   7.220 10.47 14.07031  0.000 3949.390 0.5342917
205  0.0066226250        1    0        0 22.243 25.91990 8.65   7.170 10.29 14.07031  0.000 3949.390 0.5342917
206  0.0036012053        1    0        0 22.136 25.91990 8.67   7.200 10.86 14.07031  0.000 3949.390 0.5342917
207 -0.0027906963        1    0        0 22.012 25.91990 8.69   7.150 10.57 14.07031  0.000 3949.390 0.5342917
290  0.2266387893        1    0        0 27.763 26.21360 8.21   7.765 23.37 17.97479  0.000 3554.510 0.5938333
291  0.1151646527        1    0        0 27.377 26.21360 8.23   7.720 24.43 17.97479  0.000 3554.510 0.5938333
292 -0.0218444193        1    0        0 27.285 26.21360 8.23   7.655 23.40 17.97479  0.000 3554.510 0.5938333
293 -0.0908422353        1    0        0 26.935 26.21360 8.26   7.590 21.96 17.97479  0.000 3554.510 0.5938333
294 -0.1716709177        1    0        0 26.792 26.21360 8.28   7.540 23.30 17.97479  0.000 3554.510 0.5938333
295 -0.1943201847        1    0        0 26.869 26.21360 8.28   7.420 25.06 17.97479  0.000 3554.510 0.5938333
296 -0.1529985130        1    0        0 26.733 26.21360 8.28   7.310 33.62 17.97479  0.000 3554.510 0.5938333
297 -0.1106344563        1    0        0 26.394 26.21360 8.29   7.160 29.06 17.97479  0.000 3554.510 0.5938333
298 -0.0638089193        1    0        0 25.973 26.21360 8.32   7.010 23.25 17.97479  0.000 3554.510 0.5938333
299 -0.1208449610        1    0        0 25.501 26.21360 8.37   6.970 21.10 17.97479  0.000 3554.510 0.5938333
300 -0.2310616323        1    0        0 25.192 26.21360 8.40   7.010 19.16 17.97479  0.000 3554.510 0.5938333
301 -0.2043969970        1    0        0 24.867 26.21360 8.43   7.030 17.80 17.97479  0.000 3554.510 0.5938333
302 -0.2003585363        1    0        0 24.634 26.21360 8.45   7.080 17.01 17.97479  0.000 3554.510 0.5938333
303 -0.2535806687        1    0        0 24.468 26.21360 8.47   7.130 16.41 17.97479  0.000 3554.510 0.5938333
304 -0.2464920640        1    0        0 24.234 26.21360 8.50   7.055 15.50 17.97479  0.000 3554.510 0.5938333
389  0.2461277410        1    0        0 27.981 26.78711 8.29   6.760 20.65 22.02125  0.000 3589.260 0.7715417
390  0.1660650063        1    0        0 27.915 26.78711 8.29   6.575 22.44 22.02125  0.000 3589.260 0.7715417
391 -0.0609562143        1    0        0 27.757 26.78711 8.30   6.580 22.92 22.02125  0.000 3589.260 0.7715417
392 -0.2020911323        1    0        0 27.527 26.78711 8.32   6.590 22.91 22.02125  0.000 3589.260 0.7715417
393 -0.2980735343        1    0        0 27.563 26.78711 8.31   6.510 24.30 22.02125  0.000 3589.260 0.7715417
394 -0.2370078227        1    0        0 27.400 26.78711 8.32   6.525 22.67 22.02125  0.000 3589.260 0.7715417
395 -0.3440380117        1    0        0 27.274 26.78711 8.32   6.530 22.45 22.02125  0.000 3589.260 0.7715417
396 -0.0057092573        1    0        0 27.132 26.78711 8.30   6.490 22.08 22.02125  0.000 3589.260 0.7715417
397 -0.0241878650        1    0        0 27.018 26.78711 8.30   6.450 24.00 22.02125  0.000 3589.260 0.7715417
398 -0.2080665820        1    0        0 26.834 26.78711 8.32   6.405 25.81 22.02125  0.000 3589.260 0.7715417
399 -0.1716383953        1    0        0 26.637 26.78711 8.33   6.340 25.19 22.02125  0.000 3589.260 0.7715417
400 -0.2570107420        1    0        0 26.476 26.78711 8.34   6.300 22.05 22.02125  0.000 3589.260 0.7715417
495 -0.1302196527        1    0        0 25.967 26.53893 8.40   6.300 11.90 15.57448  2.286 2313.087 0.6087083
496 -0.0391473870        1    0        0 25.708 26.53893 8.41   6.260 10.77 15.57448  2.286 2313.087 0.6087083
587 -0.0382961500        1    0        0 28.647 26.98353 8.28   8.110 17.52 12.12667  0.000 3980.156 0.4227083
588 -0.0035965477        1    0        0 28.652 26.98353 8.26   7.920 21.14 12.12667  0.000 3980.156 0.4227083
589 -0.0050414577        1    0        0 28.307 26.98353 8.27   7.830 18.39 12.12667  0.000 3980.156 0.4227083
590  0.0354186967        1    0        0 27.896 26.98353 8.27   6.825 17.35 12.12667  0.000 3980.156 0.4227083
591 -0.0676664363        1    0        0 27.581 26.98353 8.27   6.110 16.06 12.12667  0.000 3980.156 0.4227083
592 -0.1723716683        1    0        0 27.223 26.98353 8.29   6.245 15.14 12.12667  0.000 3980.156 0.4227083
688  0.1598606430        1    0        0 28.738 27.54833 8.35   5.965 24.99 15.51010  0.000 2554.804 0.4730417
912 -0.1977195740        1    0        0 26.653 27.24447 9.09   7.635 11.38 12.71729  0.000 4002.945 0.5135417
913 -0.1306465143        1    0        0 27.399 27.24447 9.07   7.420 12.84 12.71729  0.000 4002.945 0.5135417
914 -0.1175953210        1    0        0 28.024 27.24447 9.01   7.270 13.91 12.71729  0.000 4002.945 0.5135417

> sub.rv
 [1] 3.24 2.65 2.18 1.75 1.52 1.32 1.25 1.18 1.16 1.10 1.05 1.01 0.95 0.88 0.83 0.76 0.72 0.61 0.58 3.64 3.46 2.97 2.64 2.27 2.07 1.72 1.33 1.03 0.89 0.82 0.69 0.64 0.60
[34] 0.55 0.44 0.33 0.26 4.65 4.10 3.55 3.30 2.70 2.12 1.74 1.53 1.27 1.02 0.88 0.76 0.66 0.58 0.54 0.47 0.40 0.28 5.87 5.24 5.09 4.22 3.90 3.94 3.41 2.75 2.18 1.86 1.67
[67] 1.52 1.42 1.34 1.35 5.88 5.56 4.88 3.98 3.76 3.31 3.11 2.78 2.41 1.97 1.65 1.39 1.63 1.44 4.08 4.83 3.84 3.23 2.83 2.36 4.33 1.86 3.17 4.48
r


Solution 1:[1]

I've run into the same issue. It is resolved when you remove the variables in your design matrix that have 0 variance (as these are simply constants). In your case, you need to remove columns (3:5).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 watkilj