
Computes individual Predicted Chisquare for k-fold cross validated partial least squares regression models.
Source:R/kfolds2Chisqind.R
kfolds2Chisqind.RdThis function computes individual Predicted Chisquare for k-fold cross validated partial least squares regression models.
Value
- list
Individual PChisq vs number of components for the first group partition
- list()
...
- list
Individual PChisq vs number of components for the last group partition
Note
Use cv.plsRglm to create k-fold cross validated partial
least squares regression glm 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,
kfolds2Pressind, kfolds2Chisq,
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
# \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] 10.29691099 0.28157800 0.03439271
#>
#> [[1]][[2]]
#> [1] 36.642707 11.837844 7.310443
#>
#> [[1]][[3]]
#> [1] 2.5664845 0.2299003 0.2902721
#>
#> [[1]][[4]]
#> [1] 5.447630 3.918006 7.854290
#>
#> [[1]][[5]]
#> [1] 7.721843 3.310531 1.761714
#>
#>
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.414566 1.806869 1.640698 1.552951
#>
#> [[1]][[2]]
#> [1] 3.414549 2.626410 1.934197 2.065694
#>
#> [[1]][[3]]
#> [1] 1.835293 1.349067 1.394961 1.303652
#>
#> [[1]][[4]]
#> [1] 2.194565 1.701850 1.583206 1.347305
#>
#> [[1]][[5]]
#> [1] 4.144954 3.965905 3.752847 3.991118
#>
#>
kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 5.249999 4.756383 4.287571 4.547136 4.382030 4.606721 4.494257 4.484439
#> [9] 4.540672 4.540350
#>
#> [[1]][[2]]
#> [1] 1.1137317 1.7219638 0.6268366 0.6718227 0.4594347 0.4086168 0.5840988
#> [8] 0.6653888 0.6452377 0.6469058
#>
#> [[1]][[3]]
#> [1] 0.8703165 1.0047873 0.7994945 0.9143444 0.9313820 0.8944236 0.8440095
#> [8] 0.8289457 0.7771644 0.7666672
#>
#> [[1]][[4]]
#> [1] 1.0719118 0.7457475 0.5650716 0.6633700 0.5679119 0.7838006 0.7884538
#> [8] 0.8147564 0.8197531 0.8212560
#>
#> [[1]][[5]]
#> [1] 0.5140469 0.9940658 0.5681383 0.3667465 0.3961346 0.3228092 0.3095562
#> [8] 0.2965725 0.3010821 0.3041078
#>
#> [[1]][[6]]
#> [1] 2.557322 2.279927 2.116355 2.145006 1.980049 1.979931 1.826305 1.804372
#> [9] 1.800964 1.800720
#>
#> [[1]][[7]]
#> [1] 1.7654779 0.9806414 0.5152618 0.7254911 1.0845235 1.0297913 1.0177164
#> [8] 0.9866440 0.9877018 0.9885207
#>
#> [[1]][[8]]
#> [1] 0.3866568 0.4647960 0.4659497 0.4659213 0.6611811 1.1216200 1.2080244
#> [8] 1.2020985 1.1597944 1.1386756
#>
#> [[1]][[9]]
#> [1] 0.28074852 0.19201999 0.22241380 0.13739041 0.13258252 0.09078937
#> [7] 0.09193145 0.08974185 0.10831094 0.10821061
#>
#> [[1]][[10]]
#> [1] 0.9008857 0.9194738 0.6583447 0.6273219 0.5694064 0.5483093 0.5507346
#> [8] 0.6056700 0.5992925 0.5992653
#>
#>
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.2169996 1.6869248 0.9080029 0.9287743 1.0658864 1.0672493 0.8468892
#> [8] 0.8089848 0.7311545
#>
#> [[1]][[2]]
#> [1] 3.719177 3.434162 3.012075 2.757994 2.872204 2.747240 2.800510 2.869313
#> [9] 3.868102
#>
#> [[1]][[3]]
#> [1] 1.832169 1.550921 1.204722 1.580365 1.300763 1.223632 1.451868 1.477664
#> [9] 1.479606
#>
#> [[1]][[4]]
#> [1] 0.7845042 0.4693467 0.3338035 0.3633763 0.2628447 0.2980458 0.3209635
#> [8] 0.2919794 0.3211792
#>
#> [[1]][[5]]
#> [1] 1.4171891 1.8739234 2.1054461 0.8232368 32.5737503 2.8679986 3.6279457
#> [8] 20.8863833 17.1502058
#>
#> [[1]][[6]]
#> [1] 0.5954218 0.9120790 1.2205720 1.1043135 1.1397225 1.1987425 1.1327736
#> [8] 1.1499350 1.1338614
#>
#> [[1]][[7]]
#> [1] 2.333276 1.471815 1.778913 1.466270 1.274682 1.101338 1.087361 1.213602
#> [9] 1.167533
#>
#> [[1]][[8]]
#> [1] 0.5993310 0.4289935 0.8210640 0.5906114 0.4902903 0.4237112 0.4385860
#> [8] 0.4050477 0.3964742
#>
#> [[1]][[9]]
#> [1] 0.3262618 0.3705181 0.6105660 0.6618923 0.5375915 0.5397548 0.5709107
#> [8] 0.5802689 0.6147151
#>
#> [[1]][[10]]
#> [1] 0.8603408 1.0351521 1.0962748 0.6685812 0.2043497 0.2035989 0.1327491
#> [8] 0.1882998 0.1179535
#>
#>
kfolds2Chisqind(bbbNA)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.2169996 1.6869248 0.9080029 0.9287743 1.0658864 1.0672493 0.8468892
#> [8] 0.8089848 0.7311545
#>
#> [[1]][[2]]
#> [1] 3.719177 3.434162 3.012075 2.757994 2.872204 2.747240 2.800510 2.869313
#> [9] 3.868102
#>
#> [[1]][[3]]
#> [1] 1.832169 1.550921 1.204722 1.580365 1.300763 1.223632 1.451868 1.477664
#> [9] 1.479606
#>
#> [[1]][[4]]
#> [1] 0.7845042 0.4693467 0.3338035 0.3633763 0.2628447 0.2980458 0.3209635
#> [8] 0.2919794 0.3211792
#>
#> [[1]][[5]]
#> [1] 1.4171891 1.8739234 2.1054461 0.8232368 32.5737503 2.8679986 3.6279457
#> [8] 20.8863833 17.1502058
#>
#> [[1]][[6]]
#> [1] 0.5954218 0.9120790 1.2205720 1.1043135 1.1397225 1.1987425 1.1327736
#> [8] 1.1499350 1.1338614
#>
#> [[1]][[7]]
#> [1] 2.333276 1.471815 1.778913 1.466270 1.274682 1.101338 1.087361 1.213602
#> [9] 1.167533
#>
#> [[1]][[8]]
#> [1] 0.5993310 0.4289935 0.8210640 0.5906114 0.4902903 0.4237112 0.4385860
#> [8] 0.4050477 0.3964742
#>
#> [[1]][[9]]
#> [1] 0.3262618 0.3705181 0.6105660 0.6618923 0.5375915 0.5397548 0.5709107
#> [8] 0.5802689 0.6147151
#>
#> [[1]][[10]]
#> [1] 0.8603408 1.0351521 1.0962748 0.6685812 0.2043497 0.2035989 0.1327491
#> [8] 0.1882998 0.1179535
#>
#>
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] 1.622725 1.133662 1.131156 1.262468
#>
#> [[1]][[2]]
#> [1] 1.817568 1.721046 1.328263 1.187040
#>
#> [[1]][[3]]
#> [1] 2.633844 4.509174 2.975775 3.816601
#>
#> [[1]][[4]]
#> [1] 0.9470552 2.1436244 1.4031261 1.1992904
#>
#> [[1]][[5]]
#> [1] 6.238906 6.358348 5.702292 4.945047
#>
#>
kfolds2Chisqind(bbbNA3)
#> [[1]]
#> [[1]][[1]]
#> [1] 4.419860 4.250334 4.041978 3.930791 4.118144 4.611112 4.513158 4.494463
#> [9] 5.395129
#>
#> [[1]][[2]]
#> [1] 0.1977676 0.9417647 0.7365591 0.5994182 0.7581636 0.7924363 0.6233532
#> [8] 0.6236648 0.0958404
#>
#> [[1]][[3]]
#> [1] 1.4900206 1.3750245 0.7912330 0.7913849 1.0996923 1.4805663 1.5439061
#> [8] 1.2105181 1.1350007
#>
#> [[1]][[4]]
#> [1] 1.5457864 0.8811869 0.3489742 0.3980700 0.3690931 0.5419888 0.6143899
#> [8] 0.6352883 0.7750405
#>
#> [[1]][[5]]
#> [1] 0.2951755 0.4932952 0.5557877 0.4613454 0.5445926 0.5790580 0.5480461
#> [8] 0.4929761 0.5654871
#>
#> [[1]][[6]]
#> [1] 0.6831417 1.3610809 0.9387628 1.1555575 0.8744560 0.5322855 0.4996885
#> [8] 0.6262281 1.3324691
#>
#> [[1]][[7]]
#> [1] 1.6304186 1.2278593 0.3548124 2.9449266 2.5844455 11.0077115 11.1022632
#> [8] 10.6256660 11.5756748
#>
#> [[1]][[8]]
#> [1] 0.8422700 0.4254764 0.3690328 0.3150925 0.2544780 0.6393860 0.6499880
#> [8] 0.8807291 0.8044254
#>
#> [[1]][[9]]
#> [1] 1.348315 1.294047 1.024210 1.167113 1.422418 1.369221 1.374605 1.444214
#> [9] 1.478549
#>
#> [[1]][[10]]
#> [1] 0.7550577 1.0385591 1.1049280 1.7828495 1.9598348 1.8927776 1.9122002
#> [8] 1.9486653 1.9620620
#>
#>
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] 87.94775 156.55848 468.29043 3797.38704
#>
#> [[1]][[2]]
#> [1] 44.92822 310.85508 4351.65841 22512.82571
#>
#> [[1]][[3]]
#> [1] 32.45370 44.39932 134.57205 1225.81836
#>
#> [[1]][[4]]
#> [1] 24.13292 40.65945 65.81142 125.66658
#>
#> [[1]][[5]]
#> [1] 29.19939 116.38839 2700.00963 6298.30769
#>
#>
kfolds2Chisqind(cv.plsRglm(object=yaze_compl,dataX=Xaze_compl,nt=4,modele="pls-glm-logistic",
verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 23.71945 32.80686 48.37935 111.31990
#>
#> [[1]][[2]]
#> [1] 33.04099 34.98864 54.70000 286.88415
#>
#> [[1]][[3]]
#> [1] 29.04029 59.75615 6595.41494 215778.11902
#>
#> [[1]][[4]]
#> [1] 68.42631 624.73363 14939.84428 47721.45914
#>
#> [[1]][[5]]
#> [1] 25.20503 24.81453 54.27281 177.76315
#>
#>
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] 23.81105 75.48124 259.38316 282.73303 189.52979 344.14547 533.00085
#> [8] 794.52277 804.69347 863.23426
#>
#> [[1]][[2]]
#> [1] 13.22692 14.21606 14.18657 12.35091 13.30416 13.44207 14.03944 13.87701
#> [9] 14.31051 14.55744
#>
#> [[1]][[3]]
#> [1] 3.616742e+01 1.126087e+02 1.115299e+03 6.063955e+03 1.368298e+04
#> [6] 2.951455e+04 4.090504e+04 1.839531e+05 3.828123e+05 1.068556e+06
#>
#> [[1]][[4]]
#> [1] 6.237249 9.448145 11.737772 19.764538 29.927048 31.627313 27.614787
#> [8] 26.067944 23.959075 23.673068
#>
#> [[1]][[5]]
#> [1] 8.288730 6.717653 5.525802 9.136546 11.712572 14.740887 12.818845
#> [8] 12.461892 12.630076 13.584535
#>
#> [[1]][[6]]
#> [1] 20.03238 13.02489 20.26067 39.92648 71.76487 94.18123 158.23292
#> [8] 181.19863 194.77805 187.07185
#>
#> [[1]][[7]]
#> [1] 10.96208 16.81468 34.04086 48.86097 111.38747 188.00031 268.61377
#> [8] 309.94858 444.19019 532.26975
#>
#> [[1]][[8]]
#> [1] 31.89138 50.04075 106.28564 154.38394 124.75939 124.92804 121.89795
#> [8] 119.80265 111.61665 108.35828
#>
#> [[1]][[9]]
#> [1] 10.64469 11.72032 16.85083 62.28414 82.69732 136.80218 183.94426
#> [8] 202.94972 201.84011 192.47805
#>
#> [[1]][[10]]
#> [1] 30.25733 74.91938 202.09474 366.13928 609.60047 649.85026 693.93334
#> [8] 759.35265 771.52925 702.18211
#>
#>
kfolds2Chisqind(cv.plsRglm(object=yaze_compl,dataX=Xaze_compl,nt=10,
modele="pls-glm-logistic",K=10,verbose=FALSE))
#> [[1]]
#> [[1]][[1]]
#> [1] 20.41939 74.21808 613.62923 1293.17183 1313.47179 4799.65189
#> [7] 5465.09410 6213.44447 8153.88005 7623.56702
#>
#> [[1]][[2]]
#> [1] 7.377795 9.461525 23.114180 31.328624 33.158089 33.629562 36.831677
#> [8] 34.368925 37.034703 39.541355
#>
#> [[1]][[3]]
#> [1] 29.89616 25.12269 28.80606 49.91984 54.42617 43.20837 71.08081
#> [8] 112.88387 147.18503 160.52100
#>
#> [[1]][[4]]
#> [1] 54.28878 115.19081 1816.82561 5210.83808 4692.38804 5082.27714
#> [7] 6673.09262 14910.52317 38503.11928 64251.28102
#>
#> [[1]][[5]]
#> [1] 25.54499 50.82358 316.07965 1283.91411 3313.64454 5498.60454
#> [7] 16416.08604 47467.71857 68872.13509 76757.87313
#>
#> [[1]][[6]]
#> [1] 20.17796 33.16328 70.95343 112.78555 119.17926 127.44522 114.05372
#> [8] 117.21054 110.35475 105.22301
#>
#> [[1]][[7]]
#> [1] 8.509214 9.537985 12.976724 16.452572 19.854406 21.661372 22.028616
#> [8] 19.876406 19.750512 19.293287
#>
#> [[1]][[8]]
#> [1] 11.32060 16.57948 18.81458 20.64505 22.99320 23.30307 21.18043 19.94628
#> [9] 20.20394 19.93246
#>
#> [[1]][[9]]
#> [1] 10.061851 12.316944 12.123238 9.954245 11.571716 13.393430 14.512313
#> [8] 14.437717 14.280243 14.355198
#>
#> [[1]][[10]]
#> [1] 12.09673 11.57221 13.36435 21.16308 33.53559 63.76180 74.09645 74.07616
#> [9] 73.69777 66.27120
#>
#>
rm(list=c("Xaze_compl","yaze_compl"))
# }