[R] predict.fda - NAs are not allowed in subscripted assignments

monica.carro at libero.it monica.carro at libero.it
Thu Mar 5 14:35:59 CET 2009


Dear R users,
I'm trying to perform flexible discriminant analysis (fda) with 
method bruto.

I applied the fda function on my training data:

bruto.fda <- fda
(fda.formula,data=train.data)

where fda.formula is: PRES ~ VA_D123 + VA_D124 + 
VA_D127 + VA_DARU + VA_DCAN + VA_DFON + 
    VA_DLAP + VA_DRID + VA_DRIR + 
VA_VVEG + VA_WDIN + VA_DIF3 + 
    VA_DIF4 + VA_DIF5 + VA_CAAC + VA_CABC + 
VA_CABO + VA_CACA + 
    VA_CACC + VA_CAMP + VA_CAPA + VA_CAUB + VA_CMCA + 
VA_CMIN + 
    VA_CMLA + VA_CMMU + VA_CMRO + VA_D109 + VA_D110 + VA_D111 + 
    
VA_D112 + VA_D113 + VA_D114 + VA_D115 + VA_D116 + VA_D118 + 
    VA_D119 + 
VA_D120 + VA_D121


and obtained this result:

Call:
fda(formula = fda.formula, 
data = train.data)

Dimension: 1 

Percent Between-Group Variance Explained:
 
v1 
100 

Degrees of Freedom (per dimension): 4 

Training Misclassification 
Error: 0 ( N = 4 )


My training data are:

'data.frame':   4 obs. of  41 
variables:
 $ VA_D123: num  120 240 610 340
 $ VA_D124: num  2870 3000 1900 
1170
 $ VA_D127: num  430 1770 690 1470
 $ VA_DARU: num  69 62 129 57
 $ 
VA_DCAN: num  664 356 667 131
 $ VA_DFON: num  235 650 361 489
 $ VA_DLAP: num  
30 2 242 219
 $ VA_DRID: num  1 0 4 7
 $ VA_DRIR: num  325 117 46 132
 $ 
VA_VVEG: num  1.5 4.5 4.1 1.5
 $ VA_WDIN: num  210 20 165 85
 $ VA_DIF3: num  
138 306 154 240
 $ VA_DIF4: num  47 0 4 7
 $ VA_DIF5: num  1 737 218 527
 $ 
VA_CAAC: num    0.0 258.7   0.0  88.3
 $ VA_CABC: num  117.9 137.6  79.8  38.1
 
$ VA_CABO: num  147.4 215.9  99.8  95.2
 $ VA_CACA: num  117.9 163.0  79.8  
19.0
 $ VA_CACC: num  132.7 176.2  89.8  38.1
 $ VA_CAMP: num  147.4 194.6  
99.8  85.7
 $ VA_CAPA: num    0.0 175.5   0.0  66.7
 $ VA_CAUB: num  117.9 
178.9  79.8  57.1
 $ VA_CMCA: num  132.65   4.76  89.80   0.00
 $ VA_CMIN: num  
132.7  23.8  89.8   0.0
 $ VA_CMLA: num  147.4  45.6  99.8   0.0
 $ VA_CMMU: 
num  132.65   4.76  89.80   0.00
 $ VA_CMRO: num  0 0 0 0
 $ VA_D109: num  3610 
2740 4200 3420
 $ VA_D110: num  310 3780 2960 4850
 $ VA_D111: num  12930  7980 
14630  9350
 $ VA_D112: num  1580 6640 2460 4550
 $ VA_D113: num  1030 10 200 
370
 $ VA_D114: num  450 1590 1480 670
 $ VA_D115: num  10 20 0 0
 $ VA_D116: 
num  780 1120 570 410
 $ VA_D118: num  1690 3260 1560 3930
 $ VA_D119: num  
13730  8660 15380 10070
 $ VA_D120: num  1270 70 570 360
 $ VA_D121: num  350 
410 140 270
 $ CAT    : num  254935 294186 296143 306054
 $ PRES   : num  1 1 0 
0

Now I want to predict fitted values for my new.data

'data.frame':   418507 
obs. of  41 variables:
 $ VA_D123: num  2560 2520 2480 2440 2400 2360 2320 2280 
