
Computes individual PRESS for k-fold cross validated partial least squares regression models.
Source:R/kfolds2Pressind.R
kfolds2Pressind.RdThis 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://ojs-test.apps.ocp.math.cnrs.fr/index.php/J-SFdS/article/view/47/
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 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 5 components could thus be extracted
#> ****________________________________________________****
#>
#> 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 ____
#> ****________________________________________________****
#>
#> [[1]]
#> [[1]][[1]]
#> [1] 31.564554 19.452709 6.403846 5.518035 5.920875 5.616452
#>
#> [[1]][[2]]
#> [1] 0.83738525 0.65811917 0.60483914 0.63522265 0.07106985
#>
#> [[1]][[3]]
#> [1] 12.7082450 1.0186833 0.2740066 0.4714313 0.2948841 0.2824644
#>
#> [[1]][[4]]
#> [1] 11.849695 6.336596 9.884845 7.495943 10.498020 12.384653
#>
#> [[1]][[5]]
#> [1] 4.58283899 0.68822606 0.45102265 0.03841835 0.49488726 0.57277899
#>
#> [[1]][[6]]
#> [1] 0.2144275 3.6868717 2.7224961 5.6339138 6.5630531 8.7883978
#>
#>
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] 5.087543 6.136783 4.893889 4.236479 4.124724 4.211850 4.077248 4.086289
#> [9] 4.083006 4.138639
#>
#> [[1]][[2]]
#> [1] 2.712946 1.991465 1.993130 1.433543 1.268099 1.260814 1.195231 1.288295
#> [9] 1.374572 1.410078
#>
#> [[1]][[3]]
#> [1] 3.657802 3.632209 4.050635 4.251944 4.393019 4.095812 4.018622 4.040909
#> [9] 4.055467 4.042039
#>
#> [[1]][[4]]
#> [1] 1.5003610 1.0316760 1.2661423 0.6858752 0.6206919 0.6367733 0.6565025
#> [8] 0.8626533 1.9050966 2.1827077
#>
#> [[1]][[5]]
#> [1] 1.652517 1.040228 0.609441 1.453581 3.108436 3.563512 3.616031 3.505108
#> [9] 3.484390 3.487417
#>
#>
kfolds2Pressind(cv.plsR(object=ypine,dataX=Xpine,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 1.0239443 0.9673287 0.9332936 0.5022710 0.5009197 0.6148498 0.7231797
#> [8] 1.1655774 1.5238326 1.5890435
#>
#> [[1]][[2]]
#> [1] 2.794299 3.114914 4.428918 4.619846 4.536313 4.844440 4.343611 4.998836
#> [9] 5.046537 5.022718
#>
#> [[1]][[3]]
#> [1] 4.937697 5.146251 5.378970 3.735668 3.435929 3.690239 3.422686 3.788143
#> [9] 3.841811 3.907010
#>
#> [[1]][[4]]
#> [1] 3.157603 3.680021 3.648694 2.329658 2.514506 2.491194 2.487342 2.798267
#> [9] 3.270996 3.108974
#>
#> [[1]][[5]]
#> [1] 3.655848 5.240302 4.632475 4.513702 4.585874 4.609734 4.484030 4.720136
#> [9] 4.722070 4.877297
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [1] 1.257269 2.667759 2.661162 2.341696 2.347105 2.451796 2.437318 2.744081
#> [9] 2.740732 2.721569
#>
#> [[2]][[2]]
#> [1] 4.418315 4.773154 4.147046 3.680999 3.832651 3.876159 3.796784 3.952205
#> [9] 4.018439 4.423315
#>
#> [[2]][[3]]
#> [1] 2.338132 1.803408 1.643455 1.425713 1.397462 1.402765 1.452977 1.311227
#> [9] 1.383580 1.420703
#>
#> [[2]][[4]]
#> [1] 2.939580 2.508786 3.083757 2.614873 2.438329 2.285442 2.221883 2.036542
#> [9] 2.139324 2.102517
#>
#> [[2]][[5]]
#> [1] 2.3923319 2.1882239 0.8551791 1.0779424 1.5069595 1.7492746 1.7828367
#> [8] 1.9791967 2.0214901 2.0996430
#>
#>
XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
kfolds2Pressind(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=1,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 4.527373 4.066040 4.338121 3.788522 4.676122 4.811372 4.890309 4.083405
#> [9] 4.911618
#>
#> [[1]][[2]]
#> [1] 3.241123 3.261601 2.471602 3.482841 3.047603 3.003621 3.256506 3.151921
#> [9] 3.154784
#>
#> [[1]][[3]]
#> [1] 2.8804031 4.3810302 2.5273771 2.2069163 1.9890096 1.0360050 1.6123847
#> [8] 1.6113020 0.8961721
#>
#> [[1]][[4]]
#> [1] 0.9125339 1.6447367 2.6248880 2.5060455 2.3142041 2.7168666 3.1901525
#> [8] 3.1849414 3.4532624
#>
#> [[1]][[5]]
#> [1] 3.134535 3.510643 2.837869 1.527724 1.696274 1.664827 1.466413 1.345797
#> [9] 1.404218
#>
#>
kfolds2Pressind(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 2.769566 3.071968 7.973443 1.518703 3.042096 8.637364 1.770183 1.737534
#> [9] 2.908061
#>
#> [[1]][[2]]
#> [1] 3.918323 4.949892 3.983878 3.950130 3.611948 3.769379 3.831205 3.996880
#> [9] 3.852260
#>
#> [[1]][[3]]
#> [1] 1.880323 2.978543 2.832579 2.596001 2.955030 3.067392 3.227866 3.362569
#> [9] 4.177898
#>
#> [[1]][[4]]
#> [1] 3.744677 3.903136 4.834406 4.261608 3.127873 3.003020 3.028064 3.078350
#> [9] 3.396166
#>
#> [[1]][[5]]
#> [1] 1.0327192 1.1732209 0.7854008 0.8181759 0.7851134 0.7355532 0.9082597
#> [8] 0.8894821 1.9652327
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [1] 2.543111 2.144910 2.352660 1.734982 1.514214 1.310096 1.374434 1.511382
#> [9] 1.712029
#>
#> [[2]][[2]]
#> [1] 1.915959 3.280457 2.428900 5.918152 6.787833 6.873464 7.178542 7.021677
#> [9] 7.050167
#>
#> [[2]][[3]]
#> [1] 1.278119 1.939727 1.783228 1.416453 1.425028 1.188612 1.369612 1.469410
#> [9] 1.947013
#>
#> [[2]][[4]]
#> [1] 2.959185 2.273605 2.690907 2.170942 1.887979 1.829560 1.966064 2.000559
#> [9] 2.062797
#>
#> [[2]][[5]]
#> [1] 5.061471 4.548205 2.721753 4.771190 5.662841 7.302740 4.663023
#> [8] 50.936272 121.349022
#>
#>
rm(list=c("Xpine","XpineNAX21","ypine"))
# }