This function implements k-fold cross-validation on complete or incomplete datasets for partial least squares regression generalized linear models

cv.plsRglm(object, ...)
# S3 method for default
cv.plsRglmmodel(object,dataX,nt=2,limQ2set=.0975,
modele="pls", family=NULL, K=5, NK=1, grouplist=NULL, random=TRUE, 
scaleX=TRUE, scaleY=NULL, keepcoeffs=FALSE, keepfolds=FALSE, 
keepdataY=TRUE, keepMclassed=FALSE, tol_Xi=10^(-12), weights, method,
verbose=TRUE,...)
# S3 method for formula
cv.plsRglmmodel(object,data=NULL,nt=2,limQ2set=.0975,
modele="pls", family=NULL, K=5, NK=1, grouplist=NULL, random=TRUE, 
scaleX=TRUE, scaleY=NULL, keepcoeffs=FALSE, keepfolds=FALSE, 
keepdataY=TRUE, keepMclassed=FALSE, tol_Xi=10^(-12),weights,subset,
start=NULL,etastart,mustart,offset,method,control= list(),contrasts=NULL,
verbose=TRUE,...)
PLS_glm_kfoldcv(dataY, dataX, nt = 2, limQ2set = 0.0975, modele = "pls", 
family = NULL, K = 5, NK = 1, grouplist = NULL, random = TRUE, 
scaleX = TRUE, scaleY = NULL, keepcoeffs = FALSE, keepfolds = FALSE, 
keepdataY = TRUE, keepMclassed=FALSE, tol_Xi = 10^(-12), weights, method,
verbose=TRUE)
PLS_glm_kfoldcv_formula(formula,data=NULL,nt=2,limQ2set=.0975,modele="pls",
family=NULL, K=5, NK=1, grouplist=NULL, random=TRUE, 
scaleX=TRUE, scaleY=NULL, keepcoeffs=FALSE, keepfolds=FALSE, keepdataY=TRUE, 
keepMclassed=FALSE, tol_Xi=10^(-12),weights,subset,start=NULL,etastart,
mustart,offset,method,control= list(),contrasts=NULL, verbose=TRUE)

Arguments

object

response (training) dataset or an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.

dataY

response (training) dataset

dataX

predictor(s) (training) dataset

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which plsRglm is called.

nt

number of components to be extracted

limQ2set

limit value for the Q2

modele

name of the PLS glm model to be fitted ("pls", "pls-glm-Gamma", "pls-glm-gaussian", "pls-glm-inverse.gaussian", "pls-glm-logistic", "pls-glm-poisson", "pls-glm-polr"). Use "modele=pls-glm-family" to enable the family option.

family

a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See family for details of family functions.) To use the family option, please set modele="pls-glm-family". User defined families can also be defined. See details.

K

number of groups. Defaults to 5.

NK

number of times the group division is made

grouplist

to specify the members of the K groups

random

should the K groups be made randomly. Defaults to TRUE

scaleX

scale the predictor(s) : must be set to TRUE for modele="pls" and should be for glms pls.

scaleY

scale the response : Yes/No. Ignored since non always possible for glm responses.

keepcoeffs

shall the coefficients for each model be returned

keepfolds

shall the groups' composition be returned

keepdataY

shall the observed value of the response for each one of the predicted value be returned

keepMclassed

shall the number of miss classed be returned (unavailable)

tol_Xi