2230 2190 ...
 $ VA_D124: num  3410 3420 3430 3440 3460 3470 3480 3490 3500 
3510 ...
 $ VA_D127: num  1710 1700 1690 1680 1670 1650 1640 1630 1610 1580 ...

 $ VA_DARU: num  29 24 19 14 9 4 1 6 11 16 ...
 $ VA_DCAN: num  882 881 879 878 
877 876 875 873 872 871 ...
 $ VA_DFON: num  1742 1741 1740 1739 1738 ...
 $ 
VA_DLAP: num  346 341 336 331 326 321 316 311 306 301 ...
 $ VA_DRID: num  16 
18 19 21 22 21 19 18 16 15 ...
 $ VA_DRIR: num  1419 1420 1421 1422 1423 ...
 $ 
VA_VVEG: num  1 2 2 2 1 1 4 4 4 4 ...
 $ VA_WDIN: num  327 340 353 367 380 393 
406 420 434 447 ...
 $ VA_DIF3: num  36 32 29 26 23 21 19 18 16 15 ...
 $ 
VA_DIF4: num  119 114 109 104 99 94 89 84 79 74 ...
 $ VA_DIF5: num  2136 2133 
2130 2127 2124 ...
 $ VA_CAAC: num   12.6  25.2  22.1  25.2 129.3 ...
 $ 
VA_CABC: num   0.0  0.0  0.0 23.8 54.0 ...
 $ VA_CABO: num  17.5 17.5 17.5 46.5 
88.0 ...
 $ VA_CACA: num  17.5 17.5 17.5 39.7 98.4 ...
 $ VA_CACC: num  20.0 
20.0 20.0 38.5 73.2 ...
 $ VA_CAMP: num   17.5  17.5  17.5  43.1 102.7 ...
 $ 
VA_CAPA: num   20.0  20.0  20.0  45.4 105.7 ...
 $ VA_CAUB: num  15.0 15.0 15.0 
20.4 45.4 ...
 $ VA_CMCA: num  0 0 0 0 0 0 0 0 0 0 ...
 $ VA_CMIN: num  0 0 0 0 
0 0 0 0 0 0 ...
 $ VA_CMLA: num   0.0  0.0  0.0 13.6 36.3 ...
 $ VA_CMMU: num  
0 0 0 0 0 0 0 0 0 0 ...
 $ VA_CMRO: num  0 0 0 0 0 ...
 $ VA_D109: num  5050 
5010 4960 4920 4880 4840 4800 4760 4720 4680 ...
 $ VA_D110: num  5000 4970 
4940 4910 4880 4850 4820 4790 4760 4730 ...
 $ VA_D111: num  2600 2550 2500 
2450 2400 2350 2300 2250 2200 2150 ...
 $ VA_D112: num  19400 19350 19300 19250 
19200 ...
 $ VA_D113: num  770 740 710 680 650 620 590 570 540 520 ...
 $ 
VA_D114: num  480 450 420 400 360 310 260 210 160 110 ...
 $ VA_D115: num  0 0 
0 0 0 0 50 100 100 120 ...
 $ VA_D116: num  1050 1010 970 940 910 880 850 820 
790 760 ...
 $ VA_D118: num  620 630 640 650 670 690 720 750 780 810 ...
 $ 
VA_D119: num  16320 16270 16220 16170 16120 ...
 $ VA_D120: num  1980 1940 1900 
1860 1820 1780 1730 1690 1660 1630 ...
 $ VA_D121: num  230 240 250 240 230 210 
210 220 230 250 ...
 $ CAT    : num  1 2 3 4 5 6 7 8 9 10 ...
 $ PRES   : num  
NA NA NA NA NA NA NA NA NA NA ...

I'm using:
bruto.fitted <- predict(bruto.fda,
new.data)

but obtained the following message:

Error in mindist[l] <- ndist[l] 
: 
  NAs are not allowed in subscripted assignments


What does it means? I can 
I solve the problem?

P.S The same error is returned when I do:
bruto.fitted <- 
predict(bruto.fda,train.data)

Any help is appreciated...thanks in advance!


Monica




More information about the R-help mailing list