
Computes individual PRESS for k-fold cross validated partial least squares regression models.
Source:R/kfolds2Pressind.R
kfolds2Pressind.Rd
This function computes individual PRESS for k-fold cross validated partial least squares regression models.
Value
- list
Individual Press vs number of components for the first group partition
- list()
...
- list
Individual Press vs number of components for the last group partition
Note
Use cv.plsR
to create k-fold cross validated partial
least squares regression models.
References
Nicolas Meyer, Myriam Maumy-Bertrand et Frédéric Bertrand (2010). Comparing the linear and the logistic PLS regression with qualitative predictors: application to allelotyping data. Journal de la Societe Francaise de Statistique, 151(2), pages 1-18. https://www.numdam.org/item/JSFS_2010__151_2_1_0/
See also
kfolds2coeff
, kfolds2Press
,
kfolds2Mclassedind
and kfolds2Mclassed
to
extract and transforms results from k-fold cross validation.
Author
Frédéric Bertrand
frederic.bertrand@lecnam.net
https://fbertran.github.io/homepage/
Examples
data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
kfolds2Pressind(cv.plsR(object=yCornell,dataX=data.frame(scale(as.matrix(XCornell))[,]),
nt=6,K=12,NK=1))
#> NK: 1
#> Leave One Out
#> Number of groups : 12
#> 1
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 2
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 3
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 4
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 5
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 6
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 7
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 8
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 9
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 10
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 11
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 5 components could thus be extracted
#> ****________________________________________________****
#>
#> 12
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> [[1]]
#> [[1]][[1]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 1 24.52456 19.46751 9.132702 6.212796 6.260403 6.294375
#>
#> [[1]][[2]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 2 4.124502 0.6664187 0.4453306 0.0288125 0.468846 0.6001117
#>
#> [[1]][[3]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 3 1.551301 0.9608429 1.224441 2.534867 1.991568 5.504755
#>
#> [[1]][[4]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 4 12.26717 0.247437 0.001516247 0.111019 0.06429773 0.05142279
#>
#> [[1]][[5]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 5 4.315406 9.872769 2.420394 4.187705 8.869722 8.95432
#>
#> [[1]][[6]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 6 6.209332 5.820357 3.366519 1.798485 0.950924 1.959007
#>
#> [[1]][[7]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 7 0.08812214 0.4818875 0.2496785 0.2425807 0.00951357 0.008071516
#>
#> [[1]][[8]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 8 0.9442012 0.5163166 0.4084427 0.351376 0.248757 0.2347731
#>
#> [[1]][[9]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 9 0.2203272 0.01149677 0.02486984 0.02827224 0.1233742 0.1658223
#>
#> [[1]][[10]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 10 0.6034613 0.0005521844 0.006299065 0.01764824 0.006014414 0.02841849
#>
#> [[1]][[11]]
#> [,1] [,2] [,3] [,4] [,5]
#> 11 0.8275623 0.01285346 0.6440788 0.7149959 0.06577128
#>
#> [[1]][[12]]
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> 12 0.03180524 3.374303 2.349701 5.013846 5.458814 8.13772
#>
#>
kfolds2Pressind(cv.plsR(object=yCornell,dataX=data.frame(scale(as.matrix(XCornell))[,]),
nt=6,K=6,NK=1))
#> NK: 1
#> Number of groups : 6
#> 1
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 2
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 3
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 5 components could thus be extracted
#> ****________________________________________________****
#>
#> 4
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 5
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> 6
#> ____************************************************____
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ****________________________________________________****
#>
#> [[1]]
#> [[1]][[1]]
#> [1] 4.880619 9.479174 4.198758 5.262137 9.681688 9.669555
#>
#> [[1]][[2]]
#> [1] 24.808710 17.584379 9.111413 6.206053 6.259251 6.317143
#>
#> [[1]][[3]]
#> [1] 0.83738525 0.65811917 0.60483914 0.63522265 0.07106985
#>
#> [[1]][[4]]
#> [1] 12.882761 49.116623 38.311814 9.663014 22.578142 71.849877
#>
#> [[1]][[5]]
#> [1] 4.597799 5.142740 4.371768 6.750691 5.412892 11.637487
#>
#> [[1]][[6]]
#> [1] 1.661627 1.018517 1.303515 2.536627 1.900569 5.465581
#>
#>
rm(list=c("XCornell","yCornell"))
# \donttest{
data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
kfolds2Pressind(cv.plsR(object=ypine,dataX=Xpine,nt=10,NK=1,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 2.342151 2.218636 2.126248 1.684389 1.563846 1.552798 1.473877 1.538851
#> [9] 1.525891 1.545314
#>
#> [[1]][[2]]
#> [1] 5.199456 4.118474 3.850497 3.391300 3.644524 3.596471 3.566044 3.917529
#> [9] 4.128891 4.191982
#>
#> [[1]][[3]]
#> [1] 1.752371 2.098495 2.594762 2.899234 2.490813 2.347570 2.304964 2.302503
#> [9] 2.242565 2.237447
#>
#> [[1]][[4]]
#> [1] 0.7826082 3.6071430 3.6587396 4.7975991 4.7680548 4.7571587 4.7413192
#> [8] 5.2665608 5.4529557 5.7367919
#>
#> [[1]][[5]]
#> [1] 3.696523 3.064659 2.374765 1.813269 2.150099 2.110946 1.973100 2.261847
#> [9] 2.136085 2.198083
#>
#>
kfolds2Pressind(cv.plsR(object=ypine,dataX=Xpine,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 2.275282 2.987106 3.437917 3.851224 3.423336 3.708752 3.813981 3.943732
#> [9] 4.190839 4.252629
#>
#> [[1]][[2]]
#> [1] 1.956497 2.214037 2.660120 3.371085 3.605217 3.673265 3.830250 3.915479
#> [9] 3.948725 3.918604
#>
#> [[1]][[3]]
#> [1] 3.737994 4.596768 4.043005 3.756683 3.494852 3.374156 3.551765 3.511339
#> [9] 3.564252 3.600758
#>
#> [[1]][[4]]
#> [1] 4.145755 2.915002 3.224384 2.447451 2.450237 2.332576 2.605988 2.706925
#> [9] 2.658907 2.805306
#>
#> [[1]][[5]]
#> [1] 0.4199873 0.5516132 0.9560758 0.7934037 0.5865402 0.4701086 0.4837466
#> [8] 0.5320106 0.8890206 0.9157411
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [1] 3.411202 2.822411 3.513383 2.875797 2.634304 2.455586 2.429512 2.330214
#> [9] 2.440069 2.538443
#>
#> [[2]][[2]]
#> [1] 1.682559 1.479959 1.786883 1.837744 1.825986 2.235630 3.631814 3.791986
#> [9] 4.814206 5.242127
#>
#> [[2]][[3]]
#> [1] 3.494780 3.703488 2.195711 1.998145 1.867244 1.803017 1.528848 1.609933
#> [9] 1.559220 1.573920
#>
#> [[2]][[4]]
#> [1] 1.761601 1.767602 1.891638 1.550560 1.270254 1.369555 1.332052 1.382803
#> [9] 1.345839 1.391600
#>
#> [[2]][[5]]
#> [1] 3.171187 3.778985 3.175236 3.843570 4.067677 4.060807 4.031779 3.983545
#> [9] 3.957146 3.947849
#>
#>
XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
kfolds2Pressind(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=1,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 3.849149 5.752942 2.735378 3.984203 2.459746 2.942909 5.273890 6.473331
#> [9] 6.539830
#>
#> [[1]][[2]]
#> [1] 0.7393361 1.1071199 0.4127204 0.3853208 0.4306980 0.3629602 0.4710221
#> [8] 0.4896732 0.5083137
#>
#> [[1]][[3]]
#> [1] 2.248253 2.944479 3.254695 2.641474 3.191958 3.250845 3.311406 3.447073
#> [9] 3.575448
#>
#> [[1]][[4]]
#> [1] 5.498725 5.122205 3.880136 4.177558 4.348146 4.098910 4.201643 4.223440
#> [9] 4.061385
#>
#> [[1]][[5]]
#> [1] 1.636114 1.853155 2.760082 1.872755 1.617061 1.648602 1.753168 1.690348
#> [9] 1.262019
#>
#>
kfolds2Pressind(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 1.297974 1.530903 1.536840 1.041452 1.052710 1.173904 1.465349 1.681633
#> [9] 2.027705
#>
#> [[1]][[2]]
#> [1] 1.943300 1.823133 2.085198 2.145016 2.078058 1.824871 1.707368 1.624454
#> [9] 1.613452
#>
#> [[1]][[3]]
#> [1] 2.8807131 2.2204980 3.3987872 4.9532763 2.6831597 1.3558769 0.7035967
#> [8] 1.2092064 0.7011148
#>
#> [[1]][[4]]
#> [1] 3.558262 4.040055 3.226564 3.521774 3.586731 3.746520 4.204176 4.065597
#> [9] 4.001694
#>
#> [[1]][[5]]
#> [1] 3.096450 2.857964 3.015091 2.883974 3.068952 3.035802 2.942332 2.988776
#> [9] 3.380554
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [1] 0.9685304 0.9122828 0.7885177 1.3065461 1.8234641 1.7404674 2.1599134
#> [8] 1.9837580 2.2375557
#>
#> [[2]][[2]]
#> [1] 7.470791 6.871658 6.817698 6.124524 5.937033 5.539184 5.618064 5.927220
#> [9] 5.872932
#>
#> [[2]][[3]]
#> [1] 2.594546 2.896596 4.605220 3.139865 4.419324 6.461079 5.035024 6.683542
#> [9] 4.720656
#>
#> [[2]][[4]]
#> [1] 1.201038 1.909526 1.839511 1.962370 1.914030 2.190047 2.958085 2.983242
#> [9] 4.161789
#>
#> [[2]][[5]]
#> [1] 1.2355768 1.7140491 2.3410282 1.3111511 1.2945952 1.2548052 1.0631360
#> [8] 0.9455445 1.2175567
#>
#>
rm(list=c("Xpine","XpineNAX21","ypine"))
# }