
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://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 ____
#> 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.66706618 0.02540345 1.01515025 1.08155633 0.30518759
#>
#> [[1]][[3]]
#> [1] 12.7082450 1.0186833 0.2740066 0.4714313 0.2948841 0.2824644
#>
#> [[1]][[4]]
#> [1] 4.597799 5.142740 4.371768 6.750691 5.412892 11.637487
#>
#> [[1]][[5]]
#> [1] 4.138374 9.348444 3.663063 4.871133 8.908067 9.002826
#>
#> [[1]][[6]]
#> [1] 6.2423509 8.1752874 3.9118185 1.8192410 0.9678129 1.9867311
#>
#>
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] 4.0488459 2.6419005 2.0931074 0.9945233 1.2361610 1.7251410 1.7075649
#> [8] 1.8096216 2.9881568 2.9504999
#>
#> [[1]][[2]]
#> [1] 6.390972 5.552014 5.517146 4.132977 4.333445 4.240730 4.489146 4.587389
#> [9] 4.448139 4.756072
#>
#> [[1]][[3]]
#> [1] 4.426068 4.203625 4.160001 2.707194 2.457752 2.255721 2.079002 2.707203
#> [9] 3.150194 3.105966
#>
#> [[1]][[4]]
#> [1] 0.9068526 2.6669519 2.2301527 1.6602976 1.6663093 1.6891594 1.4659527
#> [8] 1.4433798 1.4546258 1.4492790
#>
#> [[1]][[5]]
#> [1] 1.493042 1.772823 2.047642 2.484318 2.879056 2.961044 2.626678 3.212175
#> [9] 3.393293 3.410057
#>
#>
kfolds2Pressind(cv.plsR(object=ypine,dataX=Xpine,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 1.467380 2.168126 2.695899 2.521611 2.159425 1.924642 1.927995 1.932993
#> [9] 1.837238 1.953333
#>
#> [[1]][[2]]
#> [1] 1.6310018 0.9688999 1.7434467 1.8841259 1.6973504 2.0618149 1.8517636
#> [8] 1.8348866 1.8330148 2.0175683
#>
#> [[1]][[3]]
#> [1] 4.386981 3.402139 3.086164 2.499676 4.205048 4.671250 6.840667 6.743799
#> [9] 7.989124 8.767788
#>
#> [[1]][[4]]
#> [1] 1.8736114 0.8800440 0.9267234 1.5855790 1.3601801 1.4961981 1.4268692
#> [8] 1.6380297 2.4713283 2.7237398
#>
#> [[1]][[5]]
#> [1] 3.635313 5.412117 4.423254 4.646123 4.549350 4.523811 4.234378 4.725699
#> [9] 4.786735 4.778022
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [1] 1.637415 2.245055 2.934097 3.695443 4.615823 4.853021 4.760955 4.317317
#> [9] 4.370336 4.532819
#>
#> [[2]][[2]]
#> [1] 7.431612 6.413585 6.424594 5.468000 5.270395 5.003974 5.236600 5.290440
#> [9] 5.278781 5.334312
#>
#> [[2]][[3]]
#> [1] 2.427396 2.354319 3.183985 4.275545 4.618642 4.046329 4.007167 4.468310
#> [9] 4.013439 4.291869
#>
#> [[2]][[4]]
#> [1] 1.5390503 2.5249782 2.4752179 1.0202539 0.9815462 0.9378263 1.2424764
#> [8] 1.2372781 1.2355224 1.2998315
#>
#> [[2]][[5]]
#> [1] 1.030394 1.329299 1.749146 1.930631 1.661483 1.456542 1.370672 1.499380
#> [9] 1.522270 1.658070
#>
#>
XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
kfolds2Pressind(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=1,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 5.464908 5.049557 4.166369 3.591951 3.177433 3.905476 5.611279
#> [8] 11.052210 9.462785
#>
#> [[1]][[2]]
#> [1] 1.0599123 1.3364851 0.9436012 1.4537358 1.3330502 1.3936751 1.3997176
#> [8] 1.4026369 1.3529485
#>
#> [[1]][[3]]
#> [1] 1.979278 2.415208 2.611007 2.168071 2.799951 2.964522 3.127285 3.293346
#> [9] 6.508898
#>
#> [[1]][[4]]
#> [1] 1.818201 2.479678 2.225647 1.992272 1.404085 1.399823 1.214958 1.203648
#> [9] 1.206665
#>
#> [[1]][[5]]
#> [1] 3.105783 2.264822 2.641112 2.300512 2.098744 2.209297 2.273085 2.157865
#> [9] 2.201445
#>
#>
kfolds2Pressind(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 2.547950 4.767086 4.888301 3.900638 4.170049 4.344046 5.329010 5.117453
#> [9] 5.864831
#>
#> [[1]][[2]]
#> [1] 6.728788 5.877879 5.900289 4.846563 4.769718 4.606007 4.593691 4.728711
#> [9] 4.556849
#>
#> [[1]][[3]]
#> [1] 1.3507121 1.2689860 1.0790356 0.9634752 1.1696518 1.1854162 1.1302727
#> [8] 1.1247221 1.1087293
#>
#> [[1]][[4]]
#> [1] 0.3900268 0.2325452 0.5790339 0.8654579 0.5951860 0.5259451 0.4647143
#> [8] 0.6640165 0.8373827
#>
#> [[1]][[5]]
#> [1] 2.7385991 4.0581773 3.0556480 4.9111903 0.9353821 8.1270288 3.3396160
#> [8] 2.7926172 2.1384669
#>
#>
#> [[2]]
#> [[2]][[1]]
#> [1] 3.629095 1.796776 4.185873 2.969745 2.656988 4.471315 3.730323 1.517183
#> [9] 1.240315
#>
#> [[2]][[2]]
#> [1] 4.575640 4.123548 4.248780 3.643940 4.668992 4.695260 4.722404 4.820543
#> [9] 4.760147
#>
#> [[2]][[3]]
#> [1] 1.361355 1.909235 1.795745 1.419175 1.256088 1.414919 1.464476 1.568089
#> [9] 1.557506
#>
#> [[2]][[4]]
#> [1] 2.149668 2.262385 1.824475 1.196458 1.240640 1.321145 1.485654 1.511968
#> [9] 2.300004
#>
#> [[2]][[5]]
#> [1] 3.402639 4.165198 3.291125 3.052477 3.098406 3.351658 3.484018 3.458543
#> [9] 3.513917
#>
#>
rm(list=c("Xpine","XpineNAX21","ypine"))
# }