Skip to contents

Function to perform a two-fold cross-validation to select the optimal number of dimensions of multiblock methods, i.e., multiblock principal component analysis with instrumental Variables or multiblock partial least squares

Usage

# S3 method for multiblock
testdim(object, nrepet = 100, quantiles = c(0.25, 0.75), ...)

Arguments

object

an object of class multiblock created by mbpls or mbpcaiv

nrepet

integer indicating the number of repetitions

quantiles

a vector indicating the lower and upper quantiles to compute

...

other arguments to be passed to methods

Value

An object of class krandxval

References

Stone M. (1974) Cross-validatory choice and assessment of statistical predictions. Journal of the Royal Statistical Society, 36, 111-147.

Bougeard, S. and Dray S. (2018) Supervised Multiblock Analysis in R with the ade4 Package. Journal of Statistical Software, 86 (1), 1-17. doi:10.18637/jss.v086.i01

Author

Stéphanie Bougeard (stephanie.bougeard@anses.fr) and Stéphane Dray (stephane.dray@univ-lyon1.fr)

Examples

data(chickenk)
Mortality <- chickenk[[1]]
dudiY.chick <- dudi.pca(Mortality, center = TRUE, scale = TRUE, scannf =
FALSE)
ktabX.chick <- ktab.list.df(chickenk[2:5])
resmbpcaiv.chick <- mbpcaiv(dudiY.chick, ktabX.chick, scale = TRUE,
option = "uniform", scannf = FALSE)
## nrepet should be higher for a real analysis
test <- testdim(resmbpcaiv.chick, nrepet = 10)
test
#> Two-fold cross-validation
#> Call: testdim.multiblock(object = resmbpcaiv.chick, nrepet = 10)
#> 
#> Results for 20 statistics
#> 
#> Root mean square error of calibration:
#>      N.rep      Mean       25%       75%
#> Ax1     10 0.4598499 0.4369296 0.4803989
#> Ax2     10 0.4422496 0.4199493 0.4601725
#> Ax3     10 0.4298390 0.4107063 0.4479548
#> Ax4     10 0.4210801 0.4026038 0.4382733
#> Ax5     10 0.4187494 0.3995489 0.4365796
#> Ax6     10 0.4173699 0.3983316 0.4354806
#> Ax7     10 0.4163302 0.3969787 0.4344349
#> Ax8     10 0.4157841 0.3964867 0.4340176
#> Ax9     10 0.4154674 0.3961256 0.4338475
#> Ax10    10 0.4152658 0.3958908 0.4337115
#> Ax11    10 0.4151379 0.3957517 0.4335911
#> Ax12    10 0.4150703 0.3956845 0.4335371
#> Ax13    10 0.4150367 0.3956521 0.4335149
#> Ax14    10 0.4150137 0.3956357 0.4335000
#> Ax15    10 0.4150021 0.3956262 0.4334914
#> Ax16    10 0.4149973 0.3956196 0.4334874
#> Ax17    10 0.4149956 0.3956169 0.4334865
#> Ax18    10 0.4149951 0.3956165 0.4334862
#> Ax19    10 0.4149950 0.3956165 0.4334860
#> Ax20     5 0.4264020 0.4123904 0.4440801
#> 
#> Root mean square error of validation:
#>      N.rep      Mean       25%       75%
#> Ax1     10 0.5088055 0.4838729 0.5448644
#> Ax2     10 0.5005350 0.4722464 0.5425479
#> Ax3     10 0.4926802 0.4680893 0.5282297
#> Ax4     10 0.4849091 0.4591142 0.5186562
#> Ax5     10 0.4847752 0.4575356 0.5216695
#> Ax6     10 0.4863368 0.4564953 0.5235907
#> Ax7     10 0.4873767 0.4590477 0.5248432
#> Ax8     10 0.4875363 0.4580264 0.5260049
#> Ax9     10 0.4876833 0.4587019 0.5252170
#> Ax10    10 0.4877578 0.4586004 0.5245693
#> Ax11    10 0.4880003 0.4585878 0.5248892
#> Ax12    10 0.4879615 0.4578597 0.5249629
#> Ax13    10 0.4880975 0.4579190 0.5250191
#> Ax14    10 0.4880542 0.4576979 0.5250432
#> Ax15    10 0.4880597 0.4579934 0.5250115
#> Ax16    10 0.4880731 0.4580535 0.5250929
#> Ax17    10 0.4880899 0.4581032 0.5250364
#> Ax18    10 0.4881063 0.4580853 0.5250676
#> Ax19    10 0.4881107 0.4581013 0.5250680
#> Ax20     5 0.4693165 0.4410840 0.4877695
if(adegraphicsLoaded())
plot(test)