R/kfolds2Press.R
kfolds2Press.Rd
This function computes PRESS for k-fold cross validated partial least squares regression models.
kfolds2Press(pls_kfolds)
a k-fold cross validated partial least squares regression model
Press vs number of components for the first group partition
...
Press vs number of components for the last group partition
Use cv.plsR
to create k-fold cross validated partial
least squares regression models.
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. http://publications-sfds.math.cnrs.fr/index.php/J-SFdS/article/view/47
kfolds2coeff
, kfolds2Pressind
,
kfolds2Mclassedind
and kfolds2Mclassed
to
extract and transforms results from k-fold cross validation.
data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
kfolds2Press(cv.plsR(object=yCornell,dataX=data.frame(scale(as.matrix(XCornell))[,]),
nt=6,K=12,NK=1,verbose=FALSE))
#> [[1]]
#> [1] 55.70774 41.43274 20.27397 21.24240 24.51801
#>
kfolds2Press(cv.plsR(object=yCornell,dataX=data.frame(scale(as.matrix(XCornell))[,]),
nt=6,K=6,NK=1,verbose=FALSE))
#> [[1]]
#> [1] 55.08429 48.38231 26.04625 23.75142 19.32315
#>
rm(list=c("XCornell","yCornell"))
# \donttest{
data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
kfolds2Press(cv.plsR(object=ypine,dataX=Xpine,nt=10,NK=1,verbose=FALSE))
#> [[1]]
#> [1] 13.12286 14.01586 14.16770 12.30821 12.01864 13.05153 14.13320 15.11412
#> [9] 15.60423 15.64563
#>
kfolds2Press(cv.plsR(object=ypine,dataX=Xpine,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [1] 15.26322 16.44412 18.11756 17.20480 16.11167 17.27442 17.53763 16.87868
#> [9] 18.09142 18.43750
#>
#> [[2]]
#> [1] 12.67582 13.33110 13.11565 11.25626 10.44674 10.25924 10.17884 10.42163
#> [9] 10.88151 11.15285
#>
XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
kfolds2Press(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=1,verbose=FALSE))
#> [[1]]
#> [1] 13.03605 11.03104 11.58385 15.15758 14.49375 13.95179 13.74002 16.03517
#> [9] 14.76949
#>
kfolds2Press(cv.plsR(object=ypine,dataX=XpineNAX21,nt=10,NK=2,verbose=FALSE))
#> [[1]]
#> [1] 14.89891 13.74070 14.06602 15.43863 19.10792 20.46805 15.82086 16.20513
#> [9] 17.38531
#>
#> [[2]]
#> [1] 13.94649 14.49354 15.22609 13.14616 11.67620 13.04385 14.22345 11.06078
#> [9] 16.61735
#>
rm(list=c("Xpine","XpineNAX21","ypine"))
# }