R/kfolds2Chisqind.R
kfolds2Chisqind.Rd
This function computes individual Predicted Chisquare for k-fold cross validated partial least squares regression models.
kfolds2Chisqind(pls_kfolds)
a k-fold cross validated partial least squares regression glm model
Individual PChisq vs number of components for the first group partition
...
Individual PChisq vs number of components for the last group partition
Use cv.plsRglm
to create k-fold cross validated partial
least squares regression glm 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
, kfolds2Press
,
kfolds2Pressind
, kfolds2Chisq
,
kfolds2Mclassedind
and kfolds2Mclassed
to
extract and transforms results from k-fold cross-validation.
# \donttest{
data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
bbb <- cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-gaussian",K=16,verbose=FALSE)
bbb2 <- cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-gaussian",K=5,verbose=FALSE)
kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#> [,1] [,2] [,3]
#> 1 24.52456 11.3923 6.837075
#>
#> [[1]][[2]]
#> [,1] [,2] [,3]
#> 2 4.124502 0.007566232 0.005169207
#>
#> [[1]][[3]]
#> [,1] [,2] [,3]
#> 3 1.551301 1.917305 1.907019
#>
#> [[1]][[4]]
#> [,1] [,2] [,3]
#> 4 12.26717 1.278425 0.003572679
#>
#> [[1]][[5]]
#> [,1] [,2] [,3]
#> 5 4.315406 5.393862 4.249662
#>
#> [[1]][[6]]
#> [,1] [,2] [,3]
#> 6 6.209332 3.528493 1.696534
#>
#> [[1]][[7]]
#> [,1] [,2] [,3]
#> 7 0.08812214 0.256731 0.1887149
#>
#> [[1]][[8]]
#> [,1] [,2] [,3]
#> 8 0.9442012 0.240037 0.359011
#>
#> [[1]][[9]]
#> [,1] [,2] [,3]
#> 9 0.2203272 0.02253865 0.03724274
#>
#> [[1]][[10]]
#> [,1] [,2] [,3]
#> 10 0.6034613 0.05144812 0.01893424
#>
#> [[1]][[11]]
#> [,1] [,2] [,3]
#> 11 0.8275623 0.4409475 0.7467284
#>
#> [[1]][[12]]
#> [,1] [,2] [,3]
#> 12 0.03180524 1.455262e-05 4.794104
#>
#>
kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 5.825877 4.725472 3.883973
#>
#> [[1]][[2]]
#> [1] 30.892452 9.685118 5.997163
#>
#> [[1]][[3]]
#> [1] 6.403230 3.555880 5.588619
#>
#> [[1]][[4]]
#> [1] 1.1270093 0.5523745 0.5294297
#>
#> [[1]][[5]]
#> [1] 12.3290316 1.1463315 0.2526569
#>
#>
rm(list=c("XCornell","yCornell","bbb","bbb2"))
data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
bbb <- cv.plsRglm(object=ypine,dataX=Xpine,nt=4,modele="pls-glm-gaussian",verbose=FALSE)
bbb2 <- cv.plsRglm(object=ypine,dataX=Xpine,nt=10,modele="pls-glm-gaussian",K=10,verbose=FALSE)
kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.836167 2.171958 2.900816 3.383174
#>
#> [[1]][[2]]
#> [1] 2.265851 1.880170 1.424197 1.222636
#>
#> [[1]][[3]]
#> [1] 3.750548 3.992624 3.457277 3.445154
#>
#> [[1]][[4]]
#> [1] 1.481057 2.508055 2.534248 3.022888
#>
#> [[1]][[5]]
#> [1] 3.873793 2.379961 2.029131 2.035533
#>
#>
kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.874108 1.011835 1.004399 1.529960 1.607138 1.512919 1.743330 1.693070
#> [9] 1.668737 1.669246
#>
#> [[1]][[2]]
#> [1] 0.5217522 1.3551071 1.2111218 1.4370478 1.5116616 2.1022189 2.1317979
#> [8] 1.9967580 1.9700226 1.9681641
#>
#> [[1]][[3]]
#> [1] 0.9979281 1.2501863 1.0512863 0.8472644 0.9234442 0.9745070 0.9474871
#> [8] 0.9671889 0.9993740 0.9871123
#>
#> [[1]][[4]]
#> [1] 2.519977 2.206042 1.952335 1.827331 1.885652 1.856834 1.727411 1.676181
#> [9] 1.670902 1.664539
#>
#> [[1]][[5]]
#> [1] 0.9321451 1.0740008 1.1154523 1.6694813 1.9219940 1.9060085 1.8813871
#> [8] 1.9653038 1.9514983 1.9565490
#>
#> [[1]][[6]]
#> [1] 0.3778648 0.3687811 0.3809376 0.3492512 0.3665322 0.3751166 0.3365295
#> [8] 0.3371681 0.3106785 0.3055863
#>
#> [[1]][[7]]
#> [1] 1.1829590 0.4605101 0.3786150 0.6044597 0.6084287 0.5474187 0.4605802
#> [8] 0.5076396 0.4965515 0.4855881
#>
#> [[1]][[8]]
#> [1] 1.3649672 0.4581475 0.4310822 0.4633675 0.6159427 0.7767888 0.8049489
#> [8] 1.0173579 0.9380259 0.9366543
#>
#> [[1]][[9]]
#> [1] 2.808303 2.950943 2.879684 2.822780 2.778613 2.811510 2.691464 2.638846
#> [9] 2.654725 2.654184
#>
#> [[1]][[10]]
#> [1] 0.4520341 0.2324618 0.3809298 0.2962025 0.2807686 0.3081371 0.2907263
#> [8] 0.2998499 0.3020013 0.3020402
#>
#>
XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
bbbNA <- cv.plsRglm(object=ypine,dataX=XpineNAX21,nt=10,modele="pls",K=10,verbose=FALSE)
kfolds2Pressind(bbbNA)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.513312 3.052953 3.337869 3.093812 3.149831 3.323122 2.929652 3.200915
#> [9] 3.152576
#>
#> [[1]][[2]]
#> [1] 1.1733871 1.7555732 1.4226946 0.6836313 0.5431520 0.4843809 0.6276720
#> [8] 0.8598455 0.7421705
#>
#> [[1]][[3]]
#> [1] 3.220658 2.205590 2.303067 1.973497 1.807882 1.755839 1.689369 1.837478
#> [9] 2.147036
#>
#> [[1]][[4]]
#> [1] 2.028142 3.556218 9.316032 2.991170 3.970424 3.311085 3.769649
#> [8] 2.969452 21.511957
#>
#> [[1]][[5]]
#> [1] 0.08983156 0.15380533 0.33759110 0.54674379 0.33170610 0.28865037 0.28250955
#> [8] 0.39500298 0.41466648
#>
#> [[1]][[6]]
#> [1] 0.05182149 0.41743984 0.63520907 0.23623211 0.16353036 0.13451805 0.17102474
#> [8] 0.18293842 0.17436122
#>
#> [[1]][[7]]
#> [1] 2.884425 2.994256 2.563328 2.528139 2.679789 2.455888 2.574421 3.270582
#> [9] 4.062107
#>
#> [[1]][[8]]
#> [1] 1.5314888 0.9073527 0.8546632 0.9492293 1.0062567 1.2156124 1.2027054
#> [8] 1.2330194 1.3702081
#>
#> [[1]][[9]]
#> [1] 0.7060897 0.5736736 0.9937846 0.6851302 0.6394279 0.5405938 0.5467194
#> [8] 0.5027723 0.4319827
#>
#> [[1]][[10]]
#> [1] 1.4192751 1.0023379 0.7331192 0.1370833 0.1509492 0.1268596 0.2293369
#> [8] 0.2057744 0.1809544
#>
#>
kfolds2Chisqind(bbbNA)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.513312 3.052953 3.337869 3.093812 3.149831 3.323122 2.929652 3.200915
#> [9] 3.152576
#>
#> [[1]][[2]]
#> [1] 1.1733871 1.7555732 1.4226946 0.6836313 0.5431520 0.4843809 0.6276720
#> [8] 0.8598455 0.7421705
#>
#> [[1]][[3]]
#> [1] 3.220658 2.205590 2.303067 1.973497 1.807882 1.755839 1.689369 1.837478
#> [9] 2.147036
#>
#> [[1]][[4]]
#> [1] 2.028142 3.556218 9.316032 2.991170 3.970424 3.311085 3.769649
#> [8] 2.969452 21.511957
#>
#> [[1]][[5]]
#> [1] 0.08983156 0.15380533 0.33759110 0.54674379 0.33170610 0.28865037 0.28250955
#> [8] 0.39500298 0.41466648
#>
#> [[1]][[6]]
#> [1] 0.05182149 0.41743984 0.63520907 0.23623211 0.16353036 0.13451805 0.17102474
#> [8] 0.18293842 0.17436122
#>
#> [[1]][[7]]
#> [1] 2.884425 2.994256 2.563328 2.528139 2.679789 2.455888 2.574421 3.270582
#> [9] 4.062107
#>
#> [[1]][[8]]
#> [1] 1.5314888 0.9073527 0.8546632 0.9492293 1.0062567 1.2156124 1.2027054
#> [8] 1.2330194 1.3702081
#>
#> [[1]][[9]]
#> [1] 0.7060897 0.5736736 0.9937846 0.6851302 0.6394279 0.5405938 0.5467194
#> [8] 0.5027723 0.4319827
#>
#> [[1]][[10]]
#> [1] 1.4192751 1.0023379 0.7331192 0.1370833 0.1509492 0.1268596 0.2293369
#> [8] 0.2057744 0.1809544
#>
#>
bbbNA2 <- cv.plsRglm(object=ypine,dataX=XpineNAX21,nt=4,modele="pls-glm-gaussian",verbose=FALSE)
bbbNA3 <- cv.plsRglm(object=ypine,dataX=XpineNAX21,nt=10,modele="pls-glm-gaussian",
K=10,verbose=FALSE)
kfolds2Chisqind(bbbNA2)
#> [[1]]
#> [[1]][[1]]
#> [1] 3.732495 2.225024 4.447632 4.114480
#>
#> [[1]][[2]]
#> [1] 0.6279873 2.7322923 2.7248813 3.0625423
#>
#> [[1]][[3]]
#> [1] 2.219986 2.908948 2.506402 3.155018
#>
#> [[1]][[4]]
#> [1] 3.332160 2.288697 2.284680 2.121396
#>
#> [[1]][[5]]
#> [1] 3.494277 4.032008 4.355750 4.206821
#>
#>
kfolds2Chisqind(bbbNA3)
#> [[1]]
#> [[1]][[1]]
#> [1] 0.6285543 1.0359499 1.2016547 1.7101698 2.0075539 2.1315108 2.2711194
#> [8] 2.2686850 1.9936127
#>
#> [[1]][[2]]
#> [1] 1.6466467 1.8394761 0.7988124 0.4917480 0.4274220 9.0790939 8.6786108
#> [8] 8.6281858 8.5785090
#>
#> [[1]][[3]]
#> [1] 1.268628 1.868241 1.797348 1.857962 2.079682 1.700354 1.903973 1.969352
#> [9] 1.628049
#>
#> [[1]][[4]]
#> [1] 1.7816054 1.2688601 0.7779507 0.7852721 0.8003833 0.7908417 0.8954716
#> [8] 0.9792868 1.1159796
#>
#> [[1]][[5]]
#> [1] 0.08856974 0.59773655 0.75148812 0.91397744 0.74650732 0.84620523 0.79797264
#> [8] 0.82348380 0.90358005
#>
#> [[1]][[6]]
#> [1] 2.594153 1.505348 1.581181 1.384713 1.516205 1.523311 1.478979 1.151849
#> [9] 1.434312
#>
#> [[1]][[7]]
#> [1] 1.4230173 1.0280495 0.8546950 0.9966400 0.8458524 0.9260959 1.0445783
#> [8] 1.0080508 0.9626158
#>
#> [[1]][[8]]
#> [1] 0.7196986 0.8330835 0.5696433 0.6222657 0.6281209 0.7400389 0.7019334
#> [8] 0.6634473 0.6800500
#>
#> [[1]][[9]]
#> [1] 3.171786 2.817886 2.889183 2.922070 2.798209 2.776305 2.655638 2.656450
#> [9] 2.511200
#>
#> [[1]][[10]]
#> [1] 0.07212698 0.07553635 0.04590462 0.09351758 0.14290029 0.20322680 0.06330675
#> [8] 0.09910805 0.39491036
#>
#>
rm(list=c("Xpine","XpineNAX21","ypine","bbb","bbb2","bbbNA","bbbNA2","bbbNA3"))
data(aze_compl)
Xaze_compl<-aze_compl[,2:34]
yaze_compl<-aze_compl$y
kfolds2Chisqind(cv.plsRglm(object=yaze_compl,dataX=Xaze_compl,nt=4,modele="pls-glm-family",
family=binomial(),verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 33.62170 50.17175 49.50281 76.64862
#>
#> [[1]][[2]]
#> [1] 34.26170 37.72083 93.10709 159.96046
#>
#> [[1]][[3]]
#> [1] 40.73370 96.09459 158.82797 182.84358
#>
#> [[1]][[4]]
#> [1] 34.29291 50.56979 130.83437 319.72521
#>
#> [[1]][[5]]
#> [1] 52.41381 122.81569 570.48530 754.27901
#>
#>
kfolds2Chisqind(cv.plsRglm(object=yaze_compl,dataX=Xaze_compl,nt=4,modele="pls-glm-logistic",
verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 53.77817 176.70626 7126.73462 92631.85247
#>
#> [[1]][[2]]
#> [1] 25.75493 20.38903 24.73161 30.68989
#>
#> [[1]][[3]]
#> [1] 34.74578 52.02487 115.20079 358.91150
#>
#> [[1]][[4]]
#> [1] 47.88129 56.84890 174.53571 474.03713
#>
#> [[1]][[5]]
#> [1] 34.89712 109.58860 1541.95658 6085.02253
#>
#>
kfolds2Chisqind(cv.plsRglm(object=yaze_compl,dataX=Xaze_compl,nt=10,modele="pls-glm-family",
family=binomial(),K=10,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 20.17185 22.16585 40.55295 55.93092 54.54151 72.79754 77.48710 74.89419
#> [9] 71.56772 68.86677
#>
#> [[1]][[2]]
#> [1] 22.67109 63.36670 140.63351 407.32449 850.17374 1763.66130
#> [7] 1491.13289 1415.32001 1341.60415 1218.68858
#>
#> [[1]][[3]]
#> [1] 14.53021 23.92954 16.45789 20.11521 23.08082 38.61221 48.36176 75.60908
#> [9] 79.85560 88.32230
#>
#> [[1]][[4]]
#> [1] 19.22960 16.80009 26.21448 53.15827 57.22353 60.53670 56.04207 54.29641
#> [9] 53.26103 49.45670
#>
#> [[1]][[5]]
#> [1] 20.46798 29.02216 53.71628 79.91178 71.23519 64.77629 79.27302 80.07585
#> [9] 78.21311 80.55105
#>
#> [[1]][[6]]
#> [1] 13.77671 14.12360 15.88668 51.92269 65.22225 70.83354 101.33980
#> [8] 107.65828 103.01646 102.77375
#>
#> [[1]][[7]]
#> [1] 10.27710 20.42570 51.28554 213.80171 466.35445 628.88675 685.64130
#> [8] 717.75229 692.34911 684.34020
#>
#> [[1]][[8]]
#> [1] 20.76713 22.56457 39.24716 63.70568 118.14793 118.55758 125.78246
#> [8] 139.23459 134.37356 123.32337
#>
#> [[1]][[9]]
#> [1] 12.40417 20.23049 19.10320 25.47778 36.91847 89.08731 151.87048
#> [8] 235.57441 259.93882 220.58283
#>
#> [[1]][[10]]
#> [1] 25.99583 102.20978 570.05803 1021.66235 1009.08935 1376.03875
#> [7] 2449.94320 2387.73511 3028.54634 4416.69592
#>
#>
kfolds2Chisqind(cv.plsRglm(object=yaze_compl,dataX=Xaze_compl,nt=10,
modele="pls-glm-logistic",K=10,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 26.49565 93.21469 921.38767 9538.76608 23909.87057
#> [6] 49951.48671 78284.51590 84707.34522 102534.53032 135658.74676
#>
#> [[1]][[2]]
#> [1] 9.019219 11.398199 14.738368 16.875215 19.661211 16.615480 14.951250
#> [8] 15.626287 15.474234 14.869145
#>
#> [[1]][[3]]
#> [1] 20.47939 23.61137 42.06091 53.25822 123.42004 165.70743 217.83578
#> [8] 269.69151 274.99737 246.00232
#>
#> [[1]][[4]]
#> [1] 28.68566 41.83677 131.73007 412.62211 930.75241 1739.73520
#> [7] 2990.78523 3621.11393 4857.33684 5536.99949
#>
#> [[1]][[5]]
#> [1] 19.31545 20.85890 18.27761 23.56477 17.40385 16.15048 15.15009 15.77489
#> [9] 15.57694 14.57309
#>
#> [[1]][[6]]
#> [1] 16.21013 26.87634 20.11429 30.78639 48.05624 73.68477 83.49269 92.19472
#> [9] 89.06331 83.31150
#>
#> [[1]][[7]]
#> [1] 31.69816 34.40746 40.30627 83.22161 87.01635 93.99141 96.40863 90.66529
#> [9] 80.96131 81.01321
#>
#> [[1]][[8]]
#> [1] 7.700161 12.716496 29.081724 52.940247 128.007194 288.043362
#> [7] 419.605015 434.864044 395.217274 377.389101
#>
#> [[1]][[9]]
#> [1] 40.5861 116.3598 737.6036 1073.7390 1388.0294 2342.8615 3098.8311
#> [8] 3474.7578 2529.6038 1986.5046
#>
#> [[1]][[10]]
#> [1] 9.339474 14.378124 20.999670 26.588684 30.092950 32.874333 33.709496
#> [8] 43.733913 40.296438 40.342693
#>
#>
rm(list=c("Xaze_compl","yaze_compl"))
# }