Hi all,

I am trying to do a k-fold cross validation on a data set n=89 of shrub 
biomass as predicted by several shrub measurements.

The code I used is simple for 10 folds:

 > library(DAAG)
 > fit<-lm(biomass~stems+width+height)
|> cv.lm(df=shrub, fit, m=10)

But the output would suggest that it is only recognizing the first 
predictor of the three predictor model (see below).  I think the df 
should be 3 and residual df = 85.  When I run the model with |> 
fit<-lm(biomass~stems), the output is the same... so I am fairly certain 
that the other two predictors are being ignored.
|
Does anyone know what I am doing wrong, or how to get it to recognize 
the entire model?

Thanks!!

-Jake




Analysis of Variance Table

Response: yv
           Df   Sum Sq  Mean Sq F value  Pr(>F)
xv         1 62304974 62304974    58.4 2.7e-11 ***
Residuals 87 92902044  1067840
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


fold 1
Observations in test set: 5 9 41 50 51 64 81 84
             X1   X2     X3   X4   X5    X6     X7  X8
stems        3    4    7.0    7   40   5.0    3.0  13
Predicted  420  450  541.4  541 1545 480.6  419.8 724
totalbio   158  153   76.8  210 6734 442.0   35.4 866
Residual  -262 -297 -464.6 -332 5189 -38.6 -384.4 142

Sum of squares = 27572814    Mean square = 3446602    n = 8

fold 2
Observations in test set: 12 25 30 42 47 56 79 82 83
               X1  X2   X3  X4     X5   X6    X7  X8   X9
stems        3.0   1   16   6    4.0    6   9.0  15    8
Predicted  450.3 384  879 549  483.3  549 648.1 846  615
totalbio    26.8 513  316 861   88.2  229 601.8 967  267
Residual  -423.5 129 -562 312 -395.1 -320 -46.3 121 -348

Sum of squares = 1006042    Mean square = 111782    n = 9

fold 3
Observations in test set: 2 8 16 29 39 44 58 67 74
              X1   X2    X3   X4   X5   X6   X7   X8   X9
stems       5.0    2   168   12   19   17    4   20   16
Predicted 445.4  297  8525  792 1139 1040  396 1189  991
totalbio  472.6   85  2458  379  861  112   57  836 1856
Residual   27.2 -212 -6066 -413 -278 -928 -339 -353  865

Sum of squares = 38941654    Mean square = 4326850    n = 9

fold 4
Observations in test set: 22 26 37 48 59 61 62 71 85
              X1   X2   X3   X4    X5     X6   X7   X8   X9
stems       1.0    8   34    6   5.0    4.0   15   34   12
Predicted 374.5  598 1429  534 502.3  470.4  822 1429  726
totalbio  294.6  172  544   75 488.6   71.5  444 4935  317
Residual  -79.9 -426 -885 -459 -13.8 -398.9 -378 3506 -409

Sum of squares = 13942910    Mean square = 1549212    n = 9

fold 5
Observations in test set: 13 15 19 32 40 54 66 70 72
               X1   X2   X3   X4   X5     X6     X7   X8     X9
stems        3.0   26    5    9   12    5.0    3.0    7    3.0
Predicted  465.7 1211  531  660  757  530.5  465.7  595  465.7
totalbio    34.2 2256   82  386  180   90.6   96.1  106   53.4
Residual  -431.5 1045 -449 -274 -578 -439.9 -369.6 -489 -412.3

Sum of squares = 2627937    Mean square = 291993    n = 9

fold 6
Observations in test set: 24 33 45 49 52 57 68 86 88
             X1   X2   X3   X4     X5   X6   X7   X8   X9
stems        3   11   14   30    2.0    1   14    6    4
Predicted  407  678  779 1322  372.9  339  779  508  441
totalbio  1956  195 1016  480   40.5  237  138  246 2806
Residual  1550 -483  236 -841 -332.4 -102 -642 -262 2366

Sum of squares = 9595848    Mean square = 1066205    n = 9

fold 7
Observations in test set: 20 21 23 28 36 63 65 75 77
             X1   X2    X3     X4   X5  X6   X7   X8   X9
stems        1   19   2.0    2.0  100   8    5    2    4
Predicted  419  879 444.6  444.6 2948 598  521  445  496
totalbio    28 1235 405.2   54.2 7679 995  170   27  195
Residual  -391  356 -39.4 -390.4 4732 397 -352 -418 -300

Sum of squares = 23367157    Mean square = 2596351    n = 9

fold 8
Observations in test set: 18 34 38 43 60 69 80 87 89
             X1   X2   X3   X4  X5   X6   X7   X8    X9
stems       11    3    9   10   7    6    1   38   1.0
Predicted  674  414  609  641 544  511  348 1552 348.5
totalbio  1782  102  131  139 652  106 1320 3139 418.4
Residual  1108 -311 -477 -502 108 -405  971 1587  69.9

Sum of squares = 5447876    Mean square = 605320    n = 9

fold 9
Observations in test set: 6 11 14 31 35 53 55 73 76
             X1  X2   X3   X4     X5     X6   X7   X8   X9
stems        1   2  144    7    4.0    5.0   31   19    7
Predicted  350 386 5398  562  456.3  491.6 1409  986  562
totalbio  1229 650 4572  438   66.4   63.3  520 1574  398
Residual   879 264 -825 -124 -389.9 -428.3 -889  588 -165

Sum of squares = 3038630    Mean square = 337626    n = 9

fold 10
Observations in test set: 1 3 4 7 10 17 27 46 78
              X1     X2    X3  X4  X5    X6   X7   X8   X9
stems       3.0    4.0   5.0   4   2   1.0    2   19   17
Predicted 446.1  479.2 512.4 479 413 379.8  413  977  910
totalbio  376.2   96.8 559.2 828 528 286.6  284  445  272
Residual  -69.9 -382.4  46.8 349 115 -93.2 -129 -531 -638

Sum of squares = 1003337    Mean square = 111482    n = 9
Overall ms
    1421845
|

	[[alternative HTML version deleted]]