minimal value for Norm2(Xi) and \(\mathrm{det}(pp' \times pp)\) if there is any missing value in the dataX. It defaults to \(10^{-12}\)

weights

an optional vector of 'prior weights' to be used in the fitting process. Should be NULL or a numeric vector.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

start

starting values for the parameters in the linear predictor.

etastart

starting values for the linear predictor.

mustart

starting values for the vector of means.

offset

this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector of length equal to the number of cases. One or more offset terms can be included in the formula instead or as well, and if more than one is specified their sum is used. See model.offset.

method
for fitting glms with glm ("pls-glm-Gamma", "pls-glm-gaussian", "pls-glm-inverse.gaussian", "pls-glm-logistic", "pls-glm-poisson", "modele=pls-glm-family")

the method to be used in fitting the model. The default method "glm.fit" uses iteratively reweighted least squares (IWLS). User-supplied fitting functions can be supplied either as a function or a character string naming a function, with a function which takes the same arguments as glm.fit. If "model.frame", the model frame is returned.

pls-glm-polr

logistic, probit, complementary log-log or cauchit (corresponding to a Cauchy latent variable).

control

a list of parameters for controlling the fitting process. For glm.fit this is passed to glm.control.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

verbose

should info messages be displayed ?

...

arguments to pass to cv.plsRglmmodel.default or to cv.plsRglmmodel.formula

Details

Predicts 1 group with the K-1 other groups. Leave one out cross validation is thus obtained for K==nrow(dataX).

There are seven different predefined models with predefined link functions available :

"pls"

ordinary pls models

"pls-glm-Gamma"

glm gaussian with inverse link pls models

"pls-glm-gaussian"

glm gaussian with identity link pls models

"pls-glm-inverse-gamma"

glm binomial with square inverse link pls models

"pls-glm-logistic"

glm binomial with logit link pls models

"pls-glm-poisson"

glm poisson with log link pls models

"pls-glm-polr"

glm polr with logit link pls models

Using the "family=" option and setting "modele=pls-glm-family" allows changing the family and link function the same way as for the glm function. As a consequence user-specified families can also be used.

The gaussian family

accepts the links (as names) identity, log and inverse.

The binomial family

accepts the links logit, probit, cauchit, (corresponding to logistic, normal and Cauchy CDFs respectively) log and cloglog (complementary log-log).

The Gamma family

accepts the links inverse, identity and log.

The poisson family

accepts the links log, identity, and sqrt.

The inverse.gaussian family

accepts the links 1/mu^2, inverse, identity and log.

The quasi family

accepts the links logit, probit, cloglog, identity, inverse, log, 1/mu^2 and sqrt.

The function power

can be used to create a power link function.

...

arguments to pass to cv.plsRglmmodel.default or to cv.plsRglmmodel.formula

A typical predictor has the form response ~ terms where response is the (numeric) response vector and terms is a series of terms which specifies a linear predictor for response. A terms specification of the form first + second indicates all the terms in first together with all the terms in second with any duplicates removed.

A specification of the form first:second indicates the the set of terms obtained by taking the interactions of all terms in first with all terms in second. The specification first*second indicates the cross of first and second. This is the same as first + second + first:second.

The terms in the formula will be re-ordered so that main effects come first, followed by the interactions, all second-order, all third-order and so on: to avoid this pass a terms object as the formula.

Non-NULL weights can be used to indicate that different observations have different dispersions (with the values in weights being inversely proportional to the dispersions); or equivalently, when the elements of weights are positive integers w_i, that each response y_i is the mean of w_i unit-weight observations.

Value

An object of class "cv.plsRglmmodel".

results_kfolds

list of NK. Each element of the list sums up the results for a group division:

list

of K matrices of size about nrow(dataX)/K * nt with the predicted values for a growing number of components

...

...

list

of K matrices of size about nrow(dataX)/K * nt with the predicted values for a growing number of components

folds

list of NK. Each element of the list sums up the informations for a group division:

list

of K vectors of length about nrow(dataX) with the numbers of the rows of dataX that were used as a training set

...

...

list

of K vectors of length about nrow(dataX) with the numbers of the rows of dataX that were used as a training set

dataY_kfolds

list of NK. Each element of the list sums up the results for a group division:

list

of K matrices of size about nrow(dataX)/K * 1 with the observed values of the response

...

...

list

of K matrices of size about nrow(dataX)/K * 1 with the observed values of the response

call

the call of the function

References

Nicolas Meyer, Myriam Maumy-Bertrand et Frederic 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.

Note

Work for complete and incomplete datasets.

See also

Summary method summary.cv.plsRglmmodel. kfolds2coeff, kfolds2Pressind, kfolds2Press, kfolds2Mclassedind, kfolds2Mclassed and summary to extract and transform results from k-fold cross validation.

Examples

data(Cornell)
bbb <- cv.plsRglm(Y~.,data=Cornell,nt=10)
#> 
#> Model: pls 
#> 
#> NK: 1 
#> Number of groups : 5 
#> 1 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____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
#> ****________________________________________________****
#> 
#> 2 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
#> 3 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
#> 4 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
#> 5 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
(sum1<-summary(bbb))
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      Q2cum_Y LimQ2_Y       Q2_Y  PRESS_Y      RSS_Y
#> Nb_Comp_0 82.01205           NA      NA         NA       NA 467.796667
#> Nb_Comp_1 53.15173    0.8735332  0.0975  0.8735332 59.16075  35.742486
#> Nb_Comp_2 41.08283    0.6604522  0.0975 -1.6848764 95.96416  11.066606
#> Nb_Comp_3 32.06411   -0.9182367  0.0975 -4.6493873 62.51954   4.418081
#> Nb_Comp_4 33.76477  -10.3577503  0.0975 -4.9209325 26.15916   4.309235
#> Nb_Comp_5 33.34373 -100.8118434  0.0975 -7.9640853 38.62835   3.521924
#> Nb_Comp_6 35.25533           NA  0.0975         NA       NA   3.496074
#>                R2_Y    AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof
#> Nb_Comp_0        NA  37.010388 1.000000    6.5212706 46.0708838 47.7893514
#> Nb_Comp_1 0.9235940   8.150064 2.740749    1.8665281  4.5699686  4.9558156
#> Nb_Comp_2 0.9763431  -3.918831 5.085967    1.1825195  2.1075461  2.3949331
#> Nb_Comp_3 0.9905556 -12.937550 5.121086    0.7488308  0.8467795  0.9628191
#> Nb_Comp_4 0.9907882 -11.236891 5.103312    0.7387162  0.8232505  0.9357846
#> Nb_Comp_5 0.9924713 -11.657929 6.006316    0.7096382  0.7976101  0.9198348
#> Nb_Comp_6 0.9925265  -9.746328 7.000002    0.7633343  0.9711322  1.1359501
#>           GMDL.dof DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0 27.59461         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1 21.34020         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2 27.40202         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3 24.40842         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4 24.23105         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5 28.21184         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6 33.18348         7      0.8361907  1.1070902  1.3048716   33.63927
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRmodel"
cvtable(sum1)
#> 
#> CV Q2 criterion:
#> 0 1 
#> 0 1 
#> 
#> CV Press criterion:
#> 1 2 3 4 
#> 0 0 0 1 

bbb2 <- cv.plsRglm(Y~.,data=Cornell,nt=3,
modele="pls-glm-family",family=gaussian(),K=12,verbose=FALSE)
(sum2<-summary(bbb2))
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8809146 0.0975  0.8809146          55.70774
#> Nb_Comp_2 31.46903 33.40866    0.9182731 0.0975  0.3137113          24.52966
#> Nb_Comp_3 31.54404 33.96857    0.6570253 0.0975 -3.1965930          20.84377
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
cvtable(sum2)
#> 
#> CV Q2Chi2 criterion:
#> 0 1 2 
#> 0 0 1 
#> 
#> CV PreChi2 criterion:
#> 1 2 3 
#> 0 0 1 

# \donttest{
#random=TRUE is the default to randomly create folds for repeated CV
bbb3 <- cv.plsRglm(Y~.,data=Cornell,nt=3,
modele="pls-glm-family",family=gaussian(),K=6,NK=10, verbose=FALSE)
(sum3<-summary(bbb3))
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1,  2,  3,  4,  5,  6,  7,  8,  9,  10
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8514412 0.0975  0.8514412          69.49531
#> Nb_Comp_2 31.46903 33.40866    0.8686852 0.0975  0.1160755          31.59366
#> Nb_Comp_3 31.54404 33.96857    0.2560071 0.0975 -4.6657217          28.14068
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[2]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8691635 0.0975  0.8691635          61.20489
#> Nb_Comp_2 31.46903 33.40866    0.9227105 0.0975  0.4092665          21.11428
#> Nb_Comp_3 31.54404 33.96857    0.7406202 0.0975 -2.3559502          16.66844
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[3]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8923096 0.0975  0.8923096          50.37723
#> Nb_Comp_2 31.46903 33.40866    0.9218234 0.0975  0.2740618          25.94683
#> Nb_Comp_3 31.54404 33.96857    0.7955820 0.0975 -1.6148235          12.98739
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[4]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8709731 0.0975  0.8709731          60.35835
#> Nb_Comp_2 31.46903 33.40866    0.8998964 0.0975  0.2241650          27.73027
#> Nb_Comp_3 31.54404 33.96857    0.6204121 0.0975 -2.7919514          18.83398
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[5]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8562760 0.0975  0.8562760          67.23361
#> Nb_Comp_2 31.46903 33.40866    0.9178340 0.0975  0.4283072          20.43372
#> Nb_Comp_3 31.54404 33.96857    0.6714575 0.0975 -2.9985222          19.85998
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[6]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8728097 0.0975  0.8728097          59.49918
#> Nb_Comp_2 31.46903 33.40866    0.9003580 0.0975  0.2165909          28.00099
#> Nb_Comp_3 31.54404 33.96857    0.6918752 0.0975 -2.0923181          15.35902
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[7]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8911629 0.0975  0.8911629          50.91366
#> Nb_Comp_2 31.46903 33.40866    0.9383015 0.0975  0.4331122          20.26198
#> Nb_Comp_3 31.54404 33.96857    0.7666514 0.0975 -2.7820819          18.78496
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[8]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8840611 0.0975  0.8840611          54.23584
#> Nb_Comp_2 31.46903 33.40866    0.9160466 0.0975  0.2758824          25.88176
#> Nb_Comp_3 31.54404 33.96857    0.6461741 0.0975 -3.2145504          20.93296
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[9]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8591885 0.0975  0.8591885          65.87117
#> Nb_Comp_2 31.46903 33.40866    0.9130996 0.0975  0.3828605          22.05810
#> Nb_Comp_3 31.54404 33.96857    0.6905258 0.0975 -2.5612537          17.68814
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> [[10]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 53.15173 54.60645    0.8743484 0.0975  0.8743484          58.77938
#> Nb_Comp_2 31.46903 33.40866    0.8396534 0.0975 -0.2761214          45.61175
#> Nb_Comp_3 31.54404 33.96857    0.4681173 0.0975 -2.3170803          16.47538
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      35.742486  35.742486 0.9235940
#> Nb_Comp_2       4.966831   4.966831 0.9893825
#> Nb_Comp_3       4.230693   4.230693 0.9909561
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
plot(cvtable(sum3))
#> 
#> CV Q2Chi2 criterion:
#> 0 1 2 
#> 0 1 9 
#> 
#> CV PreChi2 criterion:
#>  1  2  3 
#>  0  0 10 


data(aze_compl)
bbb <- cv.plsRglm(y~.,data=aze_compl,nt=10,K=10,modele="pls",keepcoeffs=TRUE, verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb)
#>            [,1]        [,2]      [,3]       [,4]      [,5]       [,6]
#>  [1,] 0.3256269 -0.05068057 0.5118687 -0.3121449 0.3083577 0.14027031
#>  [2,] 0.2953263 -0.13229347 0.4274934 -0.1392821 0.2041849 0.12827084
#>  [3,] 0.3254685 -0.07714334 0.4208162 -0.2707883 0.3541565 0.08859838
#>  [4,] 0.2065361 -0.19609499 0.3669875 -0.1819589 0.3296261 0.13895722
#>  [5,] 0.3000233  0.01566503 0.4921544 -0.1088044 0.2150981 0.08903702
#>  [6,] 0.2965216 -0.15149406 0.3994076 -0.1453242 0.2470616 0.12450899
#>  [7,] 0.3624552 -0.15896471 0.4452425 -0.1509339 0.2676417 0.12217249
#>  [8,] 0.2767731 -0.17642064 0.5715088 -0.2000151 0.2130651 0.06010219
#>  [9,] 0.3809928 -0.14092096 0.3772888 -0.2112978 0.2104647 0.11972501
#> [10,] 0.2737467 -0.19139356 0.5059821 -0.1699961 0.3389104 0.10431605
#>              [,7]        [,8]       [,9]       [,10]        [,11]        [,12]
#>  [1,] -0.04743208  0.05029577 -0.1034875  0.10192207 -0.082722854  0.134476051
#>  [2,] -0.04021724 -0.03490049 -0.2233919  0.08717944 -0.005937192 -0.055155397
#>  [3,] -0.04679930  0.03594274 -0.2468284 -0.03385339 -0.120749933  0.083770828
#>  [4,] -0.08741302  0.03638195 -0.1896945 -0.01727754 -0.053246210  0.191365279
#>  [5,] -0.01853969 -0.06298694 -0.2710191 -0.05534708 -0.140842010  0.013723704
#>  [6,] -0.04989370 -0.02431566 -0.2249358  0.10345796 -0.139423190 -0.005279132
#>  [7,] -0.05494359  0.04861734 -0.3351537  0.05971134 -0.120674866  0.098417770
#>  [8,] -0.01428866 -0.11180810 -0.1559196  0.02883969 -0.049183916  0.049202976
#>  [9,] -0.10972887  0.15273486 -0.2026251  0.16367184 -0.084534470  0.055682896
#> [10,] -0.02908283 -0.01581073 -0.2010643  0.06834608 -0.189100151  0.056751449
#>             [,13]      [,14]      [,15]       [,16]        [,17]     [,18]
#>  [1,] -0.16634331 0.09928489 0.06727440 -0.09702018 -0.007225681 0.1972815
#>  [2,] -0.21323781 0.16168892 0.11393142  0.09756540  0.028297261 0.2226120
#>  [3,] -0.03236631 0.15320776 0.02073189 -0.03811435  0.073050578 0.2627901
#>  [4,] -0.12151729 0.04874449 0.15880187  0.03232369 -0.025993832 0.2422114
#>  [5,] -0.13094858 0.11148900 0.16249139  0.03575605 -0.041819651 0.2073963
#>  [6,] -0.10198573 0.11387210 0.17055311  0.14578449  0.028232631 0.2040333
#>  [7,] -0.15162300 0.16421881 0.15084566  0.07613828  0.003249455 0.2029676
#>  [8,] -0.10415290 0.03645254 0.15423465  0.05303164 -0.034976536 0.3129991
#>  [9,] -0.10735206 0.09384016 0.07803927  0.05972717  0.013875415 0.2381070
#> [10,] -0.17077587 0.09356415 0.07190917  0.07843796  0.105173204 0.2442897
#>             [,19]      [,20]       [,21]        [,22]      [,23]       [,24]
#>  [1,]  0.13671540 0.10238322 -0.14817688  0.079776970 0.35559000 -0.22370963
#>  [2,]  0.04614056 0.05139534 -0.18450437  0.070488806 0.14451531 -0.10969690
#>  [3,] -0.03059378 0.02938184 -0.04726005  0.036993784 0.17290573 -0.25047175
#>  [4,]  0.13463917 0.10093726 -0.14512052 -0.007795451 0.17766162 -0.04838716
#>  [5,] -0.01676576 0.12883211 -0.10787338  0.024943450 0.27869062 -0.12655990
#>  [6,] -0.07682610 0.03570326 -0.09681054  0.074513906 0.10054366 -0.15073406
#>  [7,]  0.01229073 0.13963325 -0.12379572  0.057574199 0.22469093 -0.14173330
#>  [8,] -0.04263536 0.10623095 -0.10878677  0.144909334 0.12883608 -0.11797599
#>  [9,]  0.00674238 0.03929299 -0.12730256  0.033729141 0.09482756 -0.14837827
#> [10,]  0.03333090 0.06202210 -0.13631698  0.115237972 0.21177251 -0.12854298
#>             [,25]      [,26]      [,27]     [,28]       [,29]        [,30]
#>  [1,] -0.33151898 -0.3221322 0.09602259 0.1535589 -0.05742545  0.002334976
#>  [2,] -0.12570660 -0.2732878 0.17682376 0.2326739 -0.08411698  0.017645571
#>  [3,] -0.19236999 -0.3037933 0.16733390 0.1657493 -0.05715420  0.057676448
#>  [4,] -0.13940484 -0.3058209 0.15818796 0.2555012 -0.14025312  0.053090495
#>  [5,] -0.21708834 -0.2488358 0.26130377 0.1481874 -0.07387770  0.061054561
#>  [6,] -0.13301967 -0.2129116 0.17900865 0.1818523 -0.06243084  0.016130447
#>  [7,] -0.17293275 -0.3763729 0.17880688 0.2177906 -0.13242749  0.025740577
#>  [8,] -0.09132417 -0.3362950 0.26775576 0.1620441 -0.13644411 -0.031442129
#>  [9,] -0.18999432 -0.2388396 0.19303641 0.2353894 -0.13471482 -0.027687815
#> [10,] -0.25188796 -0.2634948 0.15228731 0.1692078 -0.08117880 -0.006670983
#>             [,31]       [,32]      [,33]        [,34]
#>  [1,] -0.01475653 -0.01221761 -0.4174092 -0.003708858
#>  [2,]  0.13829255 -0.08489624 -0.3623027  0.030999173
#>  [3,]  0.18993356 -0.07287448 -0.5063825  0.150348461
#>  [4,]  0.20979325 -0.05030503 -0.4237472 -0.116121319
#>  [5,]  0.02911287  0.02949574 -0.3581457 -0.064181130
#>  [6,]  0.15375711 -0.04146047 -0.3968912  0.022949433
#>  [7,]  0.04554581 -0.02078459 -0.3300446 -0.078345645
#>  [8,]  0.06644198 -0.03883017 -0.3408185 -0.032060553
#>  [9,]  0.19652958 -0.12790423 -0.3739291 -0.073494367
#> [10,]  0.13237087 -0.06100453 -0.3818294  0.020230542
bbb2 <- cv.plsRglm(y~.,data=aze_compl,nt=10,K=10,modele="pls-glm-family",
family=binomial(probit),keepcoeffs=TRUE, verbose=FALSE)
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
bbb2 <- cv.plsRglm(y~.,data=aze_compl,nt=10,K=10,
modele="pls-glm-logistic",keepcoeffs=TRUE, verbose=FALSE)
summary(bbb,MClassed=TRUE)
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC MissClassed CV_MissClassed       Q2cum_Y LimQ2_Y       Q2_Y
#> Nb_Comp_0  154.6179          49             NA            NA      NA         NA
#> Nb_Comp_1  126.4083          27             49    -0.1581654  0.0975 -0.1581654
#> Nb_Comp_2  119.3375          25             49    -0.8178361  0.0975 -0.5695824
#> Nb_Comp_3  114.2313          27             44    -2.3287449  0.0975 -0.8311579
#> Nb_Comp_4  112.3463          23             47    -6.0870577  0.0975 -1.1290480
#> Nb_Comp_5  113.2362          22             48   -15.1004212  0.0975 -1.2718062
#> Nb_Comp_6  114.7620          21             49   -35.8596618  0.0975 -1.2893601
#> Nb_Comp_7  116.5264          20             45   -83.6219835  0.0975 -1.2957884
#> Nb_Comp_8  118.4601          20             45  -193.8882948  0.0975 -1.3030457
#> Nb_Comp_9  120.4452          19             44  -446.9134950  0.0975 -1.2983089
#> Nb_Comp_10 122.4395          19             44 -1030.5479532  0.0975 -1.3030071
#>             PRESS_Y    RSS_Y      R2_Y  AIC.std  DoF.dof sigmahat.dof   AIC.dof
#> Nb_Comp_0        NA 25.91346        NA 298.1344  1.00000    0.5015845 0.2540061
#> Nb_Comp_1  30.01208 19.38086 0.2520929 269.9248 22.55372    0.4848429 0.2883114
#> Nb_Comp_2  30.41986 17.76209 0.3145613 262.8540 27.31542    0.4781670 0.2908950
#> Nb_Comp_3  32.52519 16.58896 0.3598323 257.7478 30.52370    0.4719550 0.2902572
#> Nb_Comp_4  35.31870 15.98071 0.3833049 255.8628 34.00000    0.4744263 0.3008285
#> Nb_Comp_5  36.30506 15.81104 0.3898523 256.7527 34.00000    0.4719012 0.2976347
#> Nb_Comp_6  36.19716 15.73910 0.3926285 258.2785 34.00000    0.4708264 0.2962804
#> Nb_Comp_7  36.13364 15.70350 0.3940024 260.0429 33.71066    0.4693382 0.2937976
#> Nb_Comp_8  36.16587 15.69348 0.3943888 261.9766 34.00000    0.4701436 0.2954217
#> Nb_Comp_9  36.06847 15.69123 0.3944758 263.9617 33.87284    0.4696894 0.2945815
#> Nb_Comp_10 36.13701 15.69037 0.3945088 265.9560 34.00000    0.4700970 0.2953632
#>              BIC.dof  GMDL.dof DoF.naive sigmahat.naive AIC.naive BIC.naive
#> Nb_Comp_0  0.2604032 -67.17645         1      0.5015845 0.2540061 0.2604032
#> Nb_Comp_1  0.4231184 -53.56607         2      0.4358996 0.1936625 0.2033251
#> Nb_Comp_2  0.4496983 -52.42272         3      0.4193593 0.1809352 0.1943501
#> Nb_Comp_3  0.4631316 -51.93343         4      0.4072955 0.1722700 0.1891422
#> Nb_Comp_4  0.4954133 -50.37079         5      0.4017727 0.1691819 0.1897041
#> Nb_Comp_5  0.4901536 -50.65724         6      0.4016679 0.1706451 0.1952588
#> Nb_Comp_6  0.4879234 -50.78005         7      0.4028135 0.1731800 0.2020601
#> Nb_Comp_7  0.4826103 -51.05525         8      0.4044479 0.1761610 0.2094352
#> Nb_Comp_8  0.4865092 -50.85833         9      0.4064413 0.1794902 0.2172936
#> Nb_Comp_9  0.4845867 -50.95616        10      0.4085682 0.1829787 0.2254232
#> Nb_Comp_10 0.4864128 -50.86368        11      0.4107477 0.1865584 0.2337468
#>            GMDL.naive
#> Nb_Comp_0   -67.17645
#> Nb_Comp_1   -79.67755
#> Nb_Comp_2   -81.93501
#> Nb_Comp_3   -83.31503
#> Nb_Comp_4   -83.23369
#> Nb_Comp_5   -81.93513
#> Nb_Comp_6   -80.42345
#> Nb_Comp_7   -78.87607
#> Nb_Comp_8   -77.31942
#> Nb_Comp_9   -75.80069
#> Nb_Comp_10  -74.33325
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRmodel"
summary(bbb2,MClassed=TRUE)
#> ____************************************************____
#> 
#> Family: binomial 
#> Link function: logit 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC MissClassed CV_MissClassed  Q2Chisqcum_Y  limQ2
#> Nb_Comp_0  145.8283 148.4727          49             NA            NA     NA
#> Nb_Comp_1  118.1398 123.4285          28             47 -9.215191e-01 0.0975
#> Nb_Comp_2  109.9553 117.8885          26             45 -5.988714e+00 0.0975
#> Nb_Comp_3  105.1591 115.7366          22             43 -7.644904e+01 0.0975
#> Nb_Comp_4  103.8382 117.0601          21             46 -1.302053e+03 0.0975
#> Nb_Comp_5  104.7338 120.6001          21             48 -2.751666e+04 0.0975
#> Nb_Comp_6  105.6770 124.1878          21             48 -7.810975e+05 0.0975
#> Nb_Comp_7  107.2828 128.4380          20             45 -2.910086e+07 0.0975
#> Nb_Comp_8  109.0172 132.8167          22             46 -1.427183e+09 0.0975
#> Nb_Comp_9  110.9354 137.3793          21             44 -7.527474e+10 0.0975
#> Nb_Comp_10 112.9021 141.9904          20             44 -4.163397e+12 0.0975
#>              Q2Chisq_Y PREChi2_Pearson_Y Chi2_Pearson_Y    RSS_Y      R2_Y
#> Nb_Comp_0           NA                NA      104.00000 25.91346        NA
#> Nb_Comp_1   -0.9215191          199.8380      100.53823 19.32272 0.2543365
#> Nb_Comp_2   -2.6370774          365.6653       99.17955 17.33735 0.3309519
#> Nb_Comp_3  -10.0820160         1099.1094      123.37836 15.58198 0.3986915
#> Nb_Comp_4  -15.8246527         2075.7980      114.77551 15.14046 0.4157299
#> Nb_Comp_5  -20.1178336         2423.8101      105.35382 15.08411 0.4179043
#> Nb_Comp_6  -27.3853530         2990.5053       98.87767 14.93200 0.4237744
#> Nb_Comp_7  -36.2563283         3683.8189       97.04072 14.87506 0.4259715
#> Nb_Comp_8  -48.0426297         4759.1320       98.90110 14.84925 0.4269676
#> Nb_Comp_9  -51.7435866         5216.3987      100.35563 14.84317 0.4272022
#> Nb_Comp_10 -54.3093484         5550.6045      102.85214 14.79133 0.4292027
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
kfolds2coeff(bbb2)
#>            [,1]       [,2]     [,3]      [,4]     [,5]       [,6]        [,7]
#>  [1,] -3.796258 -1.9480142 4.770182 -2.454437 2.752052  1.0096818 -0.11604671
#>  [2,] -2.557574 -0.7636703 4.780785 -2.482548 3.238246  0.1229138  0.35952424
#>  [3,] -2.007174 -1.5536856 3.697373 -1.772086 2.484147 -0.5031864 -0.28495288
#>  [4,] -1.728061 -1.7856873 3.806040 -1.601623 2.045737  1.3116408  0.73037954
#>  [5,] -3.453438 -2.2266754 5.642269 -2.114005 3.603294  1.1222765 -0.37108935
#>  [6,] -2.433427 -0.7464690 2.589557 -1.365401 2.184710  0.2264722 -0.45458480
#>  [7,] -1.096100 -0.5211219 5.181440 -1.586941 1.620509  1.3280447 -0.57794724
#>  [8,] -2.492087 -0.6136392 3.408571 -2.123478 2.351483  0.2675511  0.13486602
#>  [9,] -2.221066 -1.0426732 3.211749 -1.224234 2.616757  0.1884946  0.02524733
#> [10,] -1.844350 -1.4936079 2.937223 -1.812138 1.816067  0.9812172 -0.24220156
#>             [,8]       [,9]      [,10]       [,11]     [,12]      [,13]
#>  [1,] -1.2524232 -2.3678516 0.36662094  0.04336806 1.1026243 -1.8591688
#>  [2,] -0.1893304 -2.7832968 0.48757595 -0.88664733 0.7008493 -1.1341710
#>  [3,] -0.5200263 -0.4588827 0.28887053 -1.41406988 0.9341451 -1.0780962
#>  [4,] -0.5264805 -1.9915816 0.81145007 -0.62636987 0.5102042 -1.6812879
#>  [5,] -0.4252073 -2.3770899 0.76800926 -1.35961505 1.2499829 -0.6917471
#>  [6,]  0.2223290 -1.2980804 0.01357173 -0.26889267 0.3021760 -1.7792070
#>  [7,] -2.5700838 -1.0916675 0.64337058 -1.08916538 0.4176672 -1.1371416
#>  [8,]  0.2220635 -1.6375181 0.17609836 -1.01845537 0.5091799 -0.8562446
#>  [9,] -0.7428696 -1.0707940 0.20290552 -0.87658428 0.4226564 -0.4672580
#> [10,]  0.1495434 -1.0666114 0.45449526 -1.14663468 1.1040587 -1.2639675
#>            [,14]       [,15]      [,16]      [,17]     [,18]       [,19]
#>  [1,] -0.3560472  0.61563916 0.04068829  0.9098191 3.2799164 -0.08001138
#>  [2,]  0.1805092  0.99804436 0.40080305  1.0607102 2.4559034  0.37187457
#>  [3,]  0.8018103  1.40338167 0.50538828  0.9394665 1.5179325  0.31015703
#>  [4,]  1.0512385  0.74957629 0.85289651  0.5114352 1.4998818  0.81551704
#>  [5,]  0.9530802 -0.01403463 1.75115598  1.1311096 1.6996129 -1.05218841
#>  [6,]  2.1315790  1.00551303 0.74859471  1.1435119 0.8955807 -0.19678458
#>  [7,]  2.5236892  0.66760387 1.42454216 -0.1999153 1.4291671 -1.24696267
#>  [8,]  0.6582155  0.35712164 0.15638600  0.6180092 2.0671569 -0.18002721
#>  [9,]  0.4385668  0.43730755 0.57460143  0.6731368 1.6900649 -0.22239110
#> [10,]  0.8322529  1.60321444 0.36639069 -0.1781839 2.1161749  0.60161315
#>             [,20]      [,21]         [,22]     [,23]      [,24]      [,25]
#>  [1,]  1.27962173 -1.4416430  1.5118986237 1.2802707 -1.8547585 -0.7807032
#>  [2,]  0.86397025  0.1432122  0.3391127532 1.7143620 -2.1118330 -2.2805233
#>  [3,]  0.46654783 -1.0680958  0.1193353071 1.7301249 -1.2109508 -1.9999941
#>  [4,] -0.09761183 -2.1372773 -0.3243515582 1.6099380 -0.1331454 -1.3309810
#>  [5,]  0.81048688 -1.9350200  1.3297269776 2.3769794 -2.2045201 -3.1381461
#>  [6,]  0.63470060 -0.2108692  0.4185321635 1.2186327 -1.1723630 -1.9123293
#>  [7,]  0.44262892 -1.6198906  0.6355464451 0.8586501 -0.7422613 -1.3547022
#>  [8,]  0.69569507 -0.7182179  0.0991472220 1.7351494 -1.3584058 -1.3508308
#>  [9,]  0.21173655 -1.0631953  0.0009663303 1.4409191 -1.2923872 -1.5582873
#> [10,]  0.87250213 -0.8033070  0.4737774979 0.8735123 -0.9071651 -1.3105216
#>           [,26]    [,27]    [,28]       [,29]       [,30]     [,31]
#>  [1,] -2.619445 2.306821 1.492878 -0.18974482  0.81130708 1.6716825
#>  [2,] -2.332251 2.056909 1.214600 -0.59389455  0.91366083 1.8424632
#>  [3,] -2.385291 2.101857 2.204383 -0.96297664  0.84732976 1.3817554
#>  [4,] -2.184391 2.062477 1.597571 -0.35130461  0.06051042 0.3037523
#>  [5,] -2.754904 1.432117 3.134332 -0.82523727  1.12528645 1.0805898
#>  [6,] -1.705632 1.367760 1.217801 -0.94873681 -0.04990205 0.9485637
#>  [7,] -1.271747 1.255346 1.196654  0.07304741 -0.45884826 1.9491879
#>  [8,] -1.926225 1.359680 1.695728 -0.03725488  0.76568337 0.9472281
#>  [9,] -1.796189 1.665818 1.166009 -0.52339723  0.38922679 1.2042701
#> [10,] -2.454040 1.498991 1.362894 -0.76522067  0.24848455 1.7745386
#>              [,32]     [,33]       [,34]
#>  [1,] -0.374906663 -2.806827  0.16279023
#>  [2,] -0.372841001 -3.967243 -0.62776145
#>  [3,] -0.855836403 -2.835515  0.37913591
#>  [4,] -0.317504296 -2.717937  0.41386127
#>  [5,] -0.841231965 -3.216407 -0.03952542
#>  [6,]  0.408967187 -2.266139 -0.23512399
#>  [7,] -0.679081166 -5.121630  1.01547890
#>  [8,] -0.112427900 -3.143858  0.07016314
#>  [9,] -0.005675366 -2.226010  0.19824885
#> [10,]  0.197778002 -3.644992 -0.71958879

kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#>  [1]  16.81707  54.03931  54.05130 124.82780 123.84617 161.11720 307.83125
#>  [8] 567.13567 587.37026 637.82625
#> 
#> [[1]][[2]]
#>  [1]   24.37713   39.16882  330.07453  950.55175  782.11964  587.23844
#>  [7]  605.35268  996.98315 1333.30713 1619.21964
#> 
#> [[1]][[3]]
#>  [1]  41.43701  76.97713 126.02625 203.80979 276.80826 353.90640 288.97994
#>  [8] 302.11018 284.45021 264.15815
#> 
#> [[1]][[4]]
#>  [1] 12.12519 12.83216 11.41009 13.07176 19.82366 26.75183 36.53070 56.50114
#>  [9] 55.92773 57.47886
#> 
#> [[1]][[5]]
#>  [1]   9.433314  18.479975  47.754996 133.345913 166.037318 297.254258
#>  [7] 487.282615 703.799603 769.811924 805.584034
#> 
#> [[1]][[6]]
#>  [1] 26.37782 36.53600 65.34070 94.90556 73.73683 57.96348 50.36022 46.16410
#>  [9] 42.23080 41.83175
#> 
#> [[1]][[7]]
#>  [1]   17.76361   35.22703   74.45369  240.90664  580.84901 1010.24578
#>  [7] 1273.17382 1405.39706 1512.60992 1500.98556
#> 
#> [[1]][[8]]
#>  [1] 15.501014  9.771279 10.225713 11.318646 15.066915 21.478313 26.103652
#>  [8] 30.558621 34.096646 31.648297
#> 
#> [[1]][[9]]
#>  [1] 12.416807 13.195610  8.654661  7.854142  6.568361  6.685533  6.307098
#>  [8]  6.069619  5.627835  5.476215
#> 
#> [[1]][[10]]
#>  [1]  23.58903  69.43802 371.11749 295.20601 378.95396 467.86405 601.89694
#>  [8] 644.41286 590.96625 586.39572
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#>  [1]  199.8380  365.6653 1099.1094 2075.7980 2423.8101 2990.5053 3683.8189
#>  [8] 4759.1320 5216.3987 5550.6045
#> 
summary(bbb2)
#> ____************************************************____
#> 
#> Family: binomial 
#> Link function: logit 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC  Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0  145.8283 148.4727            NA     NA          NA                NA
#> Nb_Comp_1  118.1398 123.4285 -9.215191e-01 0.0975  -0.9215191          199.8380
#> Nb_Comp_2  109.9553 117.8885 -5.988714e+00 0.0975  -2.6370774          365.6653
#> Nb_Comp_3  105.1591 115.7366 -7.644904e+01 0.0975 -10.0820160         1099.1094
#> Nb_Comp_4  103.8382 117.0601 -1.302053e+03 0.0975 -15.8246527         2075.7980
#> Nb_Comp_5  104.7338 120.6001 -2.751666e+04 0.0975 -20.1178336         2423.8101
#> Nb_Comp_6  105.6770 124.1878 -7.810975e+05 0.0975 -27.3853530         2990.5053
#> Nb_Comp_7  107.2828 128.4380 -2.910086e+07 0.0975 -36.2563283         3683.8189
#> Nb_Comp_8  109.0172 132.8167 -1.427183e+09 0.0975 -48.0426297         4759.1320
#> Nb_Comp_9  110.9354 137.3793 -7.527474e+10 0.0975 -51.7435866         5216.3987
#> Nb_Comp_10 112.9021 141.9904 -4.163397e+12 0.0975 -54.3093484         5550.6045
#>            Chi2_Pearson_Y    RSS_Y      R2_Y
#> Nb_Comp_0       104.00000 25.91346        NA
#> Nb_Comp_1       100.53823 19.32272 0.2543365
#> Nb_Comp_2        99.17955 17.33735 0.3309519
#> Nb_Comp_3       123.37836 15.58198 0.3986915
#> Nb_Comp_4       114.77551 15.14046 0.4157299
#> Nb_Comp_5       105.35382 15.08411 0.4179043
#> Nb_Comp_6        98.87767 14.93200 0.4237744
#> Nb_Comp_7        97.04072 14.87506 0.4259715
#> Nb_Comp_8        98.90110 14.84925 0.4269676
#> Nb_Comp_9       100.35563 14.84317 0.4272022
#> Nb_Comp_10      102.85214 14.79133 0.4292027
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
rm(list=c("bbb","bbb2"))



data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
bbb <- cv.plsRglm(round(x11)~.,data=pine,nt=10,modele="pls-glm-family",
family=poisson(log),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
bbb <- cv.plsRglm(round(x11)~.,data=pine,nt=10,
modele="pls-glm-poisson",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb)
#>           [,1]         [,2]        [,3]       [,4]      [,5]      [,6]
#>  [1,] 12.02617 -0.005425686 -0.06112328 0.20033744 -1.441492 0.3541434
#>  [2,] 16.45902 -0.006524317 -0.09682613 0.32008354 -2.226715 0.4299023
#>  [3,] 14.50966 -0.007654325 -0.02533236 0.04852794 -2.363210 0.3989907
#>  [4,] 11.72007 -0.004363201 -0.07059224 0.19690757 -1.331494 0.2810243
#>  [5,] 11.97959 -0.004761413 -0.06812154 0.17723868 -1.338518 0.2585417
#>  [6,] 12.02336 -0.004760090 -0.05571658 0.20258121 -1.484055 0.2876773
#>  [7,] 13.27170 -0.004985394 -0.06813392 0.21797456 -1.500296 0.2378293
#>  [8,] 13.36574 -0.004424335 -0.09427985 0.21067827 -2.392142 0.4441946
#>  [9,] 12.83473 -0.005480613 -0.08144644 0.22085509 -1.370320 0.2781852
#> [10,] 11.84813 -0.004744840 -0.07540789 0.17191912 -1.587510 0.3210068
#>             [,7]       [,8]       [,9]      [,10]       [,11]
#>  [1,] -2.1025307  0.1833275 0.05663783 -1.0518016 -0.06780923
#>  [2,] -4.1504180  0.9119662 0.37146058 -0.8489843 -0.98409678
#>  [3,] -0.7505661  0.6296605 0.42260366 -1.1405880 -0.94072387
#>  [4,] -2.1093305 -0.0680758 0.10136795 -1.0801548 -0.08625801
#>  [5,] -1.9162621 -0.0407061 0.19426234 -1.1352277 -0.15511420
#>  [6,] -1.9218567  0.1996722 0.16224369 -1.5765750 -0.06510432
#>  [7,] -2.1897998 -0.5001627 0.32436654 -1.8744210  0.49962210
#>  [8,] -2.4912292  0.2364110 0.43066745 -1.3699313 -0.50082628
#>  [9,] -2.7422223  0.2507500 0.18639017 -0.6272948 -0.24007502
#> [10,] -1.7297709 -0.1269304 0.19753083 -1.3265924  0.15010038
boxplot(kfolds2coeff(bbb)[,1])


kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#>  [1] 2.051147 2.538628 2.709164 2.799569 2.970619 3.038844 3.249683 2.735377
#>  [9] 2.785830 2.790548
#> 
#> [[1]][[2]]
#>  [1]  6.198765 10.266540  9.192621  8.593324  8.887805 10.461113 17.674862
#>  [8] 20.734020 25.802401 24.958043
#> 
#> [[1]][[3]]
#>  [1]  8.513518  8.253240  5.916365  5.270353 14.255028 13.568544 20.679708
#>  [8] 25.552183 24.526830 22.691182
#> 
#> [[1]][[4]]
#>  [1] 9.3723428 2.7703384 0.9009167 0.8612661 0.7983106 0.9111011 0.4439919
#>  [8] 0.4461617 0.4583128 0.4582111
#> 
#> [[1]][[5]]
#>  [1] 2.5676952 1.6922801 1.2875736 1.1817702 0.9607655 0.8393029 0.7749128
#>  [8] 0.7483948 0.7526808 0.7536941
#> 
#> [[1]][[6]]
#>  [1] 1.047664 1.136461 1.706599 2.041336 1.063973 1.039967 1.062821 1.079262
#>  [9] 1.127048 1.120546
#> 
#> [[1]][[7]]
#>  [1] 0.9094866 2.6772786 1.6769238 2.4217956 2.3877307 2.3019699 2.4107576
#>  [8] 1.4739514 1.5284388 1.5919895
#> 
#> [[1]][[8]]
#>  [1] 0.5827282 0.2711722 1.4593835 2.0475117 3.5148933 6.0797063 5.2205065
#>  [8] 6.0395985 6.1539386 5.9285619
#> 
#> [[1]][[9]]
#>  [1] 1.1146538 1.9551359 1.2849013 1.1795142 1.0914246 0.7450664 0.8086909
#>  [8] 0.8027657 0.9061439 0.9080121
#> 
#> [[1]][[10]]
#>  [1] 0.7523998 1.0425104 0.6034537 1.2691293 1.2672532 1.1505591 0.8744419
#>  [8] 0.6967357 0.6818060 0.6793979
#> 
#> 
kfolds2Chisq(bbb)
#> [[1]]
#>  [1] 33.11040 32.60359 26.73790 27.66557 37.19780 40.13617 53.20038 60.30845
#>  [9] 64.72343 61.88019
#> 
summary(bbb)
#> ____************************************************____
#> 
#> Family: poisson 
#> Link function: log 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC  Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0  76.61170 78.10821            NA     NA          NA                NA
#> Nb_Comp_1  65.70029 68.69331  1.895113e-02 0.0975  0.01895113          33.11040
#> Nb_Comp_2  62.49440 66.98392 -3.406190e-01 0.0975 -0.36651599          32.60359
#> Nb_Comp_3  62.47987 68.46590 -1.071995e+00 0.0975 -0.54555079          26.73790
#> Nb_Comp_4  64.21704 71.69958 -2.696019e+00 0.0975 -0.78379728          27.66557
#> Nb_Comp_5  65.81654 74.79559 -8.021638e+00 0.0975 -1.44090702          37.19780
#> Nb_Comp_6  66.48888 76.96443 -2.272404e+01 0.0975 -1.62968255          40.13617
#> Nb_Comp_7  68.40234 80.37440 -7.012065e+01 0.0975 -1.99783007          53.20038
#> Nb_Comp_8  70.39399 83.86256 -2.366986e+02 0.0975 -2.34218893          60.30845
#> Nb_Comp_9  72.37642 87.34149 -8.452968e+02 0.0975 -2.56037691          64.72343
#> Nb_Comp_10 74.37612 90.83770 -2.853013e+03 0.0975 -2.37235526          61.88019
#>            Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0        33.75000 24.545455        NA
#> Nb_Comp_1        23.85891 12.599337 0.4866937
#> Nb_Comp_2        17.29992  9.056074 0.6310488
#> Nb_Comp_3        15.50937  8.232069 0.6646194
#> Nb_Comp_4        15.23934  8.125808 0.6689485
#> Nb_Comp_5        15.26275  7.862134 0.6796909
#> Nb_Comp_6        17.74629  6.203270 0.7472742
#> Nb_Comp_7        18.04460  5.879880 0.7604493
#> Nb_Comp_8        18.17881  5.827065 0.7626011
#> Nb_Comp_9        18.34925  5.837300 0.7621841
#> Nb_Comp_10       18.39332  5.832437 0.7623822
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm(ypine,Xpine,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                 AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0  82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1  63.61896  0.38248575  0.0975  0.38248575 12.844390 11.074659
#> Nb_Comp_2  58.47638  0.34836456  0.0975 -0.05525570 11.686597  8.919303
#> Nb_Comp_3  56.55421  0.23688359  0.0975 -0.17107874 10.445206  7.919786
#> Nb_Comp_4  54.35053  0.06999681  0.0975 -0.21869112  9.651773  6.972542
#> Nb_Comp_5  55.99834 -0.07691053  0.0975 -0.15796434  8.073955  6.898523
#> Nb_Comp_6  57.69592 -0.19968885  0.0975 -0.11400977  7.685022  6.835594
#> Nb_Comp_7  59.37953 -0.27722139  0.0975 -0.06462721  7.277359  6.770369
#> Nb_Comp_8  61.21213 -0.30602578  0.0975 -0.02255238  6.923057  6.736112
#> Nb_Comp_9  63.18426 -0.39920228  0.0975 -0.07134354  7.216690  6.730426
#> Nb_Comp_10 65.15982 -0.43743644  0.0975 -0.02732569  6.914340  6.725443
#>                 R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0         NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1  0.4675684 0.4675684   17.03781     19.76046  0.38248575 0.0975
#> Nb_Comp_2  0.5711905 0.5711905   13.72190     17.97925 -0.05525570 0.0975
#> Nb_Comp_3  0.6192438 0.6192438   12.18420     16.06943 -0.17107874 0.0975
#> Nb_Comp_4  0.6647841 0.6647841   10.72691     14.84877 -0.21869112 0.0975
#> Nb_Comp_5  0.6683426 0.6683426   10.61304     12.42138 -0.15796434 0.0975
#> Nb_Comp_6  0.6713681 0.6713681   10.51622     11.82303 -0.11400977 0.0975
#> Nb_Comp_7  0.6745039 0.6745039   10.41588     11.19586 -0.06462721 0.0975
#> Nb_Comp_8  0.6761508 0.6761508   10.36317     10.65078 -0.02255238 0.0975
#> Nb_Comp_9  0.6764242 0.6764242   10.35443     11.10252 -0.07134354 0.0975
#> Nb_Comp_10 0.6766638 0.6766638   10.34676     10.63737 -0.02732569 0.0975
#>            Q2cum_residY  AIC.std   DoF.dof sigmahat.dof   AIC.dof   BIC.dof
#> Nb_Comp_0            NA 96.63448  1.000000    0.8062287 0.6697018 0.6991787
#> Nb_Comp_1    0.38248575 77.83455  3.176360    0.5994089 0.4047616 0.4565153
#> Nb_Comp_2    0.34836456 72.69198  7.133559    0.5761829 0.4138120 0.5212090
#> Nb_Comp_3    0.23688359 70.76981  8.778329    0.5603634 0.4070516 0.5320535
#> Nb_Comp_4    0.06999681 68.56612  8.427874    0.5221703 0.3505594 0.4547689
#> Nb_Comp_5   -0.07691053 70.21393  9.308247    0.5285695 0.3666578 0.4845912
#> Nb_Comp_6   -0.19968885 71.91152  9.291931    0.5259794 0.3629363 0.4795121
#> Nb_Comp_7   -0.27722139 73.59512  9.756305    0.5284535 0.3702885 0.4938445
#> Nb_Comp_8   -0.30602578 75.42772 10.363948    0.5338475 0.3831339 0.5170783
#> Nb_Comp_9   -0.39920228 77.39986 10.732136    0.5378275 0.3920954 0.5328742
#> Nb_Comp_10  -0.43743644 79.37542 11.000000    0.5407500 0.3987417 0.5446065
#>             GMDL.dof DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0  -3.605128         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1  -9.875081         2      0.5977015 0.3788984 0.4112998 -11.451340
#> Nb_Comp_2  -6.985517         3      0.5452615 0.3243383 0.3647862 -12.822703
#> Nb_Comp_3  -6.260610         4      0.5225859 0.3061986 0.3557368 -12.756838
#> Nb_Comp_4  -8.152986         5      0.4990184 0.2867496 0.3432131 -12.811575
#> Nb_Comp_5  -7.111583         6      0.5054709 0.3019556 0.3714754 -11.329638
#> Nb_Comp_6  -7.233043         7      0.5127450 0.3186757 0.4021333  -9.918688
#> Nb_Comp_7  -6.742195         8      0.5203986 0.3364668 0.4347156  -8.592770
#> Nb_Comp_8  -6.038372         9      0.5297842 0.3572181 0.4717708  -7.287834
#> Nb_Comp_9  -5.600249        10      0.5409503 0.3813021 0.5140048  -6.008747
#> Nb_Comp_10 -5.288422        11      0.5529032 0.4076026 0.5600977  -4.799453

data(pineNAX21)
bbb2 <- cv.plsRglm(round(x11)~.,data=pineNAX21,nt=10,
modele="pls-glm-family",family=poisson(log),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
bbb2 <- cv.plsRglm(round(x11)~.,data=pineNAX21,nt=10,
modele="pls-glm-poisson",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb2)
#>           [,1]         [,2]        [,3]      [,4]       [,5]      [,6]
#>  [1,] 10.64244 -0.006192583 -0.03577575 0.0574471 -1.4409091 0.3657323
#>  [2,] 14.30727 -0.004861643 -0.06586657 0.2213858 -1.4986729 0.2587631
#>  [3,] 17.09290 -0.005963655 -0.07270815 0.3054982 -1.1685614 0.2148504
#>  [4,] 19.43907 -0.007566021 -0.06894298 0.2958224 -1.8481342 0.3364176
#>  [5,] 14.07601 -0.004429923 -0.09255630 0.1929528 -2.3850745 0.4466682
#>  [6,] 15.55405 -0.004882650 -0.06884187 0.2687059 -1.5135835 0.2427807
#>  [7,] 13.32790 -0.005161932 -0.07200378 0.1912020 -1.6380636 0.3218455
#>  [8,] 18.73552 -0.007076382 -0.09336977 0.3463300 -2.4506633 0.4599708
#>  [9,] 13.21172 -0.005165856 -0.07381101 0.1793132 -1.1334712 0.2761305
#> [10,] 10.88161 -0.003529054 -0.03811335 0.1309183 -0.9978098 0.2049170
#>             [,7]       [,8]         [,9]      [,10]       [,11]
#>  [1,] -0.4587816  0.1182567  0.001645109 -0.8969772  0.09038152
#>  [2,] -2.4436372 -0.2014141  0.338409819 -1.7195690 -0.10985928
#>  [3,] -3.6974720 -0.1465092  0.443804647 -1.8210521 -0.85357670
#>  [4,] -3.0674690 -0.3839850  0.374256882 -1.8758547 -0.36427916
#>  [5,] -2.2141733  0.2740620  0.413031215 -1.3950896 -0.46736385
#>  [6,] -3.1051096 -0.6834490  0.343044901 -1.6036369  0.08107420
#>  [7,] -2.0458030  0.2528909  0.227534423 -1.2273129 -0.20748945
#>  [8,] -4.4735972  1.1218032  0.397860247 -0.9198768 -1.08657274
#>  [9,] -1.7125247 -0.2422332 -0.084708433 -0.5842271 -0.11992721
#> [10,] -0.8233666 -0.6851098 -0.025589375 -1.6085909  0.39643444
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1]  7.189777 14.255446 28.211227 31.473963  9.252340 35.141482 24.731153
#> [8] 14.460082  8.609380
#> 
#> [[1]][[2]]
#> [1] 1.4381039 0.9190837 1.2372792 1.7564740 1.2252801 1.1977177 1.4004792
#> [8] 0.6340404 0.6368125
#> 
#> [[1]][[3]]
#> [1] 3.389464 4.832666 3.403749 3.236913 4.042248 3.546628 3.210483 2.746766
#> [9] 1.810179
#> 
#> [[1]][[4]]
#> [1] 12.526813  5.080400  3.609672  3.816206  5.000904  4.316888  2.083007
#> [8]  3.573833  3.874099
#> 
#> [[1]][[5]]
#> [1] 0.4420471 0.7552629 1.7795279 1.4914004 0.8955259 3.9311240 4.7508005
#> [8] 5.8002755 5.7043760
#> 
#> [[1]][[6]]
#> [1] 1.2074812 1.1873442 0.4472037 0.6075183 1.5502918 1.2459582 1.4098308
#> [8] 0.9081755 1.0599636
#> 
#> [[1]][[7]]
#> [1] 0.6588862 0.4793606 0.2148519 0.2052145 0.2362090 0.3196982 0.3689388
#> [8] 0.2762677 0.2832170
#> 
#> [[1]][[8]]
#> [1]  3.729078  7.784346 10.162194  9.518467 12.461750 15.854271 22.587624
#> [8] 25.835763 28.331635
#> 
#> [[1]][[9]]
#> [1] 0.9216437 2.0946945 1.6532138 2.0792797 1.9729218 1.7290017 1.1521937
#> [8] 1.0903216 1.0730794
#> 
#> [[1]][[10]]
#> [1] 3.588466 2.387869 2.268821 2.666804 2.851504 2.353577 2.013073 1.988883
#> [9] 1.931498
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1] 35.09176 39.77647 52.98774 56.85224 39.48898 69.63635 63.70758 57.31441
#> [9] 53.31424
#> 
summary(bbb2)
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> 
#> Family: poisson 
#> Link function: log 
#> 
#> ____There are some NAs in X but not in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 76.61170 78.10821            NA     NA          NA                NA
#> Nb_Comp_1 65.74449 68.73751 -3.975584e-02 0.0975 -0.03975584          35.09176
#> Nb_Comp_2 62.35674 66.84626 -7.311012e-01 0.0975 -0.66491124          39.77647
#> Nb_Comp_3 62.39804 68.38407 -4.298556e+00 0.0975 -2.06080075          52.98774
#> Nb_Comp_4 64.08113 71.56366 -1.841359e+01 0.0975 -2.66393927          56.85224
#> Nb_Comp_5 65.63784 74.61689 -4.906627e+01 0.0975 -1.57892938          39.48898
#> Nb_Comp_6 67.18468 77.66024 -2.237631e+02 0.0975 -3.48931128          69.63635
#> Nb_Comp_7 68.61004 80.58210 -8.771775e+02 0.0975 -2.90712565          63.70758
#> Nb_Comp_8 70.54487 84.01344 -2.871832e+03 0.0975 -2.27135723          57.31441
#> Nb_Comp_9 72.37296 87.33803 -8.624171e+03 0.0975 -2.00232300          53.31424
#>           Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0       33.75000 24.545455        NA
#> Nb_Comp_1       23.89105 12.654950 0.4844280
#> Nb_Comp_2       17.31172  8.871122 0.6385839
#> Nb_Comp_3       15.51670  8.203709 0.6657748
#> Nb_Comp_4       15.31216  7.959332 0.6757309
#> Nb_Comp_5       15.51159  7.724832 0.6852846
#> Nb_Comp_6       16.30549  6.814620 0.7223673
#> Nb_Comp_7       17.52007  6.284737 0.7439552
#> Nb_Comp_8       17.75766  6.160827 0.7490034
#> Nb_Comp_9       18.30206  5.831059 0.7624383
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"

data(XpineNAX21)
PLS_lm(ypine,XpineNAX21,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> ____There are some NAs in X but not in Y____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#>                AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0 82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1 63.69250  0.35639805  0.0975  0.35639805 13.387018 11.099368
#> Nb_Comp_2 58.35228  0.28395028  0.0975 -0.11256611 12.348781  8.885823
#> Nb_Comp_3 56.36553  0.07664889  0.0975 -0.28950699 11.458331  7.874634
#> Nb_Comp_4 54.02416 -0.70355579  0.0975 -0.84497074 14.528469  6.903925
#> Nb_Comp_5 55.80450 -0.94905654  0.0975 -0.14411078  7.898855  6.858120
#> Nb_Comp_6 57.45753 -1.27568315  0.0975 -0.16758190  8.007417  6.786392
#> Nb_Comp_7 58.73951 -1.63309014  0.0975 -0.15705481  7.852227  6.640327
#> Nb_Comp_8 60.61227 -1.67907859  0.0975 -0.01746558  6.756304  6.614773
#> Nb_Comp_9 62.25948 -2.15165796  0.0975 -0.17639623  7.781594  6.544432
#>                R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0        NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1 0.4663804 0.4663804   17.07583     20.59526  0.35639805 0.0975
#> Nb_Comp_2 0.5728001 0.5728001   13.67040     18.99799 -0.11256611 0.0975
#> Nb_Comp_3 0.6214146 0.6214146   12.11473     17.62807 -0.28950699 0.0975
#> Nb_Comp_4 0.6680830 0.6680830   10.62135     22.35133 -0.84497074 0.0975
#> Nb_Comp_5 0.6702851 0.6702851   10.55088     12.15200 -0.14411078 0.0975
#> Nb_Comp_6 0.6737336 0.6737336   10.44053     12.31901 -0.16758190 0.0975
#> Nb_Comp_7 0.6807558 0.6807558   10.21581     12.08026 -0.15705481 0.0975
#> Nb_Comp_8 0.6819844 0.6819844   10.17650     10.39424 -0.01746558 0.0975
#> Nb_Comp_9 0.6853661 0.6853661   10.06828     11.97160 -0.17639623 0.0975
#>           Q2cum_residY  AIC.std DoF.dof sigmahat.dof AIC.dof BIC.dof GMDL.dof
#> Nb_Comp_0           NA 96.63448      NA           NA      NA      NA       NA
#> Nb_Comp_1   0.35639805 77.90810      NA           NA      NA      NA       NA
#> Nb_Comp_2   0.28395028 72.56787      NA           NA      NA      NA       NA
#> Nb_Comp_3   0.07664889 70.58113      NA           NA      NA      NA       NA
#> Nb_Comp_4  -0.70355579 68.23976      NA           NA      NA      NA       NA
#> Nb_Comp_5  -0.94905654 70.02009      NA           NA      NA      NA       NA
#> Nb_Comp_6  -1.27568315 71.67313      NA           NA      NA      NA       NA
#> Nb_Comp_7  -1.63309014 72.95511      NA           NA      NA      NA       NA
#> Nb_Comp_8  -1.67907859 74.82787      NA           NA      NA      NA       NA
#> Nb_Comp_9  -2.15165796 76.47507      NA           NA      NA      NA       NA
#>           DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1         2      0.5983679 0.3797438 0.4122175 -11.413749
#> Nb_Comp_2         3      0.5442372 0.3231208 0.3634169 -12.847656
#> Nb_Comp_3         4      0.5210941 0.3044529 0.3537087 -12.776843
#> Nb_Comp_4         5      0.4965569 0.2839276 0.3398355 -12.891035
#> Nb_Comp_5         6      0.5039885 0.3001871 0.3692997 -11.349498
#> Nb_Comp_6         7      0.5108963 0.3163819 0.3992388  -9.922119
#> Nb_Comp_7         8      0.5153766 0.3300041 0.4263658  -8.696873
#> Nb_Comp_8         9      0.5249910 0.3507834 0.4632727  -7.337679
#> Nb_Comp_9        10      0.5334234 0.3707649 0.4998004  -6.033403
rm(list=c("Xpine","XpineNAX21","ypine","bbb","bbb2"))
#> Warning: object 'XpineNAX21' not found



data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
bbb <- cv.plsRglm(x11~.,data=pine,nt=10,modele="pls-glm-family",
family=Gamma,K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
bbb <- cv.plsRglm(x11~.,data=pine,nt=10,modele="pls-glm-Gamma",
K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb)
#>             [,1]        [,2]        [,3]       [,4]     [,5]       [,6]
#>  [1,] -14.182325 0.006350234 0.043649142 -0.2349698 2.219583 -0.4300366
#>  [2,] -11.274678 0.004937411 0.030710623 -0.2436362 1.208237 -0.2998667
#>  [3,] -12.460232 0.007375547 0.094316054 -0.1183577 1.568857 -0.3911593
#>  [4,] -11.254916 0.006014047 0.038786348 -0.1213959 1.898377 -0.3703418
#>  [5,]  -7.984504 0.007554886 0.001084727  0.2564955 2.025866 -0.4512682
#>  [6,] -18.249200 0.006833959 0.050383872 -0.2993778 1.923166 -0.2933477
#>  [7,] -11.070230 0.005660748 0.042011222 -0.1268226 1.771667 -0.3535702
#>  [8,] -12.651533 0.004752655 0.075189312 -0.2325736 2.830030 -0.5508897
#>  [9,] -10.457563 0.005471516 0.018917030 -0.1068279 1.345443 -0.2907373
#> [10,] -12.691806 0.006298661 0.032644885 -0.1916520 1.579411 -0.2941066
#>            [,7]        [,8]        [,9]      [,10]     [,11]
#>  [1,]  3.263560 -0.84382988 -0.27891786  0.7877604 1.3636612
#>  [2,]  2.653026  0.08235457 -0.02035895  1.3814982 0.2575528
#>  [3,]  1.506473 -0.56451530  0.25096511 -0.6912000 0.1107983
#>  [4,]  1.653807 -0.52068498 -0.29937930  0.9289533 0.7105314
#>  [5,] -3.061461  0.10384985 -0.01202008  0.3588679 0.1145385
#>  [6,]  3.850191  1.14216639 -0.53933289  1.8939019 0.6094897
#>  [7,]  1.820419 -0.37903563 -0.26693684  0.9409202 0.6201157
#>  [8,]  3.267687 -0.78193015 -0.38226793  0.8404793 1.0194938
#>  [9,]  1.359154 -0.08727745 -0.07541610  0.8692747 0.5961947
#> [10,]  2.627978 -0.55633736 -0.30281043  1.0890606 0.9276246
boxplot(kfolds2coeff(bbb)[,1])


kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#>  [1] 1.962894 2.597282 2.694389 3.165319 3.143305 3.222155 3.778794 4.003244
#>  [9] 4.606353 4.607184
#> 
#> [[1]][[2]]
#>  [1] 1.584505 1.758046 1.968622 2.286295 2.166933 2.102089 2.052552 2.028532
#>  [9] 2.066703 2.080978
#> 
#> [[1]][[3]]
#>  [1]  2.303920  2.616236  5.527335  6.394929  4.355455  8.235015 12.930350
#>  [8] 14.617834 14.753922 13.959196
#> 
#> [[1]][[4]]
#>  [1] 4.1955791 3.5939794 2.3026792 1.5469429 1.4367405 0.9635877 0.9376372
#>  [8] 0.9239582 0.9130698 0.8858145
#> 
#> [[1]][[5]]
#>  [1]  2.661828  5.414446  5.675876  4.240177  4.630964  6.328385  7.639531
#>  [8] 10.288411 11.680859 11.846416
#> 
#> [[1]][[6]]
#>  [1]  2.259071  3.380925 10.704205 11.554653  4.767871  9.890764 11.518941
#>  [8]  9.765077  9.710141 10.130359
#> 
#> [[1]][[7]]
#>  [1] 0.8949517 1.9277231 1.2139792 1.1459557 1.2975085 1.0375406 0.7298916
#>  [8] 0.5649836 0.5851474 0.5848689
#> 
#> [[1]][[8]]
#>  [1]  1.1310833  0.8489768  0.5107418  1.1741698  4.6491332  5.3441574
#>  [7]  7.3472377  9.5048178 10.0591559  9.9788599
#> 
#> [[1]][[9]]
#>  [1] 1.2647555 1.2184570 1.1369357 0.9899496 0.9498022 0.8768307 0.8850581
#>  [8] 0.8839267 0.8525615 0.8745027
#> 
#> [[1]][[10]]
#>  [1] 2.403789 2.664756 3.015059 1.902263 1.341906 1.272187 1.530557 1.539344
#>  [9] 1.767483 1.768374
#> 
#> 
kfolds2Chisq(bbb)
#> [[1]]
#>  [1] 20.66238 26.02083 34.74982 34.40065 28.73962 39.27271 49.35055 54.12013
#>  [9] 56.99540 56.71655
#> 
summary(bbb)
#> ____************************************************____
#> 
#> Family: Gamma 
#> Link function: inverse 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC  Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0  56.60919 59.60220            NA     NA         NA                NA
#> Nb_Comp_1  39.01090 43.50042  3.462937e-01 0.0975  0.3462937          20.66238
#> Nb_Comp_2  37.30801 43.29404  1.757668e-02 0.0975 -0.5028513          26.02083
#> Nb_Comp_3  36.87524 44.35777 -1.006955e+00 0.0975 -1.0428612          34.74982
#> Nb_Comp_4  36.55795 45.53700 -3.360210e+00 0.0975 -1.1725507          34.40065
#> Nb_Comp_5  37.13611 47.61167 -8.263919e+00 0.0975 -1.1246495          28.73962
#> Nb_Comp_6  38.27656 50.24862 -2.573250e+01 0.0975 -1.8856575          39.27271
#> Nb_Comp_7  39.39377 52.86234 -9.383221e+01 0.0975 -2.5474504          49.35055
#> Nb_Comp_8  40.96122 55.92630 -3.424400e+02 0.0975 -2.6215541          54.12013
#> Nb_Comp_9  42.90816 59.36974 -1.282122e+03 0.0975 -2.7360885          56.99540
#> Nb_Comp_10 44.90815 62.86625 -4.800752e+03 0.0975 -2.7422409          56.71655
#>            Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0        31.60805 20.800152        NA
#> Nb_Comp_1        17.31431 11.804594 0.4324756
#> Nb_Comp_2        17.01037  6.357437 0.6943562
#> Nb_Comp_3        15.83422  5.699662 0.7259798
#> Nb_Comp_4        13.52676  7.679741 0.6307844
#> Nb_Comp_5        13.60962  6.099077 0.7067773
#> Nb_Comp_6        13.91155  5.205052 0.7497590
#> Nb_Comp_7        14.94390  4.650377 0.7764258
#> Nb_Comp_8        15.25537  4.321314 0.7922461
#> Nb_Comp_9        15.15577  4.307757 0.7928978
#> Nb_Comp_10       15.15490  4.307391 0.7929154
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm(ypine,Xpine,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                 AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0  82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1  63.61896  0.38248575  0.0975  0.38248575 12.844390 11.074659
#> Nb_Comp_2  58.47638  0.34836456  0.0975 -0.05525570 11.686597  8.919303
#> Nb_Comp_3  56.55421  0.23688359  0.0975 -0.17107874 10.445206  7.919786
#> Nb_Comp_4  54.35053  0.06999681  0.0975 -0.21869112  9.651773  6.972542
#> Nb_Comp_5  55.99834 -0.07691053  0.0975 -0.15796434  8.073955  6.898523
#> Nb_Comp_6  57.69592 -0.19968885  0.0975 -0.11400977  7.685022  6.835594
#> Nb_Comp_7  59.37953 -0.27722139  0.0975 -0.06462721  7.277359  6.770369
#> Nb_Comp_8  61.21213 -0.30602578  0.0975 -0.02255238  6.923057  6.736112
#> Nb_Comp_9  63.18426 -0.39920228  0.0975 -0.07134354  7.216690  6.730426
#> Nb_Comp_10 65.15982 -0.43743644  0.0975 -0.02732569  6.914340  6.725443
#>                 R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0         NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1  0.4675684 0.4675684   17.03781     19.76046  0.38248575 0.0975
#> Nb_Comp_2  0.5711905 0.5711905   13.72190     17.97925 -0.05525570 0.0975
#> Nb_Comp_3  0.6192438 0.6192438   12.18420     16.06943 -0.17107874 0.0975
#> Nb_Comp_4  0.6647841 0.6647841   10.72691     14.84877 -0.21869112 0.0975
#> Nb_Comp_5  0.6683426 0.6683426   10.61304     12.42138 -0.15796434 0.0975
#> Nb_Comp_6  0.6713681 0.6713681   10.51622     11.82303 -0.11400977 0.0975
#> Nb_Comp_7  0.6745039 0.6745039   10.41588     11.19586 -0.06462721 0.0975
#> Nb_Comp_8  0.6761508 0.6761508   10.36317     10.65078 -0.02255238 0.0975
#> Nb_Comp_9  0.6764242 0.6764242   10.35443     11.10252 -0.07134354 0.0975
#> Nb_Comp_10 0.6766638 0.6766638   10.34676     10.63737 -0.02732569 0.0975
#>            Q2cum_residY  AIC.std   DoF.dof sigmahat.dof   AIC.dof   BIC.dof
#> Nb_Comp_0            NA 96.63448  1.000000    0.8062287 0.6697018 0.6991787
#> Nb_Comp_1    0.38248575 77.83455  3.176360    0.5994089 0.4047616 0.4565153
#> Nb_Comp_2    0.34836456 72.69198  7.133559    0.5761829 0.4138120 0.5212090
#> Nb_Comp_3    0.23688359 70.76981  8.778329    0.5603634 0.4070516 0.5320535
#> Nb_Comp_4    0.06999681 68.56612  8.427874    0.5221703 0.3505594 0.4547689
#> Nb_Comp_5   -0.07691053 70.21393  9.308247    0.5285695 0.3666578 0.4845912
#> Nb_Comp_6   -0.19968885 71.91152  9.291931    0.5259794 0.3629363 0.4795121
#> Nb_Comp_7   -0.27722139 73.59512  9.756305    0.5284535 0.3702885 0.4938445
#> Nb_Comp_8   -0.30602578 75.42772 10.363948    0.5338475 0.3831339 0.5170783
#> Nb_Comp_9   -0.39920228 77.39986 10.732136    0.5378275 0.3920954 0.5328742
#> Nb_Comp_10  -0.43743644 79.37542 11.000000    0.5407500 0.3987417 0.5446065
#>             GMDL.dof DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0  -3.605128         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1  -9.875081         2      0.5977015 0.3788984 0.4112998 -11.451340
#> Nb_Comp_2  -6.985517         3      0.5452615 0.3243383 0.3647862 -12.822703
#> Nb_Comp_3  -6.260610         4      0.5225859 0.3061986 0.3557368 -12.756838
#> Nb_Comp_4  -8.152986         5      0.4990184 0.2867496 0.3432131 -12.811575
#> Nb_Comp_5  -7.111583         6      0.5054709 0.3019556 0.3714754 -11.329638
#> Nb_Comp_6  -7.233043         7      0.5127450 0.3186757 0.4021333  -9.918688
#> Nb_Comp_7  -6.742195         8      0.5203986 0.3364668 0.4347156  -8.592770
#> Nb_Comp_8  -6.038372         9      0.5297842 0.3572181 0.4717708  -7.287834
#> Nb_Comp_9  -5.600249        10      0.5409503 0.3813021 0.5140048  -6.008747
#> Nb_Comp_10 -5.288422        11      0.5529032 0.4076026 0.5600977  -4.799453

data(pineNAX21)
bbb2 <- cv.plsRglm(x11~.,data=pineNAX21,nt=10,
modele="pls-glm-family",family=Gamma(),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: NaNs produced
bbb2 <- cv.plsRglm(x11~.,data=pineNAX21,nt=10,
modele="pls-glm-Gamma",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: NaNs produced

#For Jackknife computations
kfolds2coeff(bbb2)
#>            [,1]        [,2]         [,3]        [,4]      [,5]       [,6]
#>  [1,] -15.07878 0.006716564  0.055272412 -0.19316858 1.6848183 -0.2824501
#>  [2,] -11.01398 0.007011719 -0.006403181  0.18259579 1.6839436 -0.3499803
#>  [3,] -19.09934 0.007297472  0.040934089 -0.32472193 1.6866886 -0.2829861
#>  [4,] -14.69259 0.005843774  0.031846613 -0.19150193 1.6331995 -0.3335883
#>  [5,] -13.99596 0.005814865  0.039657247 -0.16176563 1.7887486 -0.3482617
#>  [6,] -10.81444 0.004958905  0.009460011 -0.03644837 0.9762742 -0.2522549
#>  [7,] -18.80262 0.006602158  0.142072931 -0.25451252 4.8567667 -0.9791783
#>  [8,] -14.65954 0.006009143  0.024077030 -0.20114471 1.4272819 -0.3474715
#>  [9,] -15.57449 0.005968661  0.032698749 -0.19936767 2.0597900 -0.3955785
#> [10,] -11.09057 0.004588157  0.047874777 -0.18568059 1.4842908 -0.3191354
#>             [,7]       [,8]        [,9]     [,10]     [,11]
#>  [1,]  3.0643390 -0.8066064 -0.53218120 0.9022654 0.9857602
#>  [2,] -2.2545059  0.1062911 -0.04768201 0.8401074 0.1272879
#>  [3,]  3.8063440 -0.4438064 -0.47028529 2.1572870 1.1605460
#>  [4,]  2.5220450 -0.2758794 -0.18425813 0.9407820 0.9027479
#>  [5,]  2.4033172 -0.4721903 -0.29042317 0.7060646 0.9429507
#>  [6,]  0.3283996  0.3311122  0.12827432 0.6216845 0.3737950
#>  [7,]  3.6921179 -1.9367352 -0.53908046 0.1164225 1.5782281
#>  [8,]  2.2989041  0.1766566 -0.08223405 1.5258340 0.2776085
#>  [9,]  2.7511935 -0.5698176 -0.25457283 0.7977064 1.2155821
#> [10,]  2.2507997  0.1927225 -0.10172939 0.8970035 0.4337943
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 2.484424 3.502288 3.853386 3.156717 1.987254 1.770326 2.664435 2.646213
#> [9] 2.778603
#> 
#> [[1]][[2]]
#> [1] 3.967361 4.597217 5.504485 3.856982 4.871295 6.518675 9.076609 8.674226
#> [9] 8.386563
#> 
#> [[1]][[3]]
#> [1] 3.151419 5.670197 6.452342 5.497580 5.735185 8.221505 5.272709 4.368251
#> [9] 4.714053
#> 
#> [[1]][[4]]
#> [1] 0.6147029 0.6212554 0.7588106 0.7659226 0.8150023 0.5203840 0.4950868
#> [8] 0.5586995 0.5487168
#> 
#> [[1]][[5]]
#> [1] 1.3555690 1.2435362 1.1633963 0.9942801 0.9724249 0.9966920 1.0009466
#> [8] 1.0996302 1.0877483
#> 
#> [[1]][[6]]
#> [1] 1.962747 1.799226 1.614964 1.570912 1.582408 1.522509 1.479213 1.456652
#> [9] 1.351793
#> 
#> [[1]][[7]]
#> [1]  2.608085  3.102280  3.760613  6.797187 13.956118 20.562367 36.305844
#> [8] 46.982179 46.211101
#> 
#> [[1]][[8]]
#> [1] 0.7736154 2.5111104 1.9575043 2.5424104 2.8240269 2.3337202 2.0582771
#> [8] 1.7362617 1.8422402
#> 
#> [[1]][[9]]
#> [1] 3.8045086 3.5946173 1.7294840 1.2058509 0.9753160 0.2611701 0.1532982
#> [8] 0.3700589 0.3378103
#> 
#> [[1]][[10]]
#> [1]     2.348387     1.519094     2.671925    12.128355    44.338474
#> [6]    57.263818   164.207376  3983.154090 15371.809623
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1]    23.07082    28.16082    29.46691    38.51620    78.05750    99.97117
#> [7]   222.71380  4051.04626 15439.06825
#> 
summary(bbb2)
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> 
#> Family: Gamma 
#> Link function: inverse 
#> 
#> ____There are some NAs in X but not in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2     Q2Chisq_Y
#> Nb_Comp_0 56.60919 59.60220            NA     NA            NA
#> Nb_Comp_1 39.08940 43.57892  2.700966e-01 0.0975     0.2700966
#> Nb_Comp_2 37.36154 43.34757 -1.875211e-01 0.0975    -0.6269566
#> Nb_Comp_3 36.81173 44.29427 -1.045919e+00 0.0975    -0.7228485
#> Nb_Comp_4 36.53654 45.51559 -3.991897e+00 0.0975    -1.4399288
#> Nb_Comp_5 37.24312 47.71867 -2.788446e+01 0.0975    -4.7862694
#> Nb_Comp_6 38.18649 50.15855 -2.118067e+02 0.0975    -6.3675149
#> Nb_Comp_7 39.35575 52.82432 -3.378816e+03 0.0975   -14.8820961
#> Nb_Comp_8 40.86209 55.82716 -9.092111e+05 0.0975  -268.0122975
#> Nb_Comp_9 42.80511 59.26669 -9.186460e+08 0.0975 -1009.3759609
#>           PREChi2_Pearson_Y Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0                NA       31.60805 20.800152        NA
#> Nb_Comp_1          23.07082       17.30890 12.031518 0.4215659
#> Nb_Comp_2          28.16082       17.10360  6.183372 0.7027247
#> Nb_Comp_3          29.46691       15.78579  5.756462 0.7232490
#> Nb_Comp_4          38.51620       13.49013  7.630460 0.6331536
#> Nb_Comp_5          78.05750       13.56918  6.303455 0.6969515
#> Nb_Comp_6          99.97117       14.02295  5.274716 0.7464097
#> Nb_Comp_7         222.71380       15.05896  4.867806 0.7659726
#> Nb_Comp_8        4051.04626       15.28052  4.317488 0.7924300
#> Nb_Comp_9       15439.06825       15.19429  4.298593 0.7933384
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
XpineNAX21 <- Xpine
XpineNAX21[1,2] <- NA
PLS_lm(ypine,XpineNAX21,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> ____There are some NAs in X but not in Y____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#>                AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0 82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1 63.69250  0.35639805  0.0975  0.35639805 13.387018 11.099368
#> Nb_Comp_2 58.35228  0.28395028  0.0975 -0.11256611 12.348781  8.885823
#> Nb_Comp_3 56.36553  0.07664889  0.0975 -0.28950699 11.458331  7.874634
#> Nb_Comp_4 54.02416 -0.70355579  0.0975 -0.84497074 14.528469  6.903925
#> Nb_Comp_5 55.80450 -0.94905654  0.0975 -0.14411078  7.898855  6.858120
#> Nb_Comp_6 57.45753 -1.27568315  0.0975 -0.16758190  8.007417  6.786392
#> Nb_Comp_7 58.73951 -1.63309014  0.0975 -0.15705481  7.852227  6.640327
#> Nb_Comp_8 60.61227 -1.67907859  0.0975 -0.01746558  6.756304  6.614773
#> Nb_Comp_9 62.25948 -2.15165796  0.0975 -0.17639623  7.781594  6.544432
#>                R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0        NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1 0.4663804 0.4663804   17.07583     20.59526  0.35639805 0.0975
#> Nb_Comp_2 0.5728001 0.5728001   13.67040     18.99799 -0.11256611 0.0975
#> Nb_Comp_3 0.6214146 0.6214146   12.11473     17.62807 -0.28950699 0.0975
#> Nb_Comp_4 0.6680830 0.6680830   10.62135     22.35133 -0.84497074 0.0975
#> Nb_Comp_5 0.6702851 0.6702851   10.55088     12.15200 -0.14411078 0.0975
#> Nb_Comp_6 0.6737336 0.6737336   10.44053     12.31901 -0.16758190 0.0975
#> Nb_Comp_7 0.6807558 0.6807558   10.21581     12.08026 -0.15705481 0.0975
#> Nb_Comp_8 0.6819844 0.6819844   10.17650     10.39424 -0.01746558 0.0975
#> Nb_Comp_9 0.6853661 0.6853661   10.06828     11.97160 -0.17639623 0.0975
#>           Q2cum_residY  AIC.std DoF.dof sigmahat.dof AIC.dof BIC.dof GMDL.dof
#> Nb_Comp_0           NA 96.63448      NA           NA      NA      NA       NA
#> Nb_Comp_1   0.35639805 77.90810      NA           NA      NA      NA       NA
#> Nb_Comp_2   0.28395028 72.56787      NA           NA      NA      NA       NA
#> Nb_Comp_3   0.07664889 70.58113      NA           NA      NA      NA       NA
#> Nb_Comp_4  -0.70355579 68.23976      NA           NA      NA      NA       NA
#> Nb_Comp_5  -0.94905654 70.02009      NA           NA      NA      NA       NA
#> Nb_Comp_6  -1.27568315 71.67313      NA           NA      NA      NA       NA
#> Nb_Comp_7  -1.63309014 72.95511      NA           NA      NA      NA       NA
#> Nb_Comp_8  -1.67907859 74.82787      NA           NA      NA      NA       NA
#> Nb_Comp_9  -2.15165796 76.47507      NA           NA      NA      NA       NA
#>           DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1         2      0.5983679 0.3797438 0.4122175 -11.413749
#> Nb_Comp_2         3      0.5442372 0.3231208 0.3634169 -12.847656
#> Nb_Comp_3         4      0.5210941 0.3044529 0.3537087 -12.776843
#> Nb_Comp_4         5      0.4965569 0.2839276 0.3398355 -12.891035
#> Nb_Comp_5         6      0.5039885 0.3001871 0.3692997 -11.349498
#> Nb_Comp_6         7      0.5108963 0.3163819 0.3992388  -9.922119
#> Nb_Comp_7         8      0.5153766 0.3300041 0.4263658  -8.696873
#> Nb_Comp_8         9      0.5249910 0.3507834 0.4632727  -7.337679
#> Nb_Comp_9        10      0.5334234 0.3707649 0.4998004  -6.033403
rm(list=c("Xpine","XpineNAX21","ypine","bbb","bbb2"))



data(Cornell)
XCornell<-Cornell[,1:7]
yCornell<-Cornell[,8]
bbb <- cv.plsRglm(Y~.,data=Cornell,nt=10,NK=1,modele="pls",verbose=FALSE)
summary(bbb)
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC     Q2cum_Y LimQ2_Y       Q2_Y  PRESS_Y      RSS_Y      R2_Y
#> Nb_Comp_0 82.01205          NA      NA         NA       NA 467.796667        NA
#> Nb_Comp_1 53.15173   0.8570550  0.0975  0.8570550 66.86919  35.742486 0.9235940
#> Nb_Comp_2 41.08283   0.8369285  0.0975 -0.1407988 40.77499  11.066606 0.9763431
#> Nb_Comp_3 32.06411   0.6272716  0.0975 -1.2856754 25.29467   4.418081 0.9905556
#> Nb_Comp_4 33.76477  -1.0788047  0.0975 -4.5772634 24.64080   4.309235 0.9907882
#> Nb_Comp_5 33.34373 -13.9459710  0.0975 -6.1896945 30.98209   3.521924 0.9924713
#> Nb_Comp_6 35.25533          NA  0.0975         NA       NA   3.496074 0.9925265
#>              AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof GMDL.dof
#> Nb_Comp_0  37.010388 1.000000    6.5212706 46.0708838 47.7893514 27.59461
#> Nb_Comp_1   8.150064 2.740749    1.8665281  4.5699686  4.9558156 21.34020
#> Nb_Comp_2  -3.918831 5.085967    1.1825195  2.1075461  2.3949331 27.40202
#> Nb_Comp_3 -12.937550 5.121086    0.7488308  0.8467795  0.9628191 24.40842
#> Nb_Comp_4 -11.236891 5.103312    0.7387162  0.8232505  0.9357846 24.23105
#> Nb_Comp_5 -11.657929 6.006316    0.7096382  0.7976101  0.9198348 28.21184
#> Nb_Comp_6  -9.746328 7.000002    0.7633343  0.9711322  1.1359501 33.18348
#>           DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6         7      0.8361907  1.1070902  1.3048716   33.63927
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRmodel"

cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-inverse.gaussian",K=12,verbose=FALSE)
#> Number of repeated crossvalidations:
#> [1] 1
#> Number of folds for each crossvalidation:
#> [1] 12
cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-family",
family=inverse.gaussian,K=12,verbose=FALSE)
#> Number of repeated crossvalidations:
#> [1] 1
#> Number of folds for each crossvalidation:
#> [1] 12
cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-inverse.gaussian",K=6,
NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 11 82.28528 82.07951 82.44527
#> 9  82.32583 82.66131 82.84802
#> 
#> [[1]][[2]]
#>        [,1]     [,2]     [,3]
#> 7  81.66306 81.74072 81.79826
#> 10 82.35888 83.04357 83.02591
#> 
#> [[1]][[3]]
#>       [,1]     [,2]     [,3]
#> 6 93.14888 91.74712 92.43230
#> 5 88.39491 88.16441 85.28231
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 12 87.05810 89.17920 88.66667
#> 3  95.15935 98.49925 98.29314
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 8 82.24293 82.38287 82.48015
#> 2 96.13073 97.86873 97.96498
#> 
#> [[1]][[6]]
#>       [,1]     [,2]     [,3]
#> 4 94.47572 93.13652 92.02753
#> 1 94.09586 95.21985 95.90520
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 10 82.52637 83.25532 83.27621
#> 11 82.09018 82.10220 82.32048
#> 
#> [[2]][[2]]
#>       [,1]     [,2]     [,3]
#> 7 81.90468 81.80099 81.86165
#> 1 93.69623 94.94396 95.94943
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 9 81.86542 82.38830 82.43308
#> 8 82.07010 82.52511 82.48277
#> 
#> [[2]][[4]]
#>       [,1]    [,2]     [,3]
#> 4 94.61069 94.6878 92.64353
#> 6 92.42551 94.1008 93.10934
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 5  87.39911 88.86951 86.84356
#> 12 86.95192 89.39536 89.96552
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 2 94.75823 96.91475 98.01025
#> 3 94.00695 96.56079 97.64113
#> 
#> 
cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-family",family=inverse.gaussian(),
K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 12 87.46933 87.90360 89.32176
#> 9  82.06973 82.52492 82.68256
#> 
#> [[1]][[2]]
#>       [,1]     [,2]    [,3]
#> 3 96.61339 98.57737 98.3464
#> 4 95.61777 92.38878 92.0582
#> 
#> [[1]][[3]]
#>        [,1]     [,2]     [,3]
#> 10 82.56492 82.99060 82.94155
#> 6  93.25013 92.42267 92.24201
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 1  93.72589 94.82253 95.92674
#> 11 82.31956 82.01545 82.35014
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 8 82.13328 82.44652 82.46367
#> 7 81.64544 81.62066 81.69732
#> 
#> [[1]][[6]]
#>       [,1]     [,2]     [,3]
#> 5 87.65801 88.80272 85.50149
#> 2 96.42504 97.55338 98.02034
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>       [,1]     [,2]     [,3]
#> 7 81.90468 81.80099 81.86165
#> 1 93.69623 94.94396 95.94943
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 10 82.44556 82.92749 83.04063
#> 2  96.14439 97.88015 97.95865
#> 
#> [[2]][[3]]
#>        [,1]     [,2]     [,3]
#> 11 82.51704 82.52189 82.31869
#> 6  94.15649 92.49562 92.41182
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 9 82.19302 82.34852 82.55782
#> 3 95.46823 98.02292 98.06887
#> 
#> [[2]][[5]]
#>       [,1]     [,2]     [,3]
#> 8 82.21740 82.59449 82.51095
#> 4 95.36584 92.58378 91.54210
#> 
#> [[2]][[6]]
#>        [,1]     [,2]     [,3]
#> 12 86.95192 89.39536 89.96552
#> 5  87.39911 88.86951 86.84356
#> 
#> 
cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-inverse.gaussian",K=6,
NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>       [,1]    [,2]     [,3]
#> 4 94.61069 94.6878 92.64353
#> 6 92.42551 94.1008 93.10934
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 5 88.08780 88.60220 85.35196
#> 9 82.27548 82.42662 82.55342
#> 
#> [[1]][[3]]
#>        [,1]     [,2]     [,3]
#> 8  81.97836 82.48513 82.34459
#> 10 82.18756 82.96181 82.81149
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 12 87.18968 88.98872 88.53361
#> 2  95.94380 98.36164 98.28510
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 1 93.43561 94.90620 96.45368
#> 3 94.68038 96.79879 97.49218
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 7  82.20239 81.91655 82.10715
#> 11 82.43803 81.94278 82.36685
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 12 86.95192 89.39536 89.96552
#> 5  87.39911 88.86951 86.84356
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 4  95.30802 92.66692 91.51834
#> 10 82.47953 83.11466 83.10610
#> 
#> [[2]][[3]]
#>        [,1]     [,2]     [,3]
#> 11 82.51704 82.52189 82.31869
#> 6  94.15649 92.49562 92.41182
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 8 82.07010 82.52511 82.48277
#> 9 81.86542 82.38830 82.43308
#> 
#> [[2]][[5]]
#>       [,1]     [,2]     [,3]
#> 1 93.69623 94.94396 95.94943
#> 7 81.90468 81.80099 81.86165
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 2 94.75823 96.91475 98.01025
#> 3 94.00695 96.56079 97.64113
#> 
#> 
cv.plsRglm(object=yCornell,dataX=XCornell,nt=3,modele="pls-glm-family",
family=inverse.gaussian(link = "1/mu^2"),K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>       [,1]     [,2]     [,3]
#> 3 95.36186 97.94995 98.04350
#> 7 82.03388 81.64447 81.78355
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 5 88.08780 88.60220 85.35196
#> 9 82.27548 82.42662 82.55342
#> 
#> [[1]][[3]]
#>       [,1]     [,2]     [,3]
#> 1 94.09586 95.21985 95.90520
#> 4 94.47572 93.13652 92.02753
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 10 82.44556 82.92749 83.04063
#> 2  96.14439 97.88015 97.95865
#> 
#> [[1]][[5]]
#>        [,1]     [,2]     [,3]
#> 11 82.51704 82.52189 82.31869
#> 6  94.15649 92.49562 92.41182
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 12 87.40306 87.79647 89.48632
#> 8  82.18031 82.59243 82.48103
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>       [,1]     [,2]     [,3]
#> 3 96.52367 97.77654 97.81463
#> 6 94.13493 92.01372 92.13219
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 10 82.30686 83.12912 83.03868
#> 9  81.89236 82.51683 82.52717
#> 
#> [[2]][[3]]
#>        [,1]     [,2]     [,3]
#> 1  93.48074 94.34564 96.46141
#> 12 86.83575 86.59791 88.12756
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 7 81.64544 81.62066 81.69732
#> 8 82.13328 82.44652 82.46367
#> 
#> [[2]][[5]]
#>       [,1]     [,2]     [,3]
#> 4 95.14378 92.16193 91.45998
#> 2 97.09841 98.35471 97.69241
#> 
#> [[2]][[6]]
#>        [,1]     [,2]     [,3]
#> 11 82.55067 81.50479 82.43491
#> 5  88.10011 88.46379 84.99179
#> 
#> 

bbb2 <- cv.plsRglm(Y~.,data=Cornell,nt=10,
modele="pls-glm-inverse.gaussian",keepcoeffs=TRUE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb2)
#>               [,1]          [,2]          [,3]          [,4]          [,5]
#> [1,] -0.0001571350  1.214214e-03  2.696458e-04 -1.185984e-03  2.872677e-04
#> [2,]  0.0002366775 -7.479139e-06 -1.027150e-04 -7.452068e-05 -4.015522e-05
#> [3,] -0.0001726175  7.866832e-04  3.087020e-04 -4.618726e-04  3.028237e-04
#> [4,]  0.0001388570  4.047152e-04 -5.789572e-06 -5.984148e-04  1.281348e-05
#> [5,]  0.0001119071  5.055148e-05  2.120739e-05  8.593752e-05  4.194631e-05
#>               [,6]          [,7]          [,8]
#> [1,]  2.702784e-04  2.497748e-04  4.416702e-04
#> [2,] -8.920611e-05 -1.299335e-04 -4.704451e-04
#> [3,]  2.972386e-04  2.591324e-04  4.486940e-04
#> [4,] -2.663498e-05 -3.872940e-05 -3.725056e-05
#> [5,]  1.840347e-05 -1.501951e-05 -2.805519e-05
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.191273e-05 2.073716e-05 7.967889e-06 1.915990e-05 1.678826e-05
#> [6] 5.180164e-05
#> 
#> [[1]][[2]]
#> [1] 4.087355e-06 6.241137e-06 2.037430e-06 3.991343e-06 1.137657e-05
#> [6] 1.114432e-05
#> 
#> [[1]][[3]]
#> [1] 4.053814e-06 5.416716e-06 3.479330e-06 5.235664e-06 4.606876e-06
#> [6] 5.506172e-06
#> 
#> [[1]][[4]]
#> [1] 3.091430e-05 1.587497e-05 8.070417e-06 6.269215e-06 6.277834e-06
#> [6] 6.416394e-06
#> 
#> [[1]][[5]]
#> [1] 1.668469e-06 8.962715e-07 1.528866e-06 1.011970e-06 3.865330e-07
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1] 5.263667e-05 4.916625e-05 2.308393e-05 3.566809e-05 3.943608e-05
#> 
summary(bbb2)
#> ____************************************************____
#> 
#> Family: inverse.gaussian 
#> Link function: 1/mu^2 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 81.67928 82.64909           NA     NA          NA                NA
#> Nb_Comp_1 49.90521 51.35993    0.9217855 0.0975   0.9217855      5.263667e-05
#> Nb_Comp_2 31.06918 33.00881    0.9028341 0.0975  -0.2422998      4.916625e-05
#> Nb_Comp_3 28.40632 30.83085    0.6800077 0.0975  -2.2932580      2.308393e-05
#> Nb_Comp_4 27.08522 29.99466   -1.4141398 0.0975  -6.5443684      3.566809e-05
#> Nb_Comp_5 28.46056 31.85490  -25.5611085 0.0975 -10.0023076      3.943608e-05
#> Nb_Comp_6 29.68366 33.56292           NA 0.0975          NA                NA
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0   6.729783e-04 467.796667        NA
#> Nb_Comp_1   3.957680e-05  32.478677 0.9305710
#> Nb_Comp_2   7.009452e-06   6.020269 0.9871306
#> Nb_Comp_3   4.727777e-06   3.795855 0.9918857
#> Nb_Comp_4   3.584346e-06   2.699884 0.9942285
#> Nb_Comp_5   3.408069e-06   2.598572 0.9944451
#> Nb_Comp_6   3.195402e-06   2.492371 0.9946721
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm(yCornell,XCornell,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                AIC   Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y      RSS_Y      R2_Y
#> Nb_Comp_0 82.01205        NA      NA          NA        NA 467.796667        NA
#> Nb_Comp_1 53.15173 0.8966556  0.0975  0.89665563 48.344150  35.742486 0.9235940
#> Nb_Comp_2 41.08283 0.9175426  0.0975  0.20210989 28.518576  11.066606 0.9763431
#> Nb_Comp_3 32.06411 0.9399676  0.0975  0.27195907  8.056942   4.418081 0.9905556
#> Nb_Comp_4 33.76477 0.9197009  0.0975 -0.33759604  5.909608   4.309235 0.9907882
#> Nb_Comp_5 33.34373 0.9281373  0.0975  0.10506161  3.856500   3.521924 0.9924713
#> Nb_Comp_6 35.25533 0.9232562  0.0975 -0.06792167  3.761138   3.496074 0.9925265
#>           R2_residY  RSS_residY PRESS_residY   Q2_residY  LimQ2 Q2cum_residY
#> Nb_Comp_0        NA 11.00000000           NA          NA     NA           NA
#> Nb_Comp_1 0.9235940  0.84046633   1.13678803  0.89665563 0.0975    0.8966556
#> Nb_Comp_2 0.9763431  0.26022559   0.67059977  0.20210989 0.0975    0.9175426
#> Nb_Comp_3 0.9905556  0.10388893   0.18945488  0.27195907 0.0975    0.9399676
#> Nb_Comp_4 0.9907882  0.10132947   0.13896142 -0.33759604 0.0975    0.9197009
#> Nb_Comp_5 0.9924713  0.08281624   0.09068364  0.10506161 0.0975    0.9281373
#> Nb_Comp_6 0.9925265  0.08220840   0.08844125 -0.06792167 0.0975    0.9232562
#>              AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof GMDL.dof
#> Nb_Comp_0  37.010388 1.000000    6.5212706 46.0708838 47.7893514 27.59461
#> Nb_Comp_1   8.150064 2.740749    1.8665281  4.5699686  4.9558156 21.34020
#> Nb_Comp_2  -3.918831 5.085967    1.1825195  2.1075461  2.3949331 27.40202
#> Nb_Comp_3 -12.937550 5.121086    0.7488308  0.8467795  0.9628191 24.40842
#> Nb_Comp_4 -11.236891 5.103312    0.7387162  0.8232505  0.9357846 24.23105
#> Nb_Comp_5 -11.657929 6.006316    0.7096382  0.7976101  0.9198348 28.21184
#> Nb_Comp_6  -9.746328 7.000002    0.7633343  0.9711322  1.1359501 33.18348
#>           DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6         7      0.8361907  1.1070902  1.3048716   33.63927
rm(list=c("XCornell","yCornell","bbb","bbb2"))
# }
data(Cornell)
bbb <- cv.plsRglm(Y~.,data=Cornell,nt=10,NK=1,modele="pls")
#> 
#> Model: pls 
#> 
#> NK: 1 
#> Number of groups : 5 
#> 1 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
#> 2 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
#> 3 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
#> 4 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____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
#> ****________________________________________________****
#> 
#> 5 
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ****________________________________________________****
#> 
summary(bbb)
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC     Q2cum_Y LimQ2_Y       Q2_Y  PRESS_Y      RSS_Y      R2_Y
#> Nb_Comp_0 82.01205          NA      NA         NA       NA 467.796667        NA
#> Nb_Comp_1 53.15173   0.8607810  0.0975  0.8607810 65.12617  35.742486 0.9235940
#> Nb_Comp_2 41.08283   0.7766835  0.0975 -0.6040666 57.33333  11.066606 0.9763431
#> Nb_Comp_3 32.06411   0.5043920  0.0975 -1.2193076 24.56020   4.418081 0.9905556
#> Nb_Comp_4 33.76477  -1.4109954  0.0975 -3.8647230 21.49274   4.309235 0.9907882
#> Nb_Comp_5 33.34373 -10.0593508  0.0975 -3.5870476 19.76667   3.521924 0.9924713
#> Nb_Comp_6 35.25533          NA  0.0975         NA       NA   3.496074 0.9925265
#>              AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof GMDL.dof
#> Nb_Comp_0  37.010388 1.000000    6.5212706 46.0708838 47.7893514 27.59461
#> Nb_Comp_1   8.150064 2.740749    1.8665281  4.5699686  4.9558156 21.34020
#> Nb_Comp_2  -3.918831 5.085967    1.1825195  2.1075461  2.3949331 27.40202
#> Nb_Comp_3 -12.937550 5.121086    0.7488308  0.8467795  0.9628191 24.40842
#> Nb_Comp_4 -11.236891 5.103312    0.7387162  0.8232505  0.9357846 24.23105
#> Nb_Comp_5 -11.657929 6.006316    0.7096382  0.7976101  0.9198348 28.21184
#> Nb_Comp_6  -9.746328 7.000002    0.7633343  0.9711322  1.1359501 33.18348
#>           DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6         7      0.8361907  1.1070902  1.3048716   33.63927
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRmodel"

cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=gaussian(),K=12)
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> NK: 1 
#> Leave One Out
#> Number of groups : 12 
#> 1 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 2 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 3 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 4 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 5 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 6 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 7 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 8 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 9 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 10 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 11 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> 12 
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ****________________________________________________****
#> 
#> Number of repeated crossvalidations:
#> [1] 1
#> Number of folds for each crossvalidation:
#> [1] 12

# \donttest{
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=gaussian(),K=6,
NK=2,random=TRUE,keepfolds=TRUE,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>       [,1]     [,2]     [,3]
#> 2 95.74768 97.72589 97.71230
#> 9 82.05123 82.49447 82.58585
#> 
#> [[1]][[2]]
#>        [,1]     [,2]     [,3]
#> 5  88.76883 88.66683 84.54226
#> 10 82.71763 83.28459 83.27688
#> 
#> [[1]][[3]]
#>       [,1]     [,2]     [,3]
#> 8 82.13647 82.47035 82.54282
#> 3 95.42319 98.02385 97.97838
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 12 87.99852 88.21195 90.33982
#> 7  81.62441 81.45137 81.59378
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 4 95.02443 95.32679 93.70423
#> 6 93.13277 94.80948 94.17061
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 1  93.82451 95.18650 96.01096
#> 11 82.22014 82.06569 82.33470
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 7  81.62441 81.45137 81.59378
#> 12 87.99852 88.21195 90.33982
#> 
#> [[2]][[2]]
#>       [,1]     [,2]     [,3]
#> 2 95.74768 97.72589 97.71230
#> 9 82.05123 82.49447 82.58585
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 5 88.70327 88.65979 84.42108
#> 8 82.42406 82.59556 82.40613
#> 
#> [[2]][[4]]
#>        [,1]     [,2]     [,3]
#> 11 82.27810 82.82857 82.12475
#> 4  95.67527 93.25885 92.29906
#> 
#> [[2]][[5]]
#>       [,1]     [,2]     [,3]
#> 3 96.32394 97.51708 97.76579
#> 6 94.33615 92.86486 92.25602
#> 
#> [[2]][[6]]
#>        [,1]     [,2]     [,3]
#> 1  93.76218 95.47439 96.17006
#> 10 82.54682 83.38123 83.29089
#> 
#> 

#Different ways of model specifications
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=gaussian(),K=6,
NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 12 87.63217 89.62193 89.26717
#> 3  95.16282 98.45056 98.26072
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 5 88.63291 88.75749 84.45984
#> 7 81.82483 81.49752 81.34635
#> 
#> [[1]][[3]]
#>        [,1]     [,2]     [,3]
#> 11 81.99705 82.07142 81.97785
#> 8  82.22220 82.78130 82.65782
#> 
#> [[1]][[4]]
#>       [,1]     [,2]     [,3]
#> 2 94.71773 96.57591 96.86114
#> 1 93.21260 95.05187 95.73685
#> 
#> [[1]][[5]]
#>        [,1]     [,2]     [,3]
#> 10 82.55134 83.14227 83.15714
#> 6  93.61280 93.23121 92.59065
#> 
#> [[1]][[6]]
#>       [,1]     [,2]     [,3]
#> 9 81.86758 82.49866 82.56032
#> 4 95.42130 93.12586 91.95321
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>       [,1]     [,2]     [,3]
#> 9 81.93373 82.56082 82.54696
#> 6 93.78736 93.11199 92.51815
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 3  95.00415 97.97437 97.92498
#> 11 82.59530 81.31951 81.98120
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 4 95.42496 93.23625 91.93127
#> 8 82.11111 82.59937 82.57781
#> 
#> [[2]][[4]]
#>        [,1]     [,2]     [,3]
#> 7  81.62441 81.45137 81.59378
#> 12 87.99852 88.21195 90.33982
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 10 82.54682 83.38123 83.29089
#> 1  93.76218 95.47439 96.17006
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 5 88.21294 88.94540 84.67978
#> 2 96.10449 97.28457 97.78811
#> 
#> 
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=gaussian,
K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 8  82.13009 82.67518 82.62926
#> 12 87.98256 88.00708 89.95495
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 5 89.33387 88.45998 83.14531
#> 4 96.08759 93.15114 90.18511
#> 
#> [[1]][[3]]
#>        [,1]     [,2]     [,3]
#> 9  82.14254 82.73114 82.84385
#> 11 82.17510 82.18875 82.36369
#> 
#> [[1]][[4]]
#>       [,1]     [,2]     [,3]
#> 1 93.80450 95.34397 96.10304
#> 7 81.63426 81.45306 81.49531
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 6 94.33615 92.86486 92.25602
#> 3 96.32394 97.51708 97.76579
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 10 82.42248 83.29460 83.33617
#> 2  95.80543 97.75045 97.79476
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 10 82.38856 83.32360 83.40165
#> 3  95.44801 98.06096 98.01431
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 7  81.92218 81.54516 81.70351
#> 11 82.31482 81.87116 82.19872
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 6 93.78736 93.11199 92.51815
#> 9 81.93373 82.56082 82.54696
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 2 96.10449 97.28457 97.78811
#> 5 88.21294 88.94540 84.67978
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 8  82.13009 82.67518 82.62926
#> 12 87.98256 88.00708 89.95495
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 1 94.22332 95.36373 95.85522
#> 4 94.54209 93.49347 92.39735
#> 
#> 
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=gaussian(),
K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 5  88.76883 88.66683 84.54226
#> 10 82.71763 83.28459 83.27688
#> 
#> [[1]][[2]]
#>        [,1]     [,2]     [,3]
#> 6  94.41739 93.37037 92.72392
#> 11 82.47618 83.03392 82.42197
#> 
#> [[1]][[3]]
#>        [,1]     [,2]     [,3]
#> 4  95.61065 93.37520 91.52727
#> 12 88.28185 87.27538 89.61124
#> 
#> [[1]][[4]]
#>       [,1]     [,2]     [,3]
#> 9 81.66333 82.45539 82.42717
#> 8 81.93358 82.62278 82.54069
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 3 94.52271 97.05014 97.42782
#> 1 93.47990 95.48701 96.41990
#> 
#> [[1]][[6]]
#>       [,1]     [,2]     [,3]
#> 7 81.76041 81.36644 81.45882
#> 2 95.70841 97.71098 97.74896
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>       [,1]     [,2]     [,3]
#> 7 81.45421 81.40911 81.48854
#> 9 81.83697 82.42476 82.49845
#> 
#> [[2]][[2]]
#>       [,1]     [,2]     [,3]
#> 5 88.21294 88.94540 84.67978
#> 2 96.10449 97.28457 97.78811
#> 
#> [[2]][[3]]
#>        [,1]     [,2]     [,3]
#> 6  93.72987 93.07458 92.26229
#> 12 88.15467 87.89545 90.21191
#> 
#> [[2]][[4]]
#>        [,1]     [,2]     [,3]
#> 11 82.59530 81.31951 81.98120
#> 3  95.00415 97.97437 97.92498
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 4  95.37792 93.28680 91.85874
#> 10 82.45503 83.28528 83.40513
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 8 82.26250 82.68784 82.57390
#> 1 93.77726 95.43707 96.22502
#> 
#> 
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=gaussian(link=log),
K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>       [,1]     [,2]     [,3]
#> 9 82.07273 82.36939 82.57652
#> 3 95.41988 98.04599 98.02720
#> 
#> [[1]][[2]]
#>        [,1]     [,2]     [,3]
#> 10 82.38816 83.36327 83.30533
#> 12 87.80405 87.89967 90.12464
#> 
#> [[1]][[3]]
#>       [,1]     [,2]     [,3]
#> 4 95.00945 95.18881 93.46179
#> 6 93.02499 94.69311 93.97618
#> 
#> [[1]][[4]]
#>       [,1]     [,2]     [,3]
#> 1 93.79603 95.15103 96.04388
#> 7 81.70645 81.58823 81.64343
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 5 88.00236 88.89902 84.89890
#> 2 96.22080 97.42284 97.84273
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 11 81.99015 81.96542 82.16627
#> 8  82.22865 82.72594 82.71324
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>       [,1]     [,2]     [,3]
#> 3 94.58332 96.94855 97.45357
#> 1 93.48825 95.22277 96.40841
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 8  82.12086 82.65917 82.54791
#> 12 87.74911 87.91120 90.20631
#> 
#> [[2]][[3]]
#>        [,1]     [,2]     [,3]
#> 10 82.43833 83.25392 83.30183
#> 4  95.38507 93.03454 91.71208
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 5 88.47761 88.63851 84.74965
#> 9 82.18338 82.41558 82.56766
#> 
#> [[2]][[5]]
#>       [,1]     [,2]     [,3]
#> 2 96.73658 97.44363 97.42550
#> 6 93.78091 92.74951 92.56591
#> 
#> [[2]][[6]]
#>        [,1]     [,2]     [,3]
#> 11 82.31851 81.85368 82.28983
#> 7  81.98854 81.67279 81.87347
#> 
#> 

bbb2 <- cv.plsRglm(Y~.,data=Cornell,nt=10,
modele="pls-glm-gaussian",keepcoeffs=TRUE,verbose=FALSE)
bbb2 <- cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",
family=gaussian(link=log),K=6,keepcoeffs=TRUE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb2)
#>          [,1]          [,2]        [,3]         [,4]        [,5]        [,6]
#> [1,] 4.467990 -0.0659284558 -0.01349501 -0.112078375 -0.05648234  0.04031966
#> [2,] 4.501591 -0.1062005970 -0.03275817 -0.176666079 -0.05793456 -0.03733964
#> [3,] 4.465364 -0.0910410290 -0.01145136 -0.145972146 -0.03832459  0.06930221
#> [4,] 4.465535 -0.0745057197 -0.01879086 -0.123124899 -0.05224246  0.03692248
#> [5,] 4.419408 -0.0001606874  0.01194594  0.005955998 -0.02675776 -0.05897822
#> [6,] 4.477324 -0.0924374415 -0.02722684 -0.154580829 -0.05247624  0.02295913
#>           [,7]       [,8]
#> [1,] 0.1624231 -0.1911510
#> [2,] 0.1368995 -0.4013110
#> [3,] 0.1526247 -0.1795973
#> [4,] 0.1718595 -0.1668012
#> [5,] 0.2332509 -0.1516894
#> [6,] 0.1554308 -0.2314175
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 0.8514972 0.2574523 0.7924937
#> 
#> [[1]][[2]]
#> [1] 7.791940 2.527970 2.005973
#> 
#> [[1]][[3]]
#> [1] 26.562414 18.481635  5.020535
#> 
#> [[1]][[4]]
#> [1] 1.499790 2.091815 2.068063
#> 
#> [[1]][[5]]
#> [1] 22.461298  3.553159 12.658583
#> 
#> [[1]][[6]]
#> [1] 2.6416340 0.2521208 0.4284244
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1] 61.80857 27.16415 22.97407
#> 
summary(bbb2)
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: log 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 82.01205 82.98186           NA     NA         NA                NA
#> Nb_Comp_1 52.67938 54.13410    0.8678730 0.0975  0.8678730          61.80857
#> Nb_Comp_2 32.16524 34.10487    0.8955526 0.0975  0.2094922          27.16415
#> Nb_Comp_3 30.58789 33.01242    0.5441106 0.0975 -3.3647735          22.97407
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0     467.796667 467.796667        NA
#> Nb_Comp_1      34.362913  34.362913 0.9265431
#> Nb_Comp_2       5.263520   5.263520 0.9887483
#> Nb_Comp_3       3.906676   3.906676 0.9916488
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(Y~.,data=Cornell,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                AIC   Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y      RSS_Y      R2_Y
#> Nb_Comp_0 82.01205        NA      NA          NA        NA 467.796667        NA
#> Nb_Comp_1 53.15173 0.8966556  0.0975  0.89665563 48.344150  35.742486 0.9235940
#> Nb_Comp_2 41.08283 0.9175426  0.0975  0.20210989 28.518576  11.066606 0.9763431
#> Nb_Comp_3 32.06411 0.9399676  0.0975  0.27195907  8.056942   4.418081 0.9905556
#> Nb_Comp_4 33.76477 0.9197009  0.0975 -0.33759604  5.909608   4.309235 0.9907882
#> Nb_Comp_5 33.34373 0.9281373  0.0975  0.10506161  3.856500   3.521924 0.9924713
#> Nb_Comp_6 35.25533 0.9232562  0.0975 -0.06792167  3.761138   3.496074 0.9925265
#>           R2_residY  RSS_residY PRESS_residY   Q2_residY  LimQ2 Q2cum_residY
#> Nb_Comp_0        NA 11.00000000           NA          NA     NA           NA
#> Nb_Comp_1 0.9235940  0.84046633   1.13678803  0.89665563 0.0975    0.8966556
#> Nb_Comp_2 0.9763431  0.26022559   0.67059977  0.20210989 0.0975    0.9175426
#> Nb_Comp_3 0.9905556  0.10388893   0.18945488  0.27195907 0.0975    0.9399676
#> Nb_Comp_4 0.9907882  0.10132947   0.13896142 -0.33759604 0.0975    0.9197009
#> Nb_Comp_5 0.9924713  0.08281624   0.09068364  0.10506161 0.0975    0.9281373
#> Nb_Comp_6 0.9925265  0.08220840   0.08844125 -0.06792167 0.0975    0.9232562
#>              AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof GMDL.dof
#> Nb_Comp_0  37.010388 1.000000    6.5212706 46.0708838 47.7893514 27.59461
#> Nb_Comp_1   8.150064 2.740749    1.8665281  4.5699686  4.9558156 21.34020
#> Nb_Comp_2  -3.918831 5.085967    1.1825195  2.1075461  2.3949331 27.40202
#> Nb_Comp_3 -12.937550 5.121086    0.7488308  0.8467795  0.9628191 24.40842
#> Nb_Comp_4 -11.236891 5.103312    0.7387162  0.8232505  0.9357846 24.23105
#> Nb_Comp_5 -11.657929 6.006316    0.7096382  0.7976101  0.9198348 28.21184
#> Nb_Comp_6  -9.746328 7.000002    0.7633343  0.9711322  1.1359501 33.18348
#>           DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6         7      0.8361907  1.1070902  1.3048716   33.63927
rm(list=c("bbb","bbb2"))


data(pine)
bbb <- cv.plsRglm(x11~.,data=pine,nt=10,modele="pls-glm-family",
family=gaussian(log),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
bbb <- cv.plsRglm(x11~.,data=pine,nt=10,modele="pls-glm-family",family=gaussian(),
K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb)
#>           [,1]         [,2]        [,3]       [,4]       [,5]       [,6]
#>  [1,] 6.985588 -0.002914018 -0.03125509 0.01531171 -0.4843695 0.11301476
#>  [2,] 8.287634 -0.002760545 -0.03848148 0.01141255 -0.4729590 0.09666276
#>  [3,] 7.858421 -0.002787016 -0.02888833 0.02373270 -0.4309268 0.11398197
#>  [4,] 8.040499 -0.002744957 -0.03617547 0.03345488 -0.4414799 0.09854951
#>  [5,] 8.342997 -0.002402815 -0.03618946 0.04420477 -0.6336774 0.12211854
#>  [6,] 7.437795 -0.002263258 -0.03303908 0.00938658 -0.2601253 0.05364072
#>  [7,] 9.304951 -0.003635967 -0.04570559 0.03023754 -0.6052893 0.14679657
#>  [8,] 9.747956 -0.003234230 -0.03826371 0.07343136 -0.4572179 0.07984897
#>  [9,] 9.746185 -0.003684162 -0.03067813 0.04348003 -0.6161778 0.12851083
#> [10,] 7.994663 -0.002996258 -0.03683864 0.03403538 -0.4200156 0.09676770
#>               [,7]        [,8]         [,9]      [,10]      [,11]
#>  [1,]  0.229283276  0.16013277  0.011554863 -0.8204932 -0.1910531
#>  [2,]  0.379604430 -0.41412573  0.040577023 -0.9827977 -0.3212688
#>  [3,]  0.231249923 -0.26070879  0.024053427 -1.0695913 -0.3919193
#>  [4,] -0.008662357 -0.23933492  0.025085650 -0.8911616 -0.2832951
#>  [5,] -0.291999853 -0.24314510  0.086602828 -0.8463730 -0.5280711
#>  [6,]  0.314232554 -0.53547943 -0.015699600 -0.8935976 -0.1360234
#>  [7,] -0.143473500  0.02044794 -0.011277277 -0.4887363 -0.6007902
#>  [8,] -0.558477665 -0.51023399  0.136486307 -1.2830266 -0.1476100
#>  [9,]  0.149304957 -0.36378081  0.046940316 -1.0846574 -0.4255376
#> [10,] -0.136566914 -0.13592665 -0.004006128 -0.6243157 -0.2205888
boxplot(kfolds2coeff(bbb)[,1])


kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#>  [1] 1.5840740 0.5911838 0.4179356 0.5955955 0.6148565 0.5398369 0.6680739
#>  [8] 0.6738387 0.6673145 0.6679587
#> 
#> [[1]][[2]]
#>  [1] 0.3178970 0.7378218 0.6340467 0.5414820 0.6196267 0.7436758 0.6813467
#>  [8] 0.6373207 0.6442387 0.6424595
#> 
#> [[1]][[3]]
#>  [1] 3.427784 3.452492 3.379411 3.722523 3.550999 3.601171 3.590006 3.551852
#>  [9] 3.564344 3.564579
#> 
#> [[1]][[4]]
#>  [1] 0.3360479 0.2114610 0.2997480 0.2587353 0.1733562 0.1213568 0.1226349
#>  [8] 0.1476680 0.1295953 0.1277063
#> 
#> [[1]][[5]]
#>  [1] 0.7454945 0.4198613 0.3554140 0.3033534 0.2509425 0.5682383 0.5328884
#>  [8] 0.6433107 0.6321970 0.6250153
#> 
#> [[1]][[6]]
#>  [1] 2.872958 1.721704 1.511331 1.550335 1.407521 1.367189 1.276245 1.235348
#>  [9] 1.220163 1.219093
#> 
#> [[1]][[7]]
#>  [1] 0.5520532 2.0205782 1.5988685 1.5678331 1.7209387 2.3378976 2.2889509
#>  [8] 2.2867355 2.3650725 2.3636276
#> 
#> [[1]][[8]]
#>  [1] 0.1461204 0.7255973 0.7066399 0.9206683 1.0994969 1.3618361 1.5515776
#>  [8] 1.4389263 1.3959903 1.3970152
#> 
#> [[1]][[9]]
#>  [1] 1.3827451 0.4506738 0.4146894 0.8433347 1.0414987 0.8432027 1.1716143
#>  [8] 1.1515256 1.1709779 1.1704685
#> 
#> [[1]][[10]]
#>  [1] 1.2598406 1.6373836 1.1272934 1.0436819 0.7220860 0.7037869 0.7259587
#>  [8] 0.7135736 0.7488662 0.7472939
#> 
#> 
kfolds2Chisq(bbb)
#> [[1]]
#>  [1] 12.62501 11.96876 10.44538 11.34754 11.20132 12.18819 12.60930 12.48010
#>  [9] 12.53876 12.52522
#> 
summary(bbb)
#> ____************************************************____
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0  82.41888 85.41190           NA     NA          NA                NA
#> Nb_Comp_1  63.61896 68.10848    0.3930326 0.0975  0.39303257          12.62501
#> Nb_Comp_2  54.15489 60.14092    0.3440299 0.0975 -0.08073366          11.96876
#> Nb_Comp_3  53.47303 60.95556    0.1243107 0.0975 -0.33495308          10.44538
#> Nb_Comp_4  54.83398 63.81302   -0.3774891 0.0975 -0.57303400          11.34754
#> Nb_Comp_5  56.32757 66.80312   -1.1807402 0.0975 -0.58312701          11.20132
#> Nb_Comp_6  57.45220 69.42426   -2.8146454 0.0975 -0.74924339          12.18819
#> Nb_Comp_7  59.31417 72.78274   -6.0888578 0.0975 -0.85832680          12.60930
#> Nb_Comp_8  61.20356 76.16863  -12.0930887 0.0975 -0.84699553          12.48010
#> Nb_Comp_9  63.16270 79.62429  -23.3781199 0.0975 -0.86190749          12.53876
#> Nb_Comp_10 65.15982 83.11791  -44.3969456 0.0975 -0.86220044          12.52522
#>            Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0       20.800152 20.800152        NA
#> Nb_Comp_1       11.074659 11.074659 0.4675684
#> Nb_Comp_2        7.824528  7.824528 0.6238235
#> Nb_Comp_3        7.213793  7.213793 0.6531855
#> Nb_Comp_4        7.075441  7.075441 0.6598370
#> Nb_Comp_5        6.967693  6.967693 0.6650172
#> Nb_Comp_6        6.785296  6.785296 0.6737862
#> Nb_Comp_7        6.756973  6.756973 0.6751479
#> Nb_Comp_8        6.734363  6.734363 0.6762349
#> Nb_Comp_9        6.726030  6.726030 0.6766355
#> Nb_Comp_10       6.725443  6.725443 0.6766638
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(x11~.,data=pine,nt=10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                 AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0  82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1  63.61896  0.38248575  0.0975  0.38248575 12.844390 11.074659
#> Nb_Comp_2  58.47638  0.34836456  0.0975 -0.05525570 11.686597  8.919303
#> Nb_Comp_3  56.55421  0.23688359  0.0975 -0.17107874 10.445206  7.919786
#> Nb_Comp_4  54.35053  0.06999681  0.0975 -0.21869112  9.651773  6.972542
#> Nb_Comp_5  55.99834 -0.07691053  0.0975 -0.15796434  8.073955  6.898523
#> Nb_Comp_6  57.69592 -0.19968885  0.0975 -0.11400977  7.685022  6.835594
#> Nb_Comp_7  59.37953 -0.27722139  0.0975 -0.06462721  7.277359  6.770369
#> Nb_Comp_8  61.21213 -0.30602578  0.0975 -0.02255238  6.923057  6.736112
#> Nb_Comp_9  63.18426 -0.39920228  0.0975 -0.07134354  7.216690  6.730426
#> Nb_Comp_10 65.15982 -0.43743644  0.0975 -0.02732569  6.914340  6.725443
#>                 R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0         NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1  0.4675684 0.4675684   17.03781     19.76046  0.38248575 0.0975
#> Nb_Comp_2  0.5711905 0.5711905   13.72190     17.97925 -0.05525570 0.0975
#> Nb_Comp_3  0.6192438 0.6192438   12.18420     16.06943 -0.17107874 0.0975
#> Nb_Comp_4  0.6647841 0.6647841   10.72691     14.84877 -0.21869112 0.0975
#> Nb_Comp_5  0.6683426 0.6683426   10.61304     12.42138 -0.15796434 0.0975
#> Nb_Comp_6  0.6713681 0.6713681   10.51622     11.82303 -0.11400977 0.0975
#> Nb_Comp_7  0.6745039 0.6745039   10.41588     11.19586 -0.06462721 0.0975
#> Nb_Comp_8  0.6761508 0.6761508   10.36317     10.65078 -0.02255238 0.0975
#> Nb_Comp_9  0.6764242 0.6764242   10.35443     11.10252 -0.07134354 0.0975
#> Nb_Comp_10 0.6766638 0.6766638   10.34676     10.63737 -0.02732569 0.0975
#>            Q2cum_residY  AIC.std   DoF.dof sigmahat.dof   AIC.dof   BIC.dof
#> Nb_Comp_0            NA 96.63448  1.000000    0.8062287 0.6697018 0.6991787
#> Nb_Comp_1    0.38248575 77.83455  3.176360    0.5994089 0.4047616 0.4565153
#> Nb_Comp_2    0.34836456 72.69198  7.133559    0.5761829 0.4138120 0.5212090
#> Nb_Comp_3    0.23688359 70.76981  8.778329    0.5603634 0.4070516 0.5320535
#> Nb_Comp_4    0.06999681 68.56612  8.427874    0.5221703 0.3505594 0.4547689
#> Nb_Comp_5   -0.07691053 70.21393  9.308247    0.5285695 0.3666578 0.4845912
#> Nb_Comp_6   -0.19968885 71.91152  9.291931    0.5259794 0.3629363 0.4795121
#> Nb_Comp_7   -0.27722139 73.59512  9.756305    0.5284535 0.3702885 0.4938445
#> Nb_Comp_8   -0.30602578 75.42772 10.363948    0.5338475 0.3831339 0.5170783
#> Nb_Comp_9   -0.39920228 77.39986 10.732136    0.5378275 0.3920954 0.5328742
#> Nb_Comp_10  -0.43743644 79.37542 11.000000    0.5407500 0.3987417 0.5446065
#>             GMDL.dof DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0  -3.605128         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1  -9.875081         2      0.5977015 0.3788984 0.4112998 -11.451340
#> Nb_Comp_2  -6.985517         3      0.5452615 0.3243383 0.3647862 -12.822703
#> Nb_Comp_3  -6.260610         4      0.5225859 0.3061986 0.3557368 -12.756838
#> Nb_Comp_4  -8.152986         5      0.4990184 0.2867496 0.3432131 -12.811575
#> Nb_Comp_5  -7.111583         6      0.5054709 0.3019556 0.3714754 -11.329638
#> Nb_Comp_6  -7.233043         7      0.5127450 0.3186757 0.4021333  -9.918688
#> Nb_Comp_7  -6.742195         8      0.5203986 0.3364668 0.4347156  -8.592770
#> Nb_Comp_8  -6.038372         9      0.5297842 0.3572181 0.4717708  -7.287834
#> Nb_Comp_9  -5.600249        10      0.5409503 0.3813021 0.5140048  -6.008747
#> Nb_Comp_10 -5.288422        11      0.5529032 0.4076026 0.5600977  -4.799453

data(pineNAX21)
bbb2 <- cv.plsRglm(x11~.,data=pineNAX21,nt=10,
modele="pls-glm-family",family=gaussian(log),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
#> Warning: glm.fit: algorithm did not converge
bbb2 <- cv.plsRglm(x11~.,data=pineNAX21,nt=10,
modele="pls-glm-gaussian",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb2)
#>           [,1]         [,2]        [,3]       [,4]       [,5]       [,6]
#>  [1,] 6.770080 -0.002990677 -0.03106492 0.02536948 -0.5129799 0.12352762
#>  [2,] 8.062435 -0.002503986 -0.03501111 0.04449777 -0.4406951 0.05593712
#>  [3,] 7.589924 -0.003006633 -0.03374821 0.01984906 -0.2582668 0.07965585
#>  [4,] 7.896228 -0.003137102 -0.03666889 0.03076541 -0.4871158 0.10383572
#>  [5,] 6.395682 -0.002582542 -0.03077837 0.02323352 -0.5404291 0.11772651
#>  [6,] 7.229440 -0.003065730 -0.03696103 0.02489876 -0.5977863 0.12666253
#>  [7,] 8.282578 -0.003073776 -0.03422727 0.11342553 -0.7275917 0.13483198
#>  [8,] 8.663276 -0.003566773 -0.03534624 0.07108753 -0.4850251 0.10928831
#>  [9,] 7.730218 -0.003045287 -0.03487353 0.05052180 -0.5446351 0.12431857
#> [10,] 7.325337 -0.003026057 -0.03252485 0.06275037 -0.6804513 0.15352890
#>              [,7]        [,8]        [,9]      [,10]      [,11]
#>  [1,] -0.04548983  0.31396260 -0.02274435 -0.4572110 -0.2209887
#>  [2,] -0.17852586 -0.46062929  0.09151323 -1.1895449 -0.2228995
#>  [3,]  0.25539296 -0.47483195 -0.02284772 -1.0091811 -0.2610774
#>  [4,]  0.01773704 -0.23250462  0.03008922 -0.7973461 -0.4315898
#>  [5,]  0.18031801  0.23732343  0.02926486 -0.8554599 -0.5539496
#>  [6,] -0.02301891  0.03954103  0.02535171 -0.6555213 -0.3457089
#>  [7,] -1.32446515  0.37977077  0.14993172 -0.7299502 -0.7285049
#>  [8,] -0.34332726 -0.10043761  0.05842863 -1.0282826 -0.5081320
#>  [9,] -0.35631162 -0.08046106  0.03294664 -0.7055256 -0.4830096
#> [10,] -0.52924881  0.31926805  0.08860512 -0.9032159 -0.4933482
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1]     1.680080     2.268934     1.116306     2.188158     4.875183
#> [6]     5.344921     5.319879    42.372370 13725.502351
#> 
#> [[1]][[2]]
#> [1] 2.927124 2.444835 1.840756 2.099373 2.024730 2.141613 2.219829 2.211487
#> [9] 1.913873
#> 
#> [[1]][[3]]
#> [1] 0.7561049 1.7540076 1.2462513 1.3542112 0.8840868 0.8561231 0.8253708
#> [8] 0.8019139 0.7480767
#> 
#> [[1]][[4]]
#> [1] 0.5348930 0.8137783 0.4234472 0.2398813 0.2070550 0.2126833 0.1872761
#> [8] 0.2061875 0.2191670
#> 
#> [[1]][[5]]
#> [1] 3.315976 3.242026 3.260476 3.113407 3.053264 3.342893 3.251747 3.049279
#> [9] 2.939393
#> 
#> [[1]][[6]]
#> [1] 0.7770085 0.9557447 0.6813181 0.4997465 0.6344230 0.8514296 0.8340570
#> [8] 0.7933497 0.7589313
#> 
#> [[1]][[7]]
#> [1] 0.5274077 0.4874011 0.2737825 0.2265081 0.2590577 0.2073294 0.1681690
#> [8] 0.1494498 0.1577765
#> 
#> [[1]][[8]]
#> [1] 0.9741683 0.9770761 0.7158703 0.7740606 0.8121105 0.6451652 0.6791682
#> [8] 0.7032744 0.6303312
#> 
#> [[1]][[9]]
#> [1] 1.4492351 0.9851667 0.8955955 0.9657385 0.9955131 0.9771189 1.0858478
#> [8] 1.1094762 1.1276853
#> 
#> [[1]][[10]]
#> [1] 1.249759 1.297455 1.177318 1.618829 1.796088 1.860776 2.049564 2.112380
#> [9] 2.044202
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1]    14.19176    15.22642    11.63112    13.07991    15.54151    16.44005
#> [7]    16.62091    53.50917 13736.04179
#> 
summary(bbb2)
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> 
#> Family: gaussian 
#> Link function: identity 
#> 
#> ____There are some NAs in X but not in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2     Q2Chisq_Y
#> Nb_Comp_0 82.41888 85.41190            NA     NA            NA
#> Nb_Comp_1 63.90814 68.39766  3.177090e-01 0.0975     0.3177090
#> Nb_Comp_2 54.06295 60.04898  7.011027e-02 0.0975    -0.3628932
#> Nb_Comp_3 53.77276 61.25530 -3.861325e-01 0.0975    -0.4906418
#> Nb_Comp_4 55.18223 64.16127 -1.490584e+00 0.0975    -0.7967866
#> Nb_Comp_5 56.53963 67.01518 -4.413248e+00 0.0975    -1.1734849
#> Nb_Comp_6 57.73540 69.70746 -1.169057e+01 0.0975    -1.3443551
#> Nb_Comp_7 59.46634 72.93491 -2.982054e+01 0.0975    -1.4286168
#> Nb_Comp_8 60.79943 75.76451 -2.419482e+02 0.0975    -6.8826705
#> Nb_Comp_9 62.14147 78.60305 -5.016449e+05 0.0975 -2063.8266664
#>           PREChi2_Pearson_Y Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0                NA      20.800152 20.800152        NA
#> Nb_Comp_1          14.19176      11.172133 11.172133 0.4628821
#> Nb_Comp_2          15.22642       7.802760  7.802760 0.6248700
#> Nb_Comp_3          11.63112       7.279614  7.279614 0.6500211
#> Nb_Comp_4          13.07991       7.150504  7.150504 0.6562283
#> Nb_Comp_5          15.54151       7.012612  7.012612 0.6628577
#> Nb_Comp_6          16.44005       6.843775  6.843775 0.6709747
#> Nb_Comp_7          16.62091       6.788203  6.788203 0.6736465
#> Nb_Comp_8          53.50917       6.652395  6.652395 0.6801757
#> Nb_Comp_9       13736.04179       6.521071  6.521071 0.6864893
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(x11~.,data=pineNAX21,nt=10,typeVC="standard")$InfCrit
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> ____There are some NAs in X but not in Y____
#> ____TypeVC____ standard ____
#> ____TypeVC____ standard ____unknown____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#>                AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0 82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1 63.69250  0.35639805  0.0975  0.35639805 13.387018 11.099368
#> Nb_Comp_2 58.35228  0.28395028  0.0975 -0.11256611 12.348781  8.885823
#> Nb_Comp_3 56.36553  0.07664889  0.0975 -0.28950699 11.458331  7.874634
#> Nb_Comp_4 54.02416 -0.70355579  0.0975 -0.84497074 14.528469  6.903925
#> Nb_Comp_5 55.80450 -0.94905654  0.0975 -0.14411078  7.898855  6.858120
#> Nb_Comp_6 57.45753 -1.27568315  0.0975 -0.16758190  8.007417  6.786392
#> Nb_Comp_7 58.73951 -1.63309014  0.0975 -0.15705481  7.852227  6.640327
#> Nb_Comp_8 60.61227 -1.67907859  0.0975 -0.01746558  6.756304  6.614773
#> Nb_Comp_9 62.25948 -2.15165796  0.0975 -0.17639623  7.781594  6.544432
#>                R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0        NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1 0.4663804 0.4663804   17.07583     20.59526  0.35639805 0.0975
#> Nb_Comp_2 0.5728001 0.5728001   13.67040     18.99799 -0.11256611 0.0975
#> Nb_Comp_3 0.6214146 0.6214146   12.11473     17.62807 -0.28950699 0.0975
#> Nb_Comp_4 0.6680830 0.6680830   10.62135     22.35133 -0.84497074 0.0975
#> Nb_Comp_5 0.6702851 0.6702851   10.55088     12.15200 -0.14411078 0.0975
#> Nb_Comp_6 0.6737336 0.6737336   10.44053     12.31901 -0.16758190 0.0975
#> Nb_Comp_7 0.6807558 0.6807558   10.21581     12.08026 -0.15705481 0.0975
#> Nb_Comp_8 0.6819844 0.6819844   10.17650     10.39424 -0.01746558 0.0975
#> Nb_Comp_9 0.6853661 0.6853661   10.06828     11.97160 -0.17639623 0.0975
#>           Q2cum_residY  AIC.std DoF.dof sigmahat.dof AIC.dof BIC.dof GMDL.dof
#> Nb_Comp_0           NA 96.63448      NA           NA      NA      NA       NA
#> Nb_Comp_1   0.35639805 77.90810      NA           NA      NA      NA       NA
#> Nb_Comp_2   0.28395028 72.56787      NA           NA      NA      NA       NA
#> Nb_Comp_3   0.07664889 70.58113      NA           NA      NA      NA       NA
#> Nb_Comp_4  -0.70355579 68.23976      NA           NA      NA      NA       NA
#> Nb_Comp_5  -0.94905654 70.02009      NA           NA      NA      NA       NA
#> Nb_Comp_6  -1.27568315 71.67313      NA           NA      NA      NA       NA
#> Nb_Comp_7  -1.63309014 72.95511      NA           NA      NA      NA       NA
#> Nb_Comp_8  -1.67907859 74.82787      NA           NA      NA      NA       NA
#> Nb_Comp_9  -2.15165796 76.47507      NA           NA      NA      NA       NA
#>           DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1         2      0.5983679 0.3797438 0.4122175 -11.413749
#> Nb_Comp_2         3      0.5442372 0.3231208 0.3634169 -12.847656
#> Nb_Comp_3         4      0.5210941 0.3044529 0.3537087 -12.776843
#> Nb_Comp_4         5      0.4965569 0.2839276 0.3398355 -12.891035
#> Nb_Comp_5         6      0.5039885 0.3001871 0.3692997 -11.349498
#> Nb_Comp_6         7      0.5108963 0.3163819 0.3992388  -9.922119
#> Nb_Comp_7         8      0.5153766 0.3300041 0.4263658  -8.696873
#> Nb_Comp_8         9      0.5249910 0.3507834 0.4632727  -7.337679
#> Nb_Comp_9        10      0.5334234 0.3707649 0.4998004  -6.033403
rm(list=c("bbb","bbb2"))


data(aze_compl)
bbb <- cv.plsRglm(y~.,data=aze_compl,nt=10,K=10,modele="pls",
keepcoeffs=TRUE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb)
#>            [,1]        [,2]      [,3]        [,4]      [,5]       [,6]
#>  [1,] 0.3724822 -0.13377806 0.4525450 -0.20190168 0.1701466 0.06625404
#>  [2,] 0.2287946 -0.21490003 0.4894854 -0.27317306 0.3534086 0.09671848
#>  [3,] 0.3513537 -0.20059831 0.4467219  0.01444052 0.2259211 0.03649644
#>  [4,] 0.2222783 -0.12283350 0.3887501 -0.19504329 0.2529262 0.09892911
#>  [5,] 0.3515024 -0.14459318 0.4644354 -0.20963840 0.2136448 0.02088139
#>  [6,] 0.4298899 -0.10697913 0.3266177 -0.29235293 0.3634699 0.13467936
#>  [7,] 0.3536212 -0.16739755 0.4933137 -0.20171314 0.2174984 0.14184965
#>  [8,] 0.2612882 -0.04616133 0.4661063 -0.15987737 0.1953837 0.10522036
#>  [9,] 0.2999633 -0.08085565 0.5168788 -0.12124029 0.2954881 0.17720006
#> [10,] 0.2770073 -0.12133747 0.4937389 -0.15911174 0.3473549 0.10469334
#>              [,7]         [,8]        [,9]       [,10]       [,11]       [,12]
#>  [1,] -0.07833418 -0.032012204 -0.16991619  0.05308367  0.06520638  0.10630795
#>  [2,]  0.03214603  0.005007001 -0.30174561  0.04628644 -0.08856429  0.04087085
#>  [3,]  0.01273879 -0.094137406 -0.20576617  0.12230456 -0.03224522 -0.02026267
#>  [4,] -0.03252892  0.009876967 -0.15081156  0.07289155 -0.12380526  0.07570291
#>  [5,] -0.15689281  0.153924200 -0.25764485 -0.01623844 -0.17707476  0.11534473
#>  [6,] -0.03885472  0.046730456 -0.26663188  0.01020762 -0.08744551  0.03450689
#>  [7,] -0.06316166 -0.040271864 -0.20266508 -0.06077244 -0.16688576  0.12701378
#>  [8,] -0.05745747 -0.039607890 -0.09823709  0.09883396 -0.06931337  0.01471428
#>  [9,] -0.01007340  0.045126583 -0.28647269  0.13812424 -0.15642806  0.02401766
#> [10,] -0.07930941 -0.027144031 -0.17873166  0.03874793 -0.10068646  0.03298810
#>             [,13]      [,14]      [,15]       [,16]        [,17]     [,18]
#>  [1,] -0.12129388 0.01188706 0.13812125  0.13694826 -0.004960524 0.3881854
#>  [2,] -0.17365438 0.09670301 0.05327261  0.13393870  0.043511541 0.2664778
#>  [3,] -0.14884330 0.09890621 0.05070844  0.05991712 -0.035530958 0.1229952
#>  [4,] -0.11955236 0.11639003 0.11983591  0.06679749  0.034563874 0.2347771
#>  [5,] -0.07220730 0.06965413 0.12009932 -0.05767514  0.135370334 0.2143145
#>  [6,] -0.07459099 0.17626762 0.04916245 -0.01522456 -0.010922339 0.3550989
#>  [7,] -0.09821926 0.06970586 0.19042655  0.02650632 -0.044312751 0.1880577
#>  [8,] -0.12953312 0.15780333 0.16683682  0.06568422 -0.024222744 0.2536562
#>  [9,] -0.26905478 0.11878160 0.15784168  0.10237741  0.037576007 0.2230346
#> [10,] -0.10307537 0.08669850 0.06688120  0.11404656 -0.016658124 0.2163985
#>               [,19]       [,20]        [,21]       [,22]      [,23]       [,24]
#>  [1,] -0.1608785792 0.005232727 -0.136532808  0.11515598 0.15052560 -0.25471221
#>  [2,]  0.0508934169 0.074384532 -0.164126581  0.06788480 0.21503288 -0.10499750
#>  [3,]  0.0434516732 0.092435673 -0.223671753  0.04343168 0.14934454 -0.05917518
#>  [4,] -0.0315731247 0.076872923 -0.101352089  0.03607653 0.14718200 -0.14754221
#>  [5,]  0.0308675490 0.061997275 -0.007023536  0.01722572 0.30673881 -0.14272137
#>  [6,] -0.0303623619 0.095685418 -0.060442341  0.08269255 0.23030721 -0.15264686
#>  [7,]  0.0458887249 0.139983182 -0.072007574  0.02369337 0.15404416 -0.02062648
#>  [8,] -0.0007425023 0.110567931 -0.149400752  0.13986308 0.08696957 -0.09455286
#>  [9,] -0.0064917007 0.024235881 -0.169518787 -0.00640014 0.24820995 -0.21236995
#> [10,]  0.0412768750 0.030122177 -0.189019947  0.10604494 0.17504133 -0.20246899
#>            [,25]      [,26]     [,27]     [,28]       [,29]       [,30]
#>  [1,] -0.1942306 -0.2676669 0.2047272 0.2876234 -0.18087724 -0.06749063
#>  [2,] -0.2049727 -0.2962802 0.2145926 0.1710845 -0.07070219  0.02625242
#>  [3,] -0.1280655 -0.3488537 0.2570763 0.2847822  0.01375718 -0.05373491
#>  [4,] -0.1451288 -0.2464513 0.1581541 0.2079507 -0.08061645  0.05916019
#>  [5,] -0.2113756 -0.3324054 0.1762866 0.1650450 -0.09124624  0.03428544
#>  [6,] -0.1784463 -0.3450099 0.2377636 0.1985821 -0.06274940  0.01721991
#>  [7,] -0.1406075 -0.3347074 0.1798777 0.2098004 -0.13006619  0.01152693
#>  [8,] -0.1296372 -0.2720950 0.1555329 0.1186683 -0.10534225 -0.02013665
#>  [9,] -0.2011054 -0.2531906 0.1350775 0.1513611 -0.14076812  0.08657368
#> [10,] -0.2466734 -0.2525361 0.1950085 0.1911501 -0.09330348  0.04790004
#>            [,31]        [,32]      [,33]        [,34]
#>  [1,] 0.04371715 -0.100169079 -0.2318000 -0.014294243
#>  [2,] 0.14427735 -0.082232157 -0.2955279  0.001192011
#>  [3,] 0.14158051  0.007262828 -0.4621361 -0.011889224
#>  [4,] 0.14432159 -0.056644709 -0.3632790 -0.009293336
#>  [5,] 0.14660950 -0.074388603 -0.3848128  0.047327376
#>  [6,] 0.06896337 -0.066679140 -0.5251891 -0.015443496
#>  [7,] 0.13442878 -0.021473467 -0.4018464 -0.057245870
#>  [8,] 0.04346126 -0.007275098 -0.4203540 -0.006403476
#>  [9,] 0.09601462 -0.054403613 -0.3976532 -0.005348842
#> [10,] 0.17886493 -0.053998406 -0.4208506  0.026585830
bbb2 <- cv.plsRglm(y~.,data=aze_compl,nt=3,K=10,
modele="pls-glm-family",family=binomial(probit),keepcoeffs=TRUE,verbose=FALSE)
bbb2 <- cv.plsRglm(y~.,data=aze_compl,nt=3,K=10,
modele="pls-glm-logistic",keepcoeffs=TRUE,verbose=FALSE)
summary(bbb,MClassed=TRUE)
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC MissClassed CV_MissClassed       Q2cum_Y LimQ2_Y
#> Nb_Comp_0  154.6179          49             NA            NA      NA
#> Nb_Comp_1  126.4083          27             41 -9.209936e-02  0.0975
#> Nb_Comp_2  119.3375          25             49 -6.536512e-01  0.0975
#> Nb_Comp_3  114.2313          27             46 -2.009469e+00  0.0975
#> Nb_Comp_4  112.3463          23             48 -5.502213e+00  0.0975
#> Nb_Comp_5  113.2362          22             46 -1.388712e+01  0.0975
#> Nb_Comp_6  114.7620          21             47 -3.338077e+01  0.0975
#> Nb_Comp_7  116.5264          20             48 -7.876766e+01  0.0975
#> Nb_Comp_8  118.4601          20             45 -1.865898e+02  0.0975
#> Nb_Comp_9  120.4452          19             45 -4.407479e+02  0.0975
#> Nb_Comp_10 122.4395          19             48 -1.040416e+03  0.0975
#>                   Q2_Y  PRESS_Y    RSS_Y      R2_Y  AIC.std  DoF.dof
#> Nb_Comp_0           NA       NA 25.91346        NA 298.1344  1.00000
#> Nb_Comp_1  -0.09209936 28.30007 19.38086 0.2520929 269.9248 22.55372
#> Nb_Comp_2  -0.51419480 29.34640 17.76209 0.3145613 262.8540 27.31542
#> Nb_Comp_3  -0.81989366 32.32511 16.58896 0.3598323 257.7478 30.52370
#> Nb_Comp_4  -1.16058464 35.84186 15.98071 0.3833049 255.8628 34.00000
#> Nb_Comp_5  -1.28954665 36.58857 15.81104 0.3898523 256.7527 34.00000
#> Nb_Comp_6  -1.30943038 36.51450 15.73910 0.3926285 258.2785 34.00000
#> Nb_Comp_7  -1.32012442 36.51667 15.70350 0.3940024 260.0429 33.71066
#> Nb_Comp_8  -1.35170252 36.92995 15.69348 0.3943888 261.9766 34.00000
#> Nb_Comp_9  -1.35486107 36.95597 15.69123 0.3944758 263.9617 33.87284
#> Nb_Comp_10 -1.35748846 36.99189 15.69037 0.3945088 265.9560 34.00000
#>            sigmahat.dof   AIC.dof   BIC.dof  GMDL.dof DoF.naive sigmahat.naive
#> Nb_Comp_0     0.5015845 0.2540061 0.2604032 -67.17645         1      0.5015845
#> Nb_Comp_1     0.4848429 0.2883114 0.4231184 -53.56607         2      0.4358996
#> Nb_Comp_2     0.4781670 0.2908950 0.4496983 -52.42272         3      0.4193593
#> Nb_Comp_3     0.4719550 0.2902572 0.4631316 -51.93343         4      0.4072955
#> Nb_Comp_4     0.4744263 0.3008285 0.4954133 -50.37079         5      0.4017727
#> Nb_Comp_5     0.4719012 0.2976347 0.4901536 -50.65724         6      0.4016679
#> Nb_Comp_6     0.4708264 0.2962804 0.4879234 -50.78005         7      0.4028135
#> Nb_Comp_7     0.4693382 0.2937976 0.4826103 -51.05525         8      0.4044479
#> Nb_Comp_8     0.4701436 0.2954217 0.4865092 -50.85833         9      0.4064413
#> Nb_Comp_9     0.4696894 0.2945815 0.4845867 -50.95616        10      0.4085682
#> Nb_Comp_10    0.4700970 0.2953632 0.4864128 -50.86368        11      0.4107477
#>            AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0  0.2540061 0.2604032  -67.17645
#> Nb_Comp_1  0.1936625 0.2033251  -79.67755
#> Nb_Comp_2  0.1809352 0.1943501  -81.93501
#> Nb_Comp_3  0.1722700 0.1891422  -83.31503
#> Nb_Comp_4  0.1691819 0.1897041  -83.23369
#> Nb_Comp_5  0.1706451 0.1952588  -81.93513
#> Nb_Comp_6  0.1731800 0.2020601  -80.42345
#> Nb_Comp_7  0.1761610 0.2094352  -78.87607
#> Nb_Comp_8  0.1794902 0.2172936  -77.31942
#> Nb_Comp_9  0.1829787 0.2254232  -75.80069
#> Nb_Comp_10 0.1865584 0.2337468  -74.33325
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRmodel"
summary(bbb2,MClassed=TRUE)
#> ____************************************************____
#> 
#> Family: binomial 
#> Link function: logit 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC MissClassed CV_MissClassed Q2Chisqcum_Y  limQ2
#> Nb_Comp_0 145.8283 148.4727          49             NA           NA     NA
#> Nb_Comp_1 118.1398 123.4285          28             46   -0.8296421 0.0975
#> Nb_Comp_2 109.9553 117.8885          26             49   -5.7270324 0.0975
#> Nb_Comp_3 105.1591 115.7366          22             45 -196.6356035 0.0975
#>             Q2Chisq_Y PREChi2_Pearson_Y Chi2_Pearson_Y    RSS_Y      R2_Y
#> Nb_Comp_0          NA                NA      104.00000 25.91346        NA
#> Nb_Comp_1  -0.8296421          190.2828      100.53823 19.32272 0.2543365
#> Nb_Comp_2  -2.6766931          369.6482       99.17955 17.33735 0.3309519
#> Nb_Comp_3 -28.3793151         2913.8274      123.37836 15.58198 0.3986915
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
kfolds2coeff(bbb2)
#>              [,1]        [,2]     [,3]        [,4]      [,5]        [,6]
#>  [1,] -1.13444810 -1.22517420 2.000795 -0.42717010 1.1063768 -0.10732384
#>  [2,] -1.79647030 -0.78218836 1.980915 -0.31863303 1.0426683  0.09544303
#>  [3,] -1.10081199 -0.19336436 2.472819 -0.27598934 1.1616714  0.34004770
#>  [4,] -1.20868946 -0.13997139 2.606065 -0.47779202 0.7109606 -0.01319199
#>  [5,] -0.70063172 -0.49354959 1.820787 -0.81418702 1.0242819  0.14055701
#>  [6,] -0.73766114 -0.07597078 1.142360 -0.54366666 1.4005770 -0.43638834
#>  [7,]  0.01032098 -0.30577442 2.550889 -0.40459420 0.6227844 -0.30258410
#>  [8,] -0.59159773 -0.24825960 2.282495 -0.26752859 0.7231401 -0.05521421
#>  [9,] -2.24291622 -1.30131707 4.193378 -0.55105980 1.3495224  0.05131540
#> [10,] -0.67822942 -0.34001156 2.483672 -0.07305483 0.7456875  0.39628982
#>              [,7]         [,8]       [,9]       [,10]      [,11]       [,12]
#>  [1,] -0.81359234  0.069482449 -0.3608154 -0.33250368 -0.8650907  0.30269856
#>  [2,]  0.05193114  0.002404035 -0.4242254  0.01303683 -0.8285786  0.34504403
#>  [3,] -0.47999113  0.049368002 -0.7563468  0.11591545 -0.3217862 -0.20576286
#>  [4,] -0.70802409  0.013400008 -0.8205163 -0.04245076 -0.8704842  0.13162160
#>  [5,] -0.61307746  0.393161354 -0.5056878  0.23706939 -0.4701014 -0.11919913
#>  [6,] -0.48558003  0.348894292 -1.2145715 -0.17992250 -0.4745978 -0.66661705
#>  [7,] -0.54053349 -0.251525415 -0.5889782 -0.07181002 -1.0232337  0.21531904
#>  [8,] -0.53693755  0.052294543 -0.6798649  0.18457458 -0.4511495 -0.17573082
#>  [9,] -0.84235695  0.980031254 -1.0168467  0.38461216 -1.1370683 -0.05997120
#> [10,] -0.69732794  0.533104414 -0.7150788  1.10999473 -0.7602052  0.02497002
#>             [,13]     [,14]      [,15]      [,16]        [,17]     [,18]
#>  [1,] -0.31692870 1.2238725 1.57718186  0.6635395 -0.142344416 1.2917962
#>  [2,] -0.72675489 0.6479095 1.22632040  0.8169603  0.312461550 1.0250396
#>  [3,] -0.81357644 0.6591230 1.44059873  0.5457412 -0.475854272 1.4488852
#>  [4,] -0.43318184 0.7145746 1.08244484  0.6732560 -0.075401158 0.3751883
#>  [5,] -0.41348854 0.9136582 0.52940456  0.3351829  0.031315095 0.9159238
#>  [6,] -0.42901464 1.2076391 1.45639192  0.1378885  0.204767917 0.8576087
#>  [7,] -0.08492218 1.0109965 1.26248773  1.0049064 -0.061841004 1.0501502
#>  [8,] -0.41425492 0.7270745 1.10244839  0.1589435  0.026993865 0.7513283
#>  [9,] -0.53543343 0.9213170 2.27415247 -0.2233820  0.038506555 1.8453801
#> [10,] -0.72340823 0.3355621 0.01528173  0.4464266  0.001258153 1.2100569
#>             [,19]     [,20]      [,21]        [,22]     [,23]      [,24]
#>  [1,]  0.39379915 0.3384263 -0.5547782 -0.066437852 0.6676329 -0.5472630
#>  [2,]  0.21008934 0.6841737 -0.9352818 -0.194819554 0.5282158 -0.4884818
#>  [3,] -0.03376357 0.6407065 -0.7044372  0.095886431 0.4566194 -1.0456200
#>  [4,]  0.08837697 0.5790060 -0.7603010  0.417212737 0.7065756 -0.6184696
#>  [5,]  0.09048286 0.3773686 -0.6731621  0.506030590 0.9600404 -0.5052705
#>  [6,] -0.01121534 1.0831672 -0.6572596  0.590177836 0.3841045 -0.2336897
#>  [7,] -0.43644983 0.5911454 -0.9141435  0.564061142 0.5604343 -0.5626781
#>  [8,]  0.57432284 0.5866816 -0.9027760  0.004468917 0.6309274 -0.7014271
#>  [9,]  0.49291272 1.2447402 -0.9911845 -0.241150716 1.8612594 -1.3620023
#> [10,]  0.33056592 0.9431673 -1.5126107  0.659578705 1.0554199 -0.9634891
#>            [,25]     [,26]     [,27]     [,28]      [,29]       [,30]     [,31]
#>  [1,] -1.3892702 -1.662566 0.5469475 1.0360126 -1.1834820 -0.58233539 1.7441967
#>  [2,] -0.8676960 -1.277262 0.4976192 0.8798708 -1.1580603  0.02405450 1.1818757
#>  [3,] -1.0861187 -1.140994 0.3729239 0.7582032 -1.0488988 -0.28487318 1.1829286
#>  [4,] -1.2403683 -1.327914 1.0230708 1.2579772 -0.7703225  0.08314191 0.8148447
#>  [5,] -1.0933715 -1.179239 0.4655499 0.7194485 -0.8943296 -0.29372368 1.3570893
#>  [6,] -1.5426052 -1.212487 0.3080765 1.0004766 -0.7014799 -0.18658633 0.8541955
#>  [7,] -0.9076828 -1.114378 0.2378052 0.8423839 -0.7250399 -0.78706323 0.6414744
#>  [8,] -0.6716384 -0.943175 0.3206679 0.6400216 -1.2453190 -0.17033240 1.0592304
#>  [9,] -1.6346096 -2.340649 1.1670670 0.6464529 -1.5036649 -0.09554882 1.3769529
#> [10,] -1.6922252 -1.900952 0.9137082 0.9004806 -1.3397401  0.04827695 0.8139294
#>             [,32]     [,33]      [,34]
#>  [1,]  0.95298352 -2.410290 -0.3343529
#>  [2,]  0.40804096 -1.816289 -0.1750198
#>  [3,] -0.20910491 -2.034968  0.2644007
#>  [4,]  0.68596502 -2.203391  0.1788611
#>  [5,]  0.04802424 -2.284834 -0.1281110
#>  [6,]  0.50529704 -1.968857  0.0938438
#>  [7,]  0.15876698 -2.223451 -0.5215771
#>  [8,]  0.62573871 -2.198184 -0.2456192
#>  [9,]  0.40286959 -3.277717  0.1562206
#> [10,]  0.37726203 -2.292955  0.1562846

kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1]   24.93513  100.80113 1057.13705
#> 
#> [[1]][[2]]
#> [1] 13.372297 10.745408  9.603284
#> 
#> [[1]][[3]]
#> [1] 14.64340 19.06535 21.82201
#> 
#> [[1]][[4]]
#> [1] 20.44088 15.37855 16.39127
#> 
#> [[1]][[5]]
#> [1] 8.263165 7.977184 5.714699
#> 
#> [[1]][[6]]
#> [1]  35.58561  55.53218 100.99793
#> 
#> [[1]][[7]]
#> [1] 21.35820 46.14551 61.99767
#> 
#> [[1]][[8]]
#> [1] 11.30576 12.01867 13.05130
#> 
#> [[1]][[9]]
#> [1]   29.12330   80.42722 1562.59599
#> 
#> [[1]][[10]]
#> [1] 11.25504 21.55701 64.51617
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1]  190.2828  369.6482 2913.8274
#> 
summary(bbb2)
#> ____************************************************____
#> 
#> Family: binomial 
#> Link function: logit 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 145.8283 148.4727           NA     NA          NA                NA
#> Nb_Comp_1 118.1398 123.4285   -0.8296421 0.0975  -0.8296421          190.2828
#> Nb_Comp_2 109.9553 117.8885   -5.7270324 0.0975  -2.6766931          369.6482
#> Nb_Comp_3 105.1591 115.7366 -196.6356035 0.0975 -28.3793151         2913.8274
#>           Chi2_Pearson_Y    RSS_Y      R2_Y
#> Nb_Comp_0      104.00000 25.91346        NA
#> Nb_Comp_1      100.53823 19.32272 0.2543365
#> Nb_Comp_2       99.17955 17.33735 0.3309519
#> Nb_Comp_3      123.37836 15.58198 0.3986915
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
rm(list=c("bbb","bbb2"))



data(pine)
bbb <- cv.plsRglm(round(x11)~.,data=pine,nt=10,
modele="pls-glm-family",family=poisson(log),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
bbb <- cv.plsRglm(round(x11)~.,data=pine,nt=10,
modele="pls-glm-poisson",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb)
#>           [,1]         [,2]        [,3]      [,4]      [,5]      [,6]      [,7]
#>  [1,] 11.87732 -0.005037176 -0.07228789 0.1756572 -1.446678 0.3206166 -1.991621
#>  [2,] 12.79829 -0.005739018 -0.08474769 0.2177416 -1.482546 0.2663994 -2.963763
#>  [3,] 12.15890 -0.005159002 -0.04787105 0.2461559 -1.001812 0.2933040 -2.491788
#>  [4,] 14.59603 -0.004821196 -0.06947521 0.2574046 -1.506677 0.2138810 -2.819601
#>  [5,] 11.97452 -0.004798163 -0.07830629 0.1195572 -2.343990 0.4458264 -1.378371
#>  [6,] 14.69407 -0.004506571 -0.11816118 0.3518994 -1.919990 0.4010344 -5.426748
#>  [7,] 13.49437 -0.005420212 -0.06750168 0.1984622 -1.679051 0.3232935 -2.069458
#>  [8,] 11.20078 -0.004545173 -0.07282758 0.1413877 -1.465566 0.3035395 -1.267036
#>  [9,] 13.89864 -0.005362286 -0.08024535 0.2148068 -1.782767 0.3193506 -2.200106
#> [10,] 10.45751 -0.003495752 -0.04783664 0.1438303 -1.535956 0.2784995 -1.191641
#>              [,8]        [,9]      [,10]       [,11]
#>  [1,]  0.17550639  0.04084287 -0.4472137 -0.33463370
#>  [2,]  0.47932869  0.42752402 -0.8103704 -0.34263304
#>  [3,] -0.21170638 -0.07661913 -1.2663427  0.15030766
#>  [4,] -0.97482981  0.43990816 -2.1712371  0.54876986
#>  [5,]  0.34766428  0.36223329 -1.2353920 -0.36316232
#>  [6,]  0.81872854  0.20915044 -0.1707349 -0.71856887
#>  [7,]  0.25830383  0.20095525 -1.1609692 -0.55898116
#>  [8,] -0.06221445  0.10411647 -1.0001840 -0.06349315
#>  [9,] -0.05690170  0.29067740 -1.4816836 -0.08588701
#> [10,] -0.04667104  0.24903446 -1.7868406 -0.26885071
boxplot(kfolds2coeff(bbb)[,1])


kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#>  [1] 1.1987954 1.0429683 0.5901094 0.6531341 0.7264343 0.7682242 0.7023257
#>  [8] 0.6635709 0.6244831 0.6106630
#> 
#> [[1]][[2]]
#>  [1] 1.649817 2.909094 2.890999 2.306416 1.762120 1.222780 1.690733 1.777425
#>  [9] 1.855983 1.842890
#> 
#> [[1]][[3]]
#>  [1] 1.851572 2.237299 3.813224 4.303537 4.039604 4.266511 3.855201 3.670686
#>  [9] 3.529519 3.531004
#> 
#> [[1]][[4]]
#>  [1] 1.035559 1.451557 1.382122 2.229944 2.500573 2.986025 3.289664 2.304676
#>  [9] 2.167274 2.208751
#> 
#> [[1]][[5]]
#>  [1] 8.813729 7.141891 3.957039 3.441716 2.139781 5.205336 4.739872 5.479314
#>  [9] 5.514204 5.299915
#> 
#> [[1]][[6]]
#>  [1] 36.17315 33.97617 22.14153 29.02607 28.76906 52.44980 61.93700 59.90178
#>  [9] 60.99658 60.65830
#> 
#> [[1]][[7]]
#>  [1] 0.4714774 1.5461481 1.3256110 1.5862978 0.8590626 0.6093304 0.4496075
#>  [8] 0.6311784 0.5597802 0.5530090
#> 
#> [[1]][[8]]
#>  [1] 1.5239093 1.7937944 1.1415934 1.3211920 1.2077509 1.0939606 0.7394648
#>  [8] 0.7302708 0.6620766 0.6653249
#> 
#> [[1]][[9]]
#>  [1] 2.211888 2.438567 1.608112 2.115015 2.293327 2.690191 2.588582 2.776605
#>  [9] 2.771897 2.771812
#> 
#> [[1]][[10]]
#>  [1] 3.553138 4.051733 2.713883 2.704779 2.882625 3.395190 2.897026 2.111914
#>  [9] 2.148464 2.127830
#> 
#> 
kfolds2Chisq(bbb)
#> [[1]]
#>  [1] 58.48304 58.58922 41.56422 49.68810 47.18034 74.68735 82.88948 80.04742
#>  [9] 80.83026 80.26950
#> 
summary(bbb)
#> ____************************************************____
#> 
#> Family: poisson 
#> Link function: log 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC  Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0  76.61170 78.10821            NA     NA         NA                NA
#> Nb_Comp_1  65.70029 68.69331 -7.328307e-01 0.0975 -0.7328307          58.48304
#> Nb_Comp_2  62.49440 66.98392 -3.255232e+00 0.0975 -1.4556535          58.58922
#> Nb_Comp_3  62.47987 68.46590 -9.223482e+00 0.0975 -1.4025677          41.56422
#> Nb_Comp_4  64.21704 71.69958 -3.175346e+01 0.0975 -2.2037475          49.68810
#> Nb_Comp_5  65.81654 74.79559 -1.004033e+02 0.0975 -2.0959574          47.18034
#> Nb_Comp_6  66.48888 76.96443 -4.952111e+02 0.0975 -3.8934413          74.68735
#> Nb_Comp_7  68.40234 80.37440 -2.316705e+03 0.0975 -3.6708047          82.88948
#> Nb_Comp_8  70.39399 83.86256 -1.028054e+04 0.0975 -3.4360879          80.04742
#> Nb_Comp_9  72.37642 87.34149 -4.571485e+04 0.0975 -3.4463992          80.83026
#> Nb_Comp_10 74.37612 90.83770 -1.999848e+05 0.0975 -3.3745386          80.26950
#>            Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0        33.75000 24.545455        NA
#> Nb_Comp_1        23.85891 12.599337 0.4866937
#> Nb_Comp_2        17.29992  9.056074 0.6310488
#> Nb_Comp_3        15.50937  8.232069 0.6646194
#> Nb_Comp_4        15.23934  8.125808 0.6689485
#> Nb_Comp_5        15.26275  7.862134 0.6796909
#> Nb_Comp_6        17.74629  6.203270 0.7472742
#> Nb_Comp_7        18.04460  5.879880 0.7604493
#> Nb_Comp_8        18.17881  5.827065 0.7626011
#> Nb_Comp_9        18.34925  5.837300 0.7621841
#> Nb_Comp_10       18.39332  5.832437 0.7623822
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(x11~.,data=pine,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                 AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0  82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1  63.61896  0.38248575  0.0975  0.38248575 12.844390 11.074659
#> Nb_Comp_2  58.47638  0.34836456  0.0975 -0.05525570 11.686597  8.919303
#> Nb_Comp_3  56.55421  0.23688359  0.0975 -0.17107874 10.445206  7.919786
#> Nb_Comp_4  54.35053  0.06999681  0.0975 -0.21869112  9.651773  6.972542
#> Nb_Comp_5  55.99834 -0.07691053  0.0975 -0.15796434  8.073955  6.898523
#> Nb_Comp_6  57.69592 -0.19968885  0.0975 -0.11400977  7.685022  6.835594
#> Nb_Comp_7  59.37953 -0.27722139  0.0975 -0.06462721  7.277359  6.770369
#> Nb_Comp_8  61.21213 -0.30602578  0.0975 -0.02255238  6.923057  6.736112
#> Nb_Comp_9  63.18426 -0.39920228  0.0975 -0.07134354  7.216690  6.730426
#> Nb_Comp_10 65.15982 -0.43743644  0.0975 -0.02732569  6.914340  6.725443
#>                 R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0         NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1  0.4675684 0.4675684   17.03781     19.76046  0.38248575 0.0975
#> Nb_Comp_2  0.5711905 0.5711905   13.72190     17.97925 -0.05525570 0.0975
#> Nb_Comp_3  0.6192438 0.6192438   12.18420     16.06943 -0.17107874 0.0975
#> Nb_Comp_4  0.6647841 0.6647841   10.72691     14.84877 -0.21869112 0.0975
#> Nb_Comp_5  0.6683426 0.6683426   10.61304     12.42138 -0.15796434 0.0975
#> Nb_Comp_6  0.6713681 0.6713681   10.51622     11.82303 -0.11400977 0.0975
#> Nb_Comp_7  0.6745039 0.6745039   10.41588     11.19586 -0.06462721 0.0975
#> Nb_Comp_8  0.6761508 0.6761508   10.36317     10.65078 -0.02255238 0.0975
#> Nb_Comp_9  0.6764242 0.6764242   10.35443     11.10252 -0.07134354 0.0975
#> Nb_Comp_10 0.6766638 0.6766638   10.34676     10.63737 -0.02732569 0.0975
#>            Q2cum_residY  AIC.std   DoF.dof sigmahat.dof   AIC.dof   BIC.dof
#> Nb_Comp_0            NA 96.63448  1.000000    0.8062287 0.6697018 0.6991787
#> Nb_Comp_1    0.38248575 77.83455  3.176360    0.5994089 0.4047616 0.4565153
#> Nb_Comp_2    0.34836456 72.69198  7.133559    0.5761829 0.4138120 0.5212090
#> Nb_Comp_3    0.23688359 70.76981  8.778329    0.5603634 0.4070516 0.5320535
#> Nb_Comp_4    0.06999681 68.56612  8.427874    0.5221703 0.3505594 0.4547689
#> Nb_Comp_5   -0.07691053 70.21393  9.308247    0.5285695 0.3666578 0.4845912
#> Nb_Comp_6   -0.19968885 71.91152  9.291931    0.5259794 0.3629363 0.4795121
#> Nb_Comp_7   -0.27722139 73.59512  9.756305    0.5284535 0.3702885 0.4938445
#> Nb_Comp_8   -0.30602578 75.42772 10.363948    0.5338475 0.3831339 0.5170783
#> Nb_Comp_9   -0.39920228 77.39986 10.732136    0.5378275 0.3920954 0.5328742
#> Nb_Comp_10  -0.43743644 79.37542 11.000000    0.5407500 0.3987417 0.5446065
#>             GMDL.dof DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0  -3.605128         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1  -9.875081         2      0.5977015 0.3788984 0.4112998 -11.451340
#> Nb_Comp_2  -6.985517         3      0.5452615 0.3243383 0.3647862 -12.822703
#> Nb_Comp_3  -6.260610         4      0.5225859 0.3061986 0.3557368 -12.756838
#> Nb_Comp_4  -8.152986         5      0.4990184 0.2867496 0.3432131 -12.811575
#> Nb_Comp_5  -7.111583         6      0.5054709 0.3019556 0.3714754 -11.329638
#> Nb_Comp_6  -7.233043         7      0.5127450 0.3186757 0.4021333  -9.918688
#> Nb_Comp_7  -6.742195         8      0.5203986 0.3364668 0.4347156  -8.592770
#> Nb_Comp_8  -6.038372         9      0.5297842 0.3572181 0.4717708  -7.287834
#> Nb_Comp_9  -5.600249        10      0.5409503 0.3813021 0.5140048  -6.008747
#> Nb_Comp_10 -5.288422        11      0.5529032 0.4076026 0.5600977  -4.799453

data(pineNAX21)
bbb2 <- cv.plsRglm(round(x11)~.,data=pineNAX21,nt=10,
modele="pls-glm-family",family=poisson(log),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
bbb2 <- cv.plsRglm(round(x11)~.,data=pineNAX21,nt=10,
modele="pls-glm-poisson",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb2)
#>           [,1]         [,2]        [,3]      [,4]      [,5]      [,6]
#>  [1,] 14.17812 -0.005230476 -0.06774118 0.2197324 -1.514577 0.3002605
#>  [2,] 13.74608 -0.005154576 -0.07244439 0.1763920 -1.437786 0.2874352
#>  [3,] 12.82374 -0.004929634 -0.07286086 0.1745530 -1.420848 0.2854444
#>  [4,] 14.30507 -0.004766395 -0.06076299 0.2248998 -1.394961 0.2590979
#>  [5,] 10.55854 -0.004678915 -0.05434783 0.1403960 -1.550726 0.3241976
#>  [6,] 12.76132 -0.004789147 -0.07241394 0.1636974 -1.534710 0.3081461
#>  [7,] 15.70180 -0.004678565 -0.09532564 0.2377301 -2.155453 0.3932527
#>  [8,] 12.29905 -0.006570571 -0.03001120 0.0629270 -1.481772 0.3664853
#>  [9,] 17.78483 -0.006698541 -0.09385634 0.3124667 -2.129659 0.4339414
#> [10,] 18.62013 -0.005809424 -0.07433038 0.3564959 -1.851580 0.2610403
#>             [,7]        [,8]       [,9]      [,10]       [,11]
#>  [1,] -2.4670687  0.07665611 0.21096251 -1.2634377 -0.24046431
#>  [2,] -1.9699917 -0.23418030 0.22632403 -1.0738583 -0.27300149
#>  [3,] -1.8313099 -0.06219690 0.15403520 -1.0442356 -0.03129321
#>  [4,] -2.4485460 -0.19660348 0.21978299 -1.4741044 -0.33840957
#>  [5,] -1.0510197  0.32704599 0.03237768 -1.1982002  0.05667148
#>  [6,] -1.6781156 -0.01196100 0.17894245 -1.1057711 -0.12995736
#>  [7,] -2.8973335 -0.18218523 0.45665636 -1.4982575 -0.50027527
#>  [8,] -0.6205863  0.12720644 0.04049668 -0.9592392 -0.01514032
#>  [9,] -3.8708506  0.70696988 0.27784101 -0.9197113 -0.84286516
#> [10,] -4.2294527 -0.62146417 0.49789977 -1.8572147 -0.07411161
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 1.5289505 1.5925609 1.9521936 1.5314977 2.0614022 1.3224006 0.4816943
#> [8] 0.4126652 0.3986459
#> 
#> [[1]][[2]]
#> [1] 1.5408435 1.3643636 0.9029960 0.8694194 0.5010530 0.4319565 0.4700336
#> [8] 0.4507861 0.4521325
#> 
#> [[1]][[3]]
#> [1] 0.9805120 1.1496467 0.8739065 0.9473062 0.8974932 0.7021961 0.7233166
#> [8] 0.5874014 0.5855044
#> 
#> [[1]][[4]]
#> [1] 3.0800061 1.3982907 1.0046964 1.1267916 1.1057147 0.7555527 0.7299365
#> [8] 0.7181662 0.6924240
#> 
#> [[1]][[5]]
#> [1]   1.5390446   1.5192100   0.4953396   2.2603224   0.9926046  76.9215380
#> [7] 161.3597434 638.5118539 281.1224964
#> 
#> [[1]][[6]]
#> [1] 9.3803604 3.0474583 0.6131631 0.6458632 0.7946365 0.6351923 0.7149009
#> [8] 0.5498131 0.5539712
#> 
#> [[1]][[7]]
#> [1] 0.6916658 1.3612190 1.8844997 1.5962153 1.0408942 4.3452190 4.4238183
#> [8] 5.2622971 4.9129195
#> 
#> [[1]][[8]]
#> [1] 7.170841 9.769867 6.399021 6.826095 6.080845 8.620308 8.002867 9.726628
#> [9] 8.651987
#> 
#> [[1]][[9]]
#> [1]  5.584491  9.873378  9.340608  8.690502  9.364204 11.225930 16.715612
#> [8] 24.771868 25.459330
#> 
#> [[1]][[10]]
#> [1] 1.226124 3.508802 1.972384 3.665763 3.539139 5.742893 6.816920 5.629602
#> [9] 6.217330
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1]  32.72284  34.58480  25.43881  28.15977  26.37799 110.70319 200.43884
#> [8] 686.62108 329.04674
#> 
summary(bbb2)
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> 
#> Family: poisson 
#> Link function: log 
#> 
#> ____There are some NAs in X but not in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2    Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 76.61170 78.10821            NA     NA           NA                NA
#> Nb_Comp_1 65.74449 68.73751  3.043439e-02 0.0975   0.03043439          32.72284
#> Nb_Comp_2 62.35674 66.84626 -4.035479e-01 0.0975  -0.44760484          34.58480
#> Nb_Comp_3 62.39804 68.38407 -1.062451e+00 0.0975  -0.46945547          25.43881
#> Nb_Comp_4 64.08113 71.56366 -2.742946e+00 0.0975  -0.81480458          28.15977
#> Nb_Comp_5 65.63784 74.61689 -5.447907e+00 0.0975  -0.72268249          26.37799
#> Nb_Comp_6 67.18468 77.66024 -4.501746e+01 0.0975  -6.13680561         110.70319
#> Nb_Comp_7 68.61004 80.58210 -5.646799e+02 0.0975 -11.29272420         200.43884
#> Nb_Comp_8 70.54487 84.01344 -2.216830e+04 0.0975 -38.19054392         686.62108
#> Nb_Comp_9 72.37296 87.33803 -4.107928e+05 0.0975 -17.52984528         329.04674
#>           Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0       33.75000 24.545455        NA
#> Nb_Comp_1       23.89105 12.654950 0.4844280
#> Nb_Comp_2       17.31172  8.871122 0.6385839
#> Nb_Comp_3       15.51670  8.203709 0.6657748
#> Nb_Comp_4       15.31216  7.959332 0.6757309
#> Nb_Comp_5       15.51159  7.724832 0.6852846
#> Nb_Comp_6       16.30549  6.814620 0.7223673
#> Nb_Comp_7       17.52007  6.284737 0.7439552
#> Nb_Comp_8       17.75766  6.160827 0.7490034
#> Nb_Comp_9       18.30206  5.831059 0.7624383
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(x11~.,data=pineNAX21,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> ____There are some NAs in X but not in Y____
#> ____TypeVC____ standard ____
#> ____TypeVC____ standard ____unknown____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#>                AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0 82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1 63.69250  0.35639805  0.0975  0.35639805 13.387018 11.099368
#> Nb_Comp_2 58.35228  0.28395028  0.0975 -0.11256611 12.348781  8.885823
#> Nb_Comp_3 56.36553  0.07664889  0.0975 -0.28950699 11.458331  7.874634
#> Nb_Comp_4 54.02416 -0.70355579  0.0975 -0.84497074 14.528469  6.903925
#> Nb_Comp_5 55.80450 -0.94905654  0.0975 -0.14411078  7.898855  6.858120
#> Nb_Comp_6 57.45753 -1.27568315  0.0975 -0.16758190  8.007417  6.786392
#> Nb_Comp_7 58.73951 -1.63309014  0.0975 -0.15705481  7.852227  6.640327
#> Nb_Comp_8 60.61227 -1.67907859  0.0975 -0.01746558  6.756304  6.614773
#> Nb_Comp_9 62.25948 -2.15165796  0.0975 -0.17639623  7.781594  6.544432
#>                R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0        NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1 0.4663804 0.4663804   17.07583     20.59526  0.35639805 0.0975
#> Nb_Comp_2 0.5728001 0.5728001   13.67040     18.99799 -0.11256611 0.0975
#> Nb_Comp_3 0.6214146 0.6214146   12.11473     17.62807 -0.28950699 0.0975
#> Nb_Comp_4 0.6680830 0.6680830   10.62135     22.35133 -0.84497074 0.0975
#> Nb_Comp_5 0.6702851 0.6702851   10.55088     12.15200 -0.14411078 0.0975
#> Nb_Comp_6 0.6737336 0.6737336   10.44053     12.31901 -0.16758190 0.0975
#> Nb_Comp_7 0.6807558 0.6807558   10.21581     12.08026 -0.15705481 0.0975
#> Nb_Comp_8 0.6819844 0.6819844   10.17650     10.39424 -0.01746558 0.0975
#> Nb_Comp_9 0.6853661 0.6853661   10.06828     11.97160 -0.17639623 0.0975
#>           Q2cum_residY  AIC.std DoF.dof sigmahat.dof AIC.dof BIC.dof GMDL.dof
#> Nb_Comp_0           NA 96.63448      NA           NA      NA      NA       NA
#> Nb_Comp_1   0.35639805 77.90810      NA           NA      NA      NA       NA
#> Nb_Comp_2   0.28395028 72.56787      NA           NA      NA      NA       NA
#> Nb_Comp_3   0.07664889 70.58113      NA           NA      NA      NA       NA
#> Nb_Comp_4  -0.70355579 68.23976      NA           NA      NA      NA       NA
#> Nb_Comp_5  -0.94905654 70.02009      NA           NA      NA      NA       NA
#> Nb_Comp_6  -1.27568315 71.67313      NA           NA      NA      NA       NA
#> Nb_Comp_7  -1.63309014 72.95511      NA           NA      NA      NA       NA
#> Nb_Comp_8  -1.67907859 74.82787      NA           NA      NA      NA       NA
#> Nb_Comp_9  -2.15165796 76.47507      NA           NA      NA      NA       NA
#>           DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1         2      0.5983679 0.3797438 0.4122175 -11.413749
#> Nb_Comp_2         3      0.5442372 0.3231208 0.3634169 -12.847656
#> Nb_Comp_3         4      0.5210941 0.3044529 0.3537087 -12.776843
#> Nb_Comp_4         5      0.4965569 0.2839276 0.3398355 -12.891035
#> Nb_Comp_5         6      0.5039885 0.3001871 0.3692997 -11.349498
#> Nb_Comp_6         7      0.5108963 0.3163819 0.3992388  -9.922119
#> Nb_Comp_7         8      0.5153766 0.3300041 0.4263658  -8.696873
#> Nb_Comp_8         9      0.5249910 0.3507834 0.4632727  -7.337679
#> Nb_Comp_9        10      0.5334234 0.3707649 0.4998004  -6.033403
rm(list=c("bbb","bbb2"))



data(pine)
bbb <- cv.plsRglm(x11~.,data=pine,nt=10,modele="pls-glm-family",
family=Gamma,K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
bbb <- cv.plsRglm(x11~.,data=pine,nt=10,modele="pls-glm-Gamma",
K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: NaNs produced

#For Jackknife computations
kfolds2coeff(bbb)
#>             [,1]        [,2]         [,3]        [,4]     [,5]       [,6]
#>  [1,] -13.173619 0.006677447  0.042517878 -0.16293947 1.985625 -0.3860872
#>  [2,] -11.735168 0.005142871  0.045784694 -0.22023394 1.447601 -0.3144954
#>  [3,] -10.946283 0.005495380  0.055492663 -0.12585342 1.997781 -0.3955588
#>  [4,]  -9.223687 0.005123989  0.008291037 -0.04972942 1.240506 -0.2858821
#>  [5,] -10.151710 0.002264590  0.080308215 -0.17787660 2.904510 -0.5438798
#>  [6,] -14.012008 0.006007911  0.048336918 -0.21114454 1.595313 -0.3087197
#>  [7,] -12.935826 0.006582663  0.047722684 -0.14591369 1.508507 -0.2804157
#>  [8,] -10.381895 0.004888229  0.035166252 -0.13370163 1.416190 -0.2742712
#>  [9,] -10.062295 0.007194840 -0.013927913  0.03863044 1.525121 -0.3569883
#> [10,] -13.039663 0.006551674  0.054040042 -0.18141314 2.171460 -0.4257828
#>             [,7]       [,8]        [,9]     [,10]     [,11]
#>  [1,]  2.1418249 -0.5940495 -0.27942543 0.8789156 1.0568586
#>  [2,]  2.5810084 -0.2250062 -0.08976766 0.9697362 0.6495068
#>  [3,]  1.6157244 -0.3305841 -0.26988055 0.8471266 0.4982563
#>  [4,]  0.3937756  0.2421788  0.03717390 0.9937986 0.2325585
#>  [5,]  2.7551521 -0.6426580 -0.44139245 1.0978750 1.2015559
#>  [6,]  2.9408117  0.2774814 -0.31744290 1.0509036 0.8411089
#>  [7,]  1.6755802 -0.2800387 -0.28412838 1.5983087 0.5056057
#>  [8,]  1.6755317  0.2175169 -0.10581673 0.8128549 0.1643681
#>  [9,] -0.3905498 -0.1037357 -0.03330164 0.9101754 0.4973982
#> [10,]  2.6769606 -0.8493846 -0.34797857 0.6943200 1.0964959
boxplot(kfolds2coeff(bbb)[,1])


kfolds2Chisqind(bbb)
#> [[1]]
#> [[1]][[1]]
#>  [1] 1.0585257 0.9991077 1.9726188 1.9055372 2.0000809 1.5712449 2.3281288
#>  [8] 2.3647001 2.4249303 2.4242446
#> 
#> [[1]][[2]]
#>  [1] 1.461127 1.485736 1.760199 2.085968 1.392481 1.222855 1.209359 1.432313
#>  [9] 1.480878 1.477322
#> 
#> [[1]][[3]]
#>  [1] 1.062313 1.355869 1.861083 2.286751 3.183506 3.249475 3.234532 2.481551
#>  [9] 2.437241 2.390212
#> 
#> [[1]][[4]]
#>  [1] 1.0234253 0.9139301 0.9425680 1.0205683 1.1264343 0.9731045 0.9881081
#>  [8] 0.9918449 0.9355078 0.9352210
#> 
#> [[1]][[5]]
#>  [1]  6.534490  8.528102 11.675227 12.500263 16.005798 24.884212 28.076106
#>  [8] 21.245220 20.023951 20.011264
#> 
#> [[1]][[6]]
#>  [1] 0.8567764 1.1695078 1.8689295 2.6528268 3.7193860 1.1910807 0.5909276
#>  [8] 1.2841164 1.8033567 1.8381471
#> 
#> [[1]][[7]]
#>  [1] 3.753981 4.704498 5.180547 5.062577 5.254352 2.824364 3.270355 2.434914
#>  [9] 2.710749 2.572099
#> 
#> [[1]][[8]]
#>  [1] 1.917682 2.100384 4.217162 2.714633 2.584416 3.263973 1.789737 1.560568
#>  [9] 1.527111 1.533111
#> 
#> [[1]][[9]]
#>  [1] 2.553562 5.554071 5.812648 3.711965 3.868927 4.376719 6.135488 6.227217
#>  [9] 6.283402 6.476582
#> 
#> [[1]][[10]]
#>  [1] 2.559751 3.200140 3.800023 4.046532 4.207390 3.830599 4.065772 4.569778
#>  [9] 4.733585 4.736701
#> 
#> 
kfolds2Chisq(bbb)
#> [[1]]
#>  [1] 22.78163 30.01135 39.09101 37.98762 43.34277 47.38763 51.68851 44.59222
#>  [9] 44.36071 44.39490
#> 
summary(bbb)
#> ____************************************************____
#> 
#> Family: Gamma 
#> Link function: inverse 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                 AIC      BIC  Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0  56.60919 59.60220            NA     NA         NA                NA
#> Nb_Comp_1  39.01090 43.50042     0.2792458 0.0975  0.2792458          22.78163
#> Nb_Comp_2  37.30801 43.29404    -0.2493025 0.0975 -0.7333266          30.01135
#> Nb_Comp_3  36.87524 44.35777    -1.8709838 0.0975 -1.2980694          39.09101
#> Nb_Comp_4  36.55795 45.53700    -5.8877295 0.0975 -1.3990833          37.98762
#> Nb_Comp_5  37.13611 47.61167   -21.0698344 0.0975 -2.2042249          43.34277
#> Nb_Comp_6  38.27656 50.24862   -75.8454114 0.0975 -2.4819206          47.38763
#> Nb_Comp_7  39.39377 52.86234  -284.5198635 0.0975 -2.7155096          51.68851
#> Nb_Comp_8  40.96122 55.92630  -850.9843521 0.0975 -1.9839758          44.59222
#> Nb_Comp_9  42.90816 59.36974 -2476.4648675 0.0975 -1.9078760          44.36071
#> Nb_Comp_10 44.90815 62.86625 -7256.0904824 0.0975 -1.9292405          44.39490
#>            Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0        31.60805 20.800152        NA
#> Nb_Comp_1        17.31431 11.804594 0.4324756
#> Nb_Comp_2        17.01037  6.357437 0.6943562
#> Nb_Comp_3        15.83422  5.699662 0.7259798
#> Nb_Comp_4        13.52676  7.679741 0.6307844
#> Nb_Comp_5        13.60962  6.099077 0.7067773
#> Nb_Comp_6        13.91155  5.205052 0.7497590
#> Nb_Comp_7        14.94390  4.650377 0.7764258
#> Nb_Comp_8        15.25537  4.321314 0.7922461
#> Nb_Comp_9        15.15577  4.307757 0.7928978
#> Nb_Comp_10       15.15490  4.307391 0.7929154
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(x11~.,data=pine,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> ____Component____ 10 ____
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                 AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0  82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1  63.61896  0.38248575  0.0975  0.38248575 12.844390 11.074659
#> Nb_Comp_2  58.47638  0.34836456  0.0975 -0.05525570 11.686597  8.919303
#> Nb_Comp_3  56.55421  0.23688359  0.0975 -0.17107874 10.445206  7.919786
#> Nb_Comp_4  54.35053  0.06999681  0.0975 -0.21869112  9.651773  6.972542
#> Nb_Comp_5  55.99834 -0.07691053  0.0975 -0.15796434  8.073955  6.898523
#> Nb_Comp_6  57.69592 -0.19968885  0.0975 -0.11400977  7.685022  6.835594
#> Nb_Comp_7  59.37953 -0.27722139  0.0975 -0.06462721  7.277359  6.770369
#> Nb_Comp_8  61.21213 -0.30602578  0.0975 -0.02255238  6.923057  6.736112
#> Nb_Comp_9  63.18426 -0.39920228  0.0975 -0.07134354  7.216690  6.730426
#> Nb_Comp_10 65.15982 -0.43743644  0.0975 -0.02732569  6.914340  6.725443
#>                 R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0         NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1  0.4675684 0.4675684   17.03781     19.76046  0.38248575 0.0975
#> Nb_Comp_2  0.5711905 0.5711905   13.72190     17.97925 -0.05525570 0.0975
#> Nb_Comp_3  0.6192438 0.6192438   12.18420     16.06943 -0.17107874 0.0975
#> Nb_Comp_4  0.6647841 0.6647841   10.72691     14.84877 -0.21869112 0.0975
#> Nb_Comp_5  0.6683426 0.6683426   10.61304     12.42138 -0.15796434 0.0975
#> Nb_Comp_6  0.6713681 0.6713681   10.51622     11.82303 -0.11400977 0.0975
#> Nb_Comp_7  0.6745039 0.6745039   10.41588     11.19586 -0.06462721 0.0975
#> Nb_Comp_8  0.6761508 0.6761508   10.36317     10.65078 -0.02255238 0.0975
#> Nb_Comp_9  0.6764242 0.6764242   10.35443     11.10252 -0.07134354 0.0975
#> Nb_Comp_10 0.6766638 0.6766638   10.34676     10.63737 -0.02732569 0.0975
#>            Q2cum_residY  AIC.std   DoF.dof sigmahat.dof   AIC.dof   BIC.dof
#> Nb_Comp_0            NA 96.63448  1.000000    0.8062287 0.6697018 0.6991787
#> Nb_Comp_1    0.38248575 77.83455  3.176360    0.5994089 0.4047616 0.4565153
#> Nb_Comp_2    0.34836456 72.69198  7.133559    0.5761829 0.4138120 0.5212090
#> Nb_Comp_3    0.23688359 70.76981  8.778329    0.5603634 0.4070516 0.5320535
#> Nb_Comp_4    0.06999681 68.56612  8.427874    0.5221703 0.3505594 0.4547689
#> Nb_Comp_5   -0.07691053 70.21393  9.308247    0.5285695 0.3666578 0.4845912
#> Nb_Comp_6   -0.19968885 71.91152  9.291931    0.5259794 0.3629363 0.4795121
#> Nb_Comp_7   -0.27722139 73.59512  9.756305    0.5284535 0.3702885 0.4938445
#> Nb_Comp_8   -0.30602578 75.42772 10.363948    0.5338475 0.3831339 0.5170783
#> Nb_Comp_9   -0.39920228 77.39986 10.732136    0.5378275 0.3920954 0.5328742
#> Nb_Comp_10  -0.43743644 79.37542 11.000000    0.5407500 0.3987417 0.5446065
#>             GMDL.dof DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0  -3.605128         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1  -9.875081         2      0.5977015 0.3788984 0.4112998 -11.451340
#> Nb_Comp_2  -6.985517         3      0.5452615 0.3243383 0.3647862 -12.822703
#> Nb_Comp_3  -6.260610         4      0.5225859 0.3061986 0.3557368 -12.756838
#> Nb_Comp_4  -8.152986         5      0.4990184 0.2867496 0.3432131 -12.811575
#> Nb_Comp_5  -7.111583         6      0.5054709 0.3019556 0.3714754 -11.329638
#> Nb_Comp_6  -7.233043         7      0.5127450 0.3186757 0.4021333  -9.918688
#> Nb_Comp_7  -6.742195         8      0.5203986 0.3364668 0.4347156  -8.592770
#> Nb_Comp_8  -6.038372         9      0.5297842 0.3572181 0.4717708  -7.287834
#> Nb_Comp_9  -5.600249        10      0.5409503 0.3813021 0.5140048  -6.008747
#> Nb_Comp_10 -5.288422        11      0.5529032 0.4076026 0.5600977  -4.799453

data(pineNAX21)
bbb2 <- cv.plsRglm(x11~.,data=pineNAX21,nt=10,
modele="pls-glm-family",family=Gamma(),K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: NaNs produced
#> Warning: NaNs produced
bbb2 <- cv.plsRglm(x11~.,data=pineNAX21,nt=10,
modele="pls-glm-Gamma",K=10,keepcoeffs=TRUE,keepfolds=FALSE,verbose=FALSE)
#> Warning: NaNs produced

#For Jackknife computations
kfolds2coeff(bbb2)
#>            [,1]        [,2]         [,3]       [,4]     [,5]       [,6]
#>  [1,] -12.91100 0.005251000  0.040490530 -0.1339123 1.644353 -0.3246099
#>  [2,] -19.82772 0.007631965  0.022544875 -0.3847771 1.461768 -0.2891962
#>  [3,] -13.15140 0.005686905  0.039489222 -0.1255536 1.635658 -0.3218924
#>  [4,] -15.34328 0.004486669  0.075923175 -0.2845918 2.636493 -0.5188090
#>  [5,] -10.93635 0.006747883 -0.005860481  0.1148953 1.645124 -0.3492525
#>  [6,] -11.34405 0.005538041  0.050647429 -0.1110723 1.859513 -0.4007993
#>  [7,] -16.71860 0.006818613  0.032397057 -0.2196988 1.937209 -0.3412398
#>  [8,] -18.97840 0.007720508  0.075056762 -0.1796951 1.586762 -0.3658084
#>  [9,] -14.27317 0.005779660  0.033007765 -0.1822174 1.208638 -0.2718649
#> [10,] -14.21085 0.005993576  0.055166329 -0.1536767 2.088881 -0.4448327
#>            [,7]        [,8]        [,9]     [,10]     [,11]
#>  [1,]  1.998982 -0.31343943 -0.23599069 0.7865101 0.6704110
#>  [2,]  4.468033 -0.38420871 -0.30134746 2.1639821 1.1410805
#>  [3,]  1.819989 -0.08632609 -0.20258386 0.5621083 0.5236758
#>  [4,]  3.984910 -0.74074695 -0.35229867 0.8023131 1.0721726
#>  [5,] -1.238238 -0.12042341 -0.07840309 0.7307678 0.3784195
#>  [6,]  1.317903  0.27599629 -0.13951216 0.9802826 0.1968779
#>  [7,]  3.007056 -0.67047955 -0.39834339 1.2696928 1.1665743
#>  [8,]  2.022412  0.72221181  0.02163784 0.7783155 0.2535740
#>  [9,]  2.455751  0.08430124 -0.07563536 0.6460857 0.7453452
#> [10,]  2.213821 -0.60048290 -0.17904142 0.3787401 0.9824204
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 3.9371826 4.4708393 2.5054741 1.0993005 1.3778069 0.7419117 0.5612159
#> [8] 0.5381707 0.5455064
#> 
#> [[1]][[2]]
#> [1] 1.311916 1.518485 2.733826 3.582409 2.772711 2.695031 2.632541 4.003297
#> [9] 4.837576
#> 
#> [[1]][[3]]
#> [1] 2.049480 1.922976 3.714687 2.217064 3.103929 2.018291 2.131175 1.585846
#> [9] 1.555532
#> 
#> [[1]][[4]]
#> [1] 1.6810798 1.4757565 0.9418407 2.0176278 5.7419296 7.4085125 8.8245493
#> [8] 9.7931899 9.9542326
#> 
#> [[1]][[5]]
#> [1] 2.440516 4.656093 4.393066 2.513263 2.983630 5.075258 6.106783 6.677627
#> [9] 6.820042
#> 
#> [[1]][[6]]
#> [1]   1.908987   3.273723   4.945917  15.024482  10.652001 109.921758  50.594962
#> [8]  38.438216  47.985543
#> 
#> [[1]][[7]]
#> [1] 1.7119819 2.5045087 3.0359355 2.2460831 0.9686353 0.8305814 1.0663750
#> [8] 1.1744936 1.3659570
#> 
#> [[1]][[8]]
#> [1]  1.597159  2.000062  9.617053 12.167949 10.559373  9.855643  7.952061
#> [8] 14.787531  9.023308
#> 
#> [[1]][[9]]
#> [1] 1.5418192 1.4679798 1.6860910 1.5547721 1.5869767 1.0340153 0.9203079
#> [8] 0.8502838 0.9299212
#> 
#> [[1]][[10]]
#> [1] 1.936021 2.575927 2.681791 2.867732 2.990665 3.408721 3.912138 4.345005
#> [9] 4.424486
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1]  20.11614  25.86635  36.25568  45.29068  42.73766 142.98972  84.70211
#> [8]  82.19366  87.44211
#> 
summary(bbb2)
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> 
#> Family: Gamma 
#> Link function: inverse 
#> 
#> ____There are some NAs in X but not in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 56.60919 59.60220            NA     NA         NA                NA
#> Nb_Comp_1 39.08940 43.57892  3.635753e-01 0.0975  0.3635753          20.11614
#> Nb_Comp_2 37.36154 43.34757  4.892922e-02 0.0975 -0.4943963          25.86635
#> Nb_Comp_3 36.81173 44.29427 -1.016050e+00 0.0975 -1.1197690          36.25568
#> Nb_Comp_4 36.53654 45.51559 -4.784209e+00 0.0975 -1.8690797          45.29068
#> Nb_Comp_5 37.24312 47.71867 -1.732478e+01 0.0975 -2.1680695          42.73766
#> Nb_Comp_6 38.18649 50.15855 -1.921033e+02 0.0975 -9.5378275         142.98972
#> Nb_Comp_7 39.35575 52.82432 -1.165392e+03 0.0975 -5.0402501          84.70211
#> Nb_Comp_8 40.86209 55.82716 -6.365312e+03 0.0975 -4.4581221          82.19366
#> Nb_Comp_9 42.80511 59.26669 -3.642995e+04 0.0975 -4.7224568          87.44211
#>           Chi2_Pearson_Y     RSS_Y      R2_Y
#> Nb_Comp_0       31.60805 20.800152        NA
#> Nb_Comp_1       17.30890 12.031518 0.4215659
#> Nb_Comp_2       17.10360  6.183372 0.7027247
#> Nb_Comp_3       15.78579  5.756462 0.7232490
#> Nb_Comp_4       13.49013  7.630460 0.6331536
#> Nb_Comp_5       13.56918  6.303455 0.6969515
#> Nb_Comp_6       14.02295  5.274716 0.7464097
#> Nb_Comp_7       15.05896  4.867806 0.7659726
#> Nb_Comp_8       15.28052  4.317488 0.7924300
#> Nb_Comp_9       15.19429  4.298593 0.7933384
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(x11~.,data=pineNAX21,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> ____There are some NAs in X but not in Y____
#> ____TypeVC____ standard ____
#> ____TypeVC____ standard ____unknown____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> ____Component____ 7 ____
#> ____Component____ 8 ____
#> ____Component____ 9 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 9 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#>                AIC     Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y     RSS_Y
#> Nb_Comp_0 82.41888          NA      NA          NA        NA 20.800152
#> Nb_Comp_1 63.69250  0.35639805  0.0975  0.35639805 13.387018 11.099368
#> Nb_Comp_2 58.35228  0.28395028  0.0975 -0.11256611 12.348781  8.885823
#> Nb_Comp_3 56.36553  0.07664889  0.0975 -0.28950699 11.458331  7.874634
#> Nb_Comp_4 54.02416 -0.70355579  0.0975 -0.84497074 14.528469  6.903925
#> Nb_Comp_5 55.80450 -0.94905654  0.0975 -0.14411078  7.898855  6.858120
#> Nb_Comp_6 57.45753 -1.27568315  0.0975 -0.16758190  8.007417  6.786392
#> Nb_Comp_7 58.73951 -1.63309014  0.0975 -0.15705481  7.852227  6.640327
#> Nb_Comp_8 60.61227 -1.67907859  0.0975 -0.01746558  6.756304  6.614773
#> Nb_Comp_9 62.25948 -2.15165796  0.0975 -0.17639623  7.781594  6.544432
#>                R2_Y R2_residY RSS_residY PRESS_residY   Q2_residY  LimQ2
#> Nb_Comp_0        NA        NA   32.00000           NA          NA     NA
#> Nb_Comp_1 0.4663804 0.4663804   17.07583     20.59526  0.35639805 0.0975
#> Nb_Comp_2 0.5728001 0.5728001   13.67040     18.99799 -0.11256611 0.0975
#> Nb_Comp_3 0.6214146 0.6214146   12.11473     17.62807 -0.28950699 0.0975
#> Nb_Comp_4 0.6680830 0.6680830   10.62135     22.35133 -0.84497074 0.0975
#> Nb_Comp_5 0.6702851 0.6702851   10.55088     12.15200 -0.14411078 0.0975
#> Nb_Comp_6 0.6737336 0.6737336   10.44053     12.31901 -0.16758190 0.0975
#> Nb_Comp_7 0.6807558 0.6807558   10.21581     12.08026 -0.15705481 0.0975
#> Nb_Comp_8 0.6819844 0.6819844   10.17650     10.39424 -0.01746558 0.0975
#> Nb_Comp_9 0.6853661 0.6853661   10.06828     11.97160 -0.17639623 0.0975
#>           Q2cum_residY  AIC.std DoF.dof sigmahat.dof AIC.dof BIC.dof GMDL.dof
#> Nb_Comp_0           NA 96.63448      NA           NA      NA      NA       NA
#> Nb_Comp_1   0.35639805 77.90810      NA           NA      NA      NA       NA
#> Nb_Comp_2   0.28395028 72.56787      NA           NA      NA      NA       NA
#> Nb_Comp_3   0.07664889 70.58113      NA           NA      NA      NA       NA
#> Nb_Comp_4  -0.70355579 68.23976      NA           NA      NA      NA       NA
#> Nb_Comp_5  -0.94905654 70.02009      NA           NA      NA      NA       NA
#> Nb_Comp_6  -1.27568315 71.67313      NA           NA      NA      NA       NA
#> Nb_Comp_7  -1.63309014 72.95511      NA           NA      NA      NA       NA
#> Nb_Comp_8  -1.67907859 74.82787      NA           NA      NA      NA       NA
#> Nb_Comp_9  -2.15165796 76.47507      NA           NA      NA      NA       NA
#>           DoF.naive sigmahat.naive AIC.naive BIC.naive GMDL.naive
#> Nb_Comp_0         1      0.8062287 0.6697018 0.6991787  -3.605128
#> Nb_Comp_1         2      0.5983679 0.3797438 0.4122175 -11.413749
#> Nb_Comp_2         3      0.5442372 0.3231208 0.3634169 -12.847656
#> Nb_Comp_3         4      0.5210941 0.3044529 0.3537087 -12.776843
#> Nb_Comp_4         5      0.4965569 0.2839276 0.3398355 -12.891035
#> Nb_Comp_5         6      0.5039885 0.3001871 0.3692997 -11.349498
#> Nb_Comp_6         7      0.5108963 0.3163819 0.3992388  -9.922119
#> Nb_Comp_7         8      0.5153766 0.3300041 0.4263658  -8.696873
#> Nb_Comp_8         9      0.5249910 0.3507834 0.4632727  -7.337679
#> Nb_Comp_9        10      0.5334234 0.3707649 0.4998004  -6.033403
rm(list=c("bbb","bbb2"))



data(Cornell)
summary(cv.plsRglm(Y~.,data=Cornell,nt=10,NK=1,modele="pls",verbose=FALSE))
#> ____************************************************____
#> 
#> Model: pls 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC    Q2cum_Y LimQ2_Y        Q2_Y  PRESS_Y      RSS_Y      R2_Y
#> Nb_Comp_0 82.01205         NA      NA          NA       NA 467.796667        NA
#> Nb_Comp_1 53.15173  0.9225085  0.0975  0.92250846 36.25028  35.742486 0.9235940
#> Nb_Comp_2 41.08283  0.9260227  0.0975  0.04535062 34.12154  11.066606 0.9763431
#> Nb_Comp_3 32.06411  0.8961391  0.0975 -0.40395670 15.53704   4.418081 0.9905556
#> Nb_Comp_4 33.76477  0.2164992  0.0975 -6.54375401 33.32892   4.309235 0.9907882
#> Nb_Comp_5 33.34373 -5.7376025  0.0975 -7.59935654 37.05665   3.521924 0.9924713
#> Nb_Comp_6 35.25533         NA  0.0975          NA       NA   3.496074 0.9925265
#>              AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof GMDL.dof
#> Nb_Comp_0  37.010388 1.000000    6.5212706 46.0708838 47.7893514 27.59461
#> Nb_Comp_1   8.150064 2.740749    1.8665281  4.5699686  4.9558156 21.34020
#> Nb_Comp_2  -3.918831 5.085967    1.1825195  2.1075461  2.3949331 27.40202
#> Nb_Comp_3 -12.937550 5.121086    0.7488308  0.8467795  0.9628191 24.40842
#> Nb_Comp_4 -11.236891 5.103312    0.7387162  0.8232505  0.9357846 24.23105
#> Nb_Comp_5 -11.657929 6.006316    0.7096382  0.7976101  0.9198348 28.21184
#> Nb_Comp_6  -9.746328 7.000002    0.7633343  0.9711322  1.1359501 33.18348
#>           DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6         7      0.8361907  1.1070902  1.3048716   33.63927
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRmodel"

cv.plsRglm(Y~.,data=Cornell,nt=3,
modele="pls-glm-inverse.gaussian",K=12,verbose=FALSE)
#> Number of repeated crossvalidations:
#> [1] 1
#> Number of folds for each crossvalidation:
#> [1] 12
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",family=inverse.gaussian,K=12,verbose=FALSE)
#> Number of repeated crossvalidations:
#> [1] 1
#> Number of folds for each crossvalidation:
#> [1] 12
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-inverse.gaussian",K=6,
NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 3  95.03541 97.95611 97.96361
#> 11 82.63660 81.45836 82.07905
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 7 81.85234 81.83027 81.82584
#> 6 93.64727 92.15930 92.37209
#> 
#> [[1]][[3]]
#>        [,1]     [,2]     [,3]
#> 12 86.95192 89.39536 89.96552
#> 5  87.39911 88.86951 86.84356
#> 
#> [[1]][[4]]
#>       [,1]     [,2]     [,3]
#> 4 94.47572 93.13652 92.02753
#> 1 94.09586 95.21985 95.90520
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 9 81.86542 82.38830 82.43308
#> 8 82.07010 82.52511 82.48277
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 10 82.44556 82.92749 83.04063
#> 2  96.14439 97.88015 97.95865
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 10 82.35888 83.04357 83.02591
#> 7  81.66306 81.74072 81.79826
#> 
#> [[2]][[2]]
#>       [,1]     [,2]     [,3]
#> 8 82.24235 82.35979 82.49361
#> 3 95.54239 98.04545 98.06654
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 2 97.09841 98.35471 97.69241
#> 4 95.14378 92.16193 91.45998
#> 
#> [[2]][[4]]
#>        [,1]     [,2]     [,3]
#> 12 86.95192 89.39536 89.96552
#> 5  87.39911 88.86951 86.84356
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 6  94.15649 92.49562 92.41182
#> 11 82.51704 82.52189 82.31869
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 1 93.67092 95.01013 96.02979
#> 9 82.11977 82.40273 82.50324
#> 
#> 
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",
family=inverse.gaussian(),K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 2  96.14439 97.88015 97.95865
#> 10 82.44556 82.92749 83.04063
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 9 82.11977 82.40273 82.50324
#> 1 93.67092 95.01013 96.02979
#> 
#> [[1]][[3]]
#>       [,1]     [,2]    [,3]
#> 4 95.61777 92.38878 92.0582
#> 3 96.61339 98.57737 98.3464
#> 
#> [[1]][[4]]
#>       [,1]     [,2]     [,3]
#> 6 93.14888 91.74712 92.43230
#> 5 88.39491 88.16441 85.28231
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 7 81.64544 81.62066 81.69732
#> 8 82.13328 82.44652 82.46367
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 12 87.54766 87.52369 89.40288
#> 11 82.41674 82.38616 81.93566
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>       [,1]     [,2]     [,3]
#> 1 93.69623 94.94396 95.94943
#> 7 81.90468 81.80099 81.86165
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 3  95.57967 98.07234 98.07855
#> 10 82.42733 82.91391 83.08196
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 5 88.06746 88.53727 85.25048
#> 8 82.44673 82.50563 82.40858
#> 
#> [[2]][[4]]
#>        [,1]     [,2]     [,3]
#> 11 82.51704 82.52189 82.31869
#> 6  94.15649 92.49562 92.41182
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 2  95.94380 98.36164 98.28510
#> 12 87.18968 88.98872 88.53361
#> 
#> [[2]][[6]]
#>       [,1]     [,2]     [,3]
#> 9 82.06647 82.55843 82.55524
#> 4 95.36489 92.51571 91.52622
#> 
#> 
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-inverse.gaussian",K=6,
NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 11 82.56310 81.59883 82.15787
#> 2  95.74052 97.89405 98.00186
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 5 88.06746 88.53727 85.25048
#> 8 82.44673 82.50563 82.40858
#> 
#> [[1]][[3]]
#>       [,1]     [,2]     [,3]
#> 6 93.64727 92.15930 92.37209
#> 7 81.85234 81.83027 81.82584
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 12 86.83575 86.59791 88.12756
#> 1  93.48074 94.34564 96.46141
#> 
#> [[1]][[5]]
#>        [,1]     [,2]     [,3]
#> 10 82.42733 82.91391 83.08196
#> 3  95.57967 98.07234 98.07855
#> 
#> [[1]][[6]]
#>       [,1]     [,2]     [,3]
#> 4 95.36489 92.51571 91.52622
#> 9 82.06647 82.55843 82.55524
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 1  93.48074 94.34564 96.46141
#> 12 86.83575 86.59791 88.12756
#> 
#> [[2]][[2]]
#>        [,1]     [,2]     [,3]
#> 11 82.09986 81.91098 82.20593
#> 8  82.34082 82.65220 82.70685
#> 
#> [[2]][[3]]
#>       [,1]    [,2]     [,3]
#> 3 95.69562 97.8202 98.24510
#> 5 87.61323 89.0497 85.81831
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 4 95.44676 92.43331 91.48325
#> 7 81.79505 81.83779 81.76982
#> 
#> [[2]][[5]]
#>       [,1]     [,2]     [,3]
#> 2 96.05821 97.84569 97.96973
#> 9 82.19603 82.39724 82.56306
#> 
#> [[2]][[6]]
#>        [,1]     [,2]     [,3]
#> 10 82.56492 82.99060 82.94155
#> 6  93.25013 92.42267 92.24201
#> 
#> 
cv.plsRglm(Y~.,data=Cornell,nt=3,modele="pls-glm-family",
family=inverse.gaussian(link = "1/mu^2"),K=6,NK=2,verbose=FALSE)$results_kfolds
#> [[1]]
#> [[1]][[1]]
#>        [,1]     [,2]     [,3]
#> 3  95.03541 97.95611 97.96361
#> 11 82.63660 81.45836 82.07905
#> 
#> [[1]][[2]]
#>       [,1]     [,2]     [,3]
#> 2 96.97257 97.56815 97.41466
#> 6 93.60394 92.25570 92.59526
#> 
#> [[1]][[3]]
#>       [,1]     [,2]     [,3]
#> 4 95.96203 92.91269 90.22726
#> 5 88.58623 88.32200 84.41198
#> 
#> [[1]][[4]]
#>        [,1]     [,2]     [,3]
#> 1  93.66264 95.12181 96.09819
#> 10 82.55172 83.05563 83.04611
#> 
#> [[1]][[5]]
#>       [,1]     [,2]     [,3]
#> 7 81.79662 81.77255 81.88023
#> 9 82.08282 82.45580 82.57525
#> 
#> [[1]][[6]]
#>        [,1]     [,2]     [,3]
#> 12 87.40306 87.79647 89.48632
#> 8  82.18031 82.59243 82.48103
#> 
#> 
#> [[2]]
#> [[2]][[1]]
#>        [,1]     [,2]     [,3]
#> 11 82.55067 81.50479 82.43491
#> 5  88.10011 88.46379 84.99179
#> 
#> [[2]][[2]]
#>       [,1]     [,2]     [,3]
#> 2 97.09841 98.35471 97.69241
#> 4 95.14378 92.16193 91.45998
#> 
#> [[2]][[3]]
#>       [,1]     [,2]     [,3]
#> 9 82.19302 82.34852 82.55782
#> 3 95.46823 98.02292 98.06887
#> 
#> [[2]][[4]]
#>       [,1]     [,2]     [,3]
#> 7 81.90468 81.80099 81.86165
#> 1 93.69623 94.94396 95.94943
#> 
#> [[2]][[5]]
#>        [,1]     [,2]     [,3]
#> 6  93.25013 92.42267 92.24201
#> 10 82.56492 82.99060 82.94155
#> 
#> [[2]][[6]]
#>        [,1]     [,2]     [,3]
#> 12 87.40306 87.79647 89.48632
#> 8  82.18031 82.59243 82.48103
#> 
#> 

bbb2 <- cv.plsRglm(Y~.,data=Cornell,nt=10,
modele="pls-glm-inverse.gaussian",keepcoeffs=TRUE,verbose=FALSE)

#For Jackknife computations
kfolds2coeff(bbb2)
#>               [,1]          [,2]          [,3]          [,4]          [,5]
#> [1,]  0.0013120746 -7.179339e-04 -1.175196e-03 -1.873823e-03 -1.150028e-03
#> [2,]  0.0001360114  1.701315e-05 -3.293250e-06  2.892236e-05 -1.002546e-07
#> [3,]  0.0010111891 -4.700264e-04 -8.780103e-04 -1.464078e-03 -8.579996e-04
#> [4,] -0.0011925343  1.162001e-03  1.325378e-03  1.788652e-03  1.355736e-03
#> [5,] -0.0001254118  1.387224e-03  2.597707e-04 -1.730888e-03  2.213965e-04
#>               [,6]          [,7]          [,8]
#> [1,] -1.154620e-03 -1.218259e-03 -1.249177e-03
#> [2,] -2.817871e-05 -3.979963e-05  9.738007e-05
#> [3,] -8.807565e-04 -9.146021e-04 -9.214839e-04
#> [4,]  1.341529e-03  1.293208e-03  1.145454e-03
#> [5,]  2.322237e-04  1.983948e-04  7.309390e-04
boxplot(kfolds2coeff(bbb2)[,1])


kfolds2Chisqind(bbb2)
#> [[1]]
#> [[1]][[1]]
#> [1] 2.279797e-05 5.545424e-06 1.258253e-05 1.159566e-05 1.179754e-05
#> [6] 1.309357e-05
#> 
#> [[1]][[2]]
#> [1] 4.904837e-05 2.288347e-05 1.140830e-05 1.012226e-05 1.139760e-05
#> 
#> [[1]][[3]]
#> [1] 1.899874e-06 3.303764e-08 7.422010e-08 8.168989e-08 1.584012e-07
#> [6] 2.843836e-07
#> 
#> [[1]][[4]]
#> [1] 2.251429e-06 5.934093e-07 3.364749e-06 5.522248e-06 4.900298e-06
#> [6] 5.997593e-06
#> 
#> [[1]][[5]]
#> [1] 1.033277e-05 2.330784e-06 2.687605e-06 2.617032e-06 1.499733e-05
#> [6] 1.241100e-05
#> 
#> 
kfolds2Chisq(bbb2)
#> [[1]]
#> [1] 8.633042e-05 3.138612e-05 3.011740e-05 2.993889e-05 4.325117e-05
#> 
summary(bbb2)
#> ____************************************************____
#> 
#> Family: inverse.gaussian 
#> Link function: 1/mu^2 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 81.67928 82.64909           NA     NA          NA                NA
#> Nb_Comp_1 49.90521 51.35993    0.8717189 0.0975   0.8717189      8.633042e-05
#> Nb_Comp_2 31.06918 33.00881    0.8982675 0.0975   0.2069565      3.138612e-05
#> Nb_Comp_3 28.40632 30.83085    0.5628875 0.0975  -3.2966840      3.011740e-05
#> Nb_Comp_4 27.08522 29.99466   -1.7680378 0.0975  -5.3325523      2.993889e-05
#> Nb_Comp_5 28.46056 31.85490  -32.4010392 0.0975 -11.0666848      4.325117e-05
#> Nb_Comp_6 29.68366 33.56292           NA 0.0975          NA                NA
#>           Chi2_Pearson_Y      RSS_Y      R2_Y
#> Nb_Comp_0   6.729783e-04 467.796667        NA
#> Nb_Comp_1   3.957680e-05  32.478677 0.9305710
#> Nb_Comp_2   7.009452e-06   6.020269 0.9871306
#> Nb_Comp_3   4.727777e-06   3.795855 0.9918857
#> Nb_Comp_4   3.584346e-06   2.699884 0.9942285
#> Nb_Comp_5   3.408069e-06   2.598572 0.9944451
#> Nb_Comp_6   3.195402e-06   2.492371 0.9946721
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
PLS_lm_formula(Y~.,data=Cornell,10,typeVC="standard")$InfCrit
#> ____************************************************____
#> ____TypeVC____ standard ____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> ____Component____ 5 ____
#> ____Component____ 6 ____
#> Warning : 1 2 3 4 5 6 7 < 10^{-12}
#> Warning only 6 components could thus be extracted
#> ____Predicting X without NA neither in X nor in Y____
#> ****________________________________________________****
#> 
#>                AIC   Q2cum_Y LimQ2_Y        Q2_Y   PRESS_Y      RSS_Y      R2_Y
#> Nb_Comp_0 82.01205        NA      NA          NA        NA 467.796667        NA
#> Nb_Comp_1 53.15173 0.8966556  0.0975  0.89665563 48.344150  35.742486 0.9235940
#> Nb_Comp_2 41.08283 0.9175426  0.0975  0.20210989 28.518576  11.066606 0.9763431
#> Nb_Comp_3 32.06411 0.9399676  0.0975  0.27195907  8.056942   4.418081 0.9905556
#> Nb_Comp_4 33.76477 0.9197009  0.0975 -0.33759604  5.909608   4.309235 0.9907882
#> Nb_Comp_5 33.34373 0.9281373  0.0975  0.10506161  3.856500   3.521924 0.9924713
#> Nb_Comp_6 35.25533 0.9232562  0.0975 -0.06792167  3.761138   3.496074 0.9925265
#>           R2_residY  RSS_residY PRESS_residY   Q2_residY  LimQ2 Q2cum_residY
#> Nb_Comp_0        NA 11.00000000           NA          NA     NA           NA
#> Nb_Comp_1 0.9235940  0.84046633   1.13678803  0.89665563 0.0975    0.8966556
#> Nb_Comp_2 0.9763431  0.26022559   0.67059977  0.20210989 0.0975    0.9175426
#> Nb_Comp_3 0.9905556  0.10388893   0.18945488  0.27195907 0.0975    0.9399676
#> Nb_Comp_4 0.9907882  0.10132947   0.13896142 -0.33759604 0.0975    0.9197009
#> Nb_Comp_5 0.9924713  0.08281624   0.09068364  0.10506161 0.0975    0.9281373
#> Nb_Comp_6 0.9925265  0.08220840   0.08844125 -0.06792167 0.0975    0.9232562
#>              AIC.std  DoF.dof sigmahat.dof    AIC.dof    BIC.dof GMDL.dof
#> Nb_Comp_0  37.010388 1.000000    6.5212706 46.0708838 47.7893514 27.59461
#> Nb_Comp_1   8.150064 2.740749    1.8665281  4.5699686  4.9558156 21.34020
#> Nb_Comp_2  -3.918831 5.085967    1.1825195  2.1075461  2.3949331 27.40202
#> Nb_Comp_3 -12.937550 5.121086    0.7488308  0.8467795  0.9628191 24.40842
#> Nb_Comp_4 -11.236891 5.103312    0.7387162  0.8232505  0.9357846 24.23105
#> Nb_Comp_5 -11.657929 6.006316    0.7096382  0.7976101  0.9198348 28.21184
#> Nb_Comp_6  -9.746328 7.000002    0.7633343  0.9711322  1.1359501 33.18348
#>           DoF.naive sigmahat.naive  AIC.naive  BIC.naive GMDL.naive
#> Nb_Comp_0         1      6.5212706 46.0708838 47.7893514   27.59461
#> Nb_Comp_1         2      1.8905683  4.1699567  4.4588195   18.37545
#> Nb_Comp_2         3      1.1088836  1.5370286  1.6860917   17.71117
#> Nb_Comp_3         4      0.7431421  0.7363469  0.8256118   19.01033
#> Nb_Comp_4         5      0.7846050  0.8721072  0.9964867   24.16510
#> Nb_Comp_5         6      0.7661509  0.8804809  1.0227979   28.64206
#> Nb_Comp_6         7      0.8361907  1.1070902  1.3048716   33.63927
rm(list=c("bbb","bbb2"))
#> Warning: object 'bbb' not found


data(bordeaux)
summary(cv.plsRglm(Quality~.,data=bordeaux,10,
modele="pls-glm-polr",K=7))
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> NK: 1 
#> Number of groups : 7 
#> 1 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> 2 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> 3 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> 4 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> 5 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> 6 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> 7 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Predicting X without NA neither in X nor in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ****________________________________________________****
#> 
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> ____Component____ 4 ____
#> Warning : 1 2 3 4 < 10^{-12}
#> Warning only 4 components could thus be extracted
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 78.64736 81.70009            NA     NA          NA                NA
#> Nb_Comp_1 36.50286 41.08194 -8.963752e-01 0.0975  -0.8963752          118.2074
#> Nb_Comp_2 35.58058 41.68602 -1.960581e+01 0.0975  -9.8658912          101.6669
#> Nb_Comp_3 36.26588 43.89768 -6.689706e+02 0.0975 -31.5136807          278.6083
#> Nb_Comp_4 38.15799 47.31616 -2.276164e+04 0.0975 -32.9755765          281.3521
#>           Chi2_Pearson_Y
#> Nb_Comp_0      62.333333
#> Nb_Comp_1       9.356521
#> Nb_Comp_2       8.568956
#> Nb_Comp_3       8.281011
#> Nb_Comp_4       8.321689
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"

data(bordeauxNA)
summary(cv.plsRglm(Quality~.,data=bordeauxNA,
10,modele="pls-glm-polr",K=10,verbose=FALSE))
#> ____************************************************____
#> Only naive DoF can be used with missing data
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____There are some NAs in X but not in Y____
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Component____ 3 ____
#> Warning : reciprocal condition number of t(cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE])%*%cbind(res$pp,temppp)[XXNA[1,],,drop=FALSE] < 10^{-12}
#> Warning only 3 components could thus be extracted
#> ____Predicting X with NA in X and not in Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 78.64736 81.70009           NA     NA         NA                NA
#> Nb_Comp_1 36.21263 40.79171    -1.120956 0.0975  -1.120956         132.20629
#> Nb_Comp_2 35.29582 41.40126   -19.917123 0.0975  -8.862118          93.23701
#> Nb_Comp_3 35.81623 43.44803  -337.177365 0.0975 -15.167490         133.13401
#>           Chi2_Pearson_Y
#> Nb_Comp_0      62.333333
#> Nb_Comp_1       9.454055
#> Nb_Comp_2       8.234674
#> Nb_Comp_3       7.803408
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"

summary(cv.plsRglm(Quality~.,data=bordeaux,nt=2,K=7,
modele="pls-glm-polr",method="logistic",verbose=FALSE))
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: logistic 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2   Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 78.64736 81.70009           NA     NA          NA                NA
#> Nb_Comp_1 36.50286 41.08194   -0.5960122 0.0975  -0.5960122          99.48476
#> Nb_Comp_2 35.58058 41.68602  -19.5531112 0.0975 -11.8777906         120.49132
#>           Chi2_Pearson_Y
#> Nb_Comp_0      62.333333
#> Nb_Comp_1       9.356521
#> Nb_Comp_2       8.568956
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
summary(cv.plsRglm(Quality~.,data=bordeaux,nt=2,K=7,
modele="pls-glm-polr",method="probit",verbose=FALSE))
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: probit 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2 Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 78.64736 81.70009           NA     NA        NA                NA
#> Nb_Comp_1 36.01661 40.59569    -0.816038 0.0975 -0.816038         113.20000
#> Nb_Comp_2 35.13428 41.23972   -15.104251 0.0975 -7.867794          86.16614
#>           Chi2_Pearson_Y
#> Nb_Comp_0      62.333496
#> Nb_Comp_1       9.716750
#> Nb_Comp_2       8.549269
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
summary(cv.plsRglm(Quality~.,data=bordeaux,nt=2,K=7,
modele="pls-glm-polr",method="cloglog",verbose=FALSE))
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: cloglog 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC  Q2Chisqcum_Y  limQ2     Q2Chisq_Y
#> Nb_Comp_0 78.64736 81.70009            NA     NA            NA
#> Nb_Comp_1 36.92722 41.50630  4.162254e-01 0.0975  4.162254e-01
#> Nb_Comp_2 35.54609 41.65153 -2.097281e+06 0.0975 -3.592621e+06
#>           PREChi2_Pearson_Y Chi2_Pearson_Y
#> Nb_Comp_0                NA      62.334737
#> Nb_Comp_1      3.638944e+01      10.322134
#> Nb_Comp_2      3.708353e+07       7.727154
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
suppressWarnings(summary(cv.plsRglm(Quality~.,data=bordeaux,nt=2,K=7,
modele="pls-glm-polr",method="cauchit",verbose=FALSE)))
#> ____************************************************____
#> 
#> Model: pls-glm-polr 
#> Method: cauchit 
#> 
#> ____Component____ 1 ____
#> ____Component____ 2 ____
#> ____Predicting X without NA neither in X or Y____
#> ****________________________________________________****
#> 
#> 
#> NK: 1
#> [[1]]
#>                AIC      BIC Q2Chisqcum_Y  limQ2  Q2Chisq_Y PREChi2_Pearson_Y
#> Nb_Comp_0 79.08163 82.13436           NA     NA         NA                NA
#> Nb_Comp_1 38.11253 42.69161    -0.323537 0.0975  -0.323537          82.16317
#> Nb_Comp_2 38.01624 44.12168   -40.684867 0.0975 -30.495052         270.62780
#>           Chi2_Pearson_Y
#> Nb_Comp_0      62.078483
#> Nb_Comp_1       8.592708
#> Nb_Comp_2       7.421182
#> 
#> attr(,"class")
#> [1] "summary.cv.plsRglmmodel"
# }