This function provides a predict method for the class "plsRglmmodel"

# S3 method for plsRglmmodel
predict(
  object,
  newdata,
  comps = object$computed_nt,
  type = c("link", "response", "terms", "scores", "class", "probs"),
  se.fit = FALSE,
  weights,
  dispersion = NULL,
  methodNA = "adaptative",
  verbose = TRUE,
  ...
)

Arguments

object

An object of the class "plsRmodel".

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

comps

A value with a single value of component to use for prediction.

type

Type of predicted value. Available choices are the glms ones ("link", "response", "terms"), the polr ones ("class", "probs") or the scores ("scores").

se.fit

If TRUE, pointwise standard errors are produced for the predictions using the Cox model.

weights

Vector of case weights. If weights is a vector of integers, then the estimated coefficients are equivalent to estimating the model from data with the individual cases replicated as many times as indicated by weights.

dispersion

the dispersion of the GLM fit to be assumed in computing the standard errors. If omitted, that returned by summary applied to the object is used.

methodNA

Selects the way of predicting the response or the scores of the new data. For complete rows, without any missing value, there are two different ways of computing the prediction. As a consequence, for mixed datasets, with complete and incomplete rows, there are two ways of computing prediction : either predicts any row as if there were missing values in it (missingdata) or selects the prediction method accordingly to the completeness of the row (adaptative).

verbose

should info messages be displayed ?

...

Arguments to be passed on to stats::glm and plsRglm::plsRglm.

Value

When type is "response", a matrix of predicted response values is returned.
When type is "scores", a score matrix is returned.

References

Nicolas Meyer, Myriam Maumy-Bertrand et Frédéric Bertrand (2010). Comparing the linear and the logistic PLS regression with qualitative predictors: application to allelotyping data. Journal de la Societe Francaise de Statistique, 151(2), pages 1-18. http://publications-sfds.math.cnrs.fr/index.php/J-SFdS/article/view/47

See also

See Also predict.glm

Examples


data(pine)
Xpine<-pine[,1:10]
ypine<-pine[,11]
data(pine_sup)
Xpine_sup<-pine_sup[,1:10]
Xpine_supNA<-Xpine_sup
Xpine_supNA[1,1]<-NA

modpls=plsRglm(object=ypine,dataX=Xpine,nt=6,modele="pls-glm-family",family="gaussian",
verbose=FALSE)
modplsform=plsRglm(x11~.,data=pine,nt=6,modele="pls-glm-family",family="gaussian", verbose=FALSE)
modpls2=plsRglm(object=ypine,dataX=Xpine,nt=6,modele="pls-glm-family",
dataPredictY=Xpine_sup,family="gaussian", verbose=FALSE)
modpls2NA=plsRglm(object=ypine,dataX=Xpine,nt=6,modele="pls-glm-family",
dataPredictY=Xpine_supNA,family="gaussian", verbose=FALSE)

#Identical to predict(modpls,type="link") or modpls$Std.ValsPredictY
cbind(modpls$Std.ValsPredictY,modplsform$Std.ValsPredictY,
predict(modpls),predict(modplsform))
#>             [,1]          [,2]          [,3]          [,4]
#> 1   1.9833376732  1.9833376732  1.9833376732  1.9833376732
#> 2   1.2424038010  1.2424038010  1.2424038010  1.2424038010
#> 3   1.4982947689  1.4982947689  1.4982947689  1.4982947689
#> 4   0.9909505955  0.9909505955  0.9909505955  0.9909505955
#> 5   0.5188201727  0.5188201727  0.5188201727  0.5188201727
#> 6   1.3306250748  1.3306250748  1.3306250748  1.3306250748
#> 7  -0.0207190905 -0.0207190905 -0.0207190905 -0.0207190905
#> 8   0.3578640505  0.3578640505  0.3578640505  0.3578640505
#> 9   1.6121834444  1.6121834444  1.6121834444  1.6121834444
#> 10  0.8174125637  0.8174125637  0.8174125637  0.8174125637
#> 11  0.6245784031  0.6245784031  0.6245784031  0.6245784031
#> 12  1.0296261669  1.0296261669  1.0296261669  1.0296261669
#> 13  2.1697925483  2.1697925483  2.1697925483  2.1697925483
#> 14  1.8135307368  1.8135307368  1.8135307368  1.8135307368
#> 15  1.5668160958  1.5668160958  1.5668160958  1.5668160958
#> 16 -0.4913222929 -0.4913222929 -0.4913222929 -0.4913222929
#> 17  0.0003648119  0.0003648119  0.0003648119  0.0003648119
#> 18  0.9670404542  0.9670404542  0.9670404542  0.9670404542
#> 19  0.9155210110  0.9155210110  0.9155210110  0.9155210110
#> 20  0.0147427279  0.0147427279  0.0147427279  0.0147427279
#> 21  0.5787557488  0.5787557488  0.5787557488  0.5787557488
#> 22  0.7677772238  0.7677772238  0.7677772238  0.7677772238
#> 23  0.6902564661  0.6902564661  0.6902564661  0.6902564661
#> 24  0.2269039458  0.2269039458  0.2269039458  0.2269039458
#> 25 -0.1262912840 -0.1262912840 -0.1262912840 -0.1262912840
#> 26  0.7620516870  0.7620516870  0.7620516870  0.7620516870
#> 27  0.2265845367  0.2265845367  0.2265845367  0.2265845367
#> 28  0.9429046207  0.9429046207  0.9429046207  0.9429046207
#> 29  1.5828522058  1.5828522058  1.5828522058  1.5828522058
#> 30  0.3072993447  0.3072993447  0.3072993447  0.3072993447
#> 31  1.3622819484  1.3622819484  1.3622819484  1.3622819484
#> 32  0.4779691553  0.4779691553  0.4779691553  0.4779691553
#> 33  0.0287906836  0.0287906836  0.0287906836  0.0287906836

#Identical to predict(modpls,type="response") or modpls$ValsPredictY
cbind(modpls$ValsPredictY,modplsform$ValsPredictY,
predict(modpls,type="response"),predict(modplsform,type="response"))
#>             [,1]          [,2]          [,3]          [,4]
#> 1   1.9833376732  1.9833376732  1.9833376732  1.9833376732
#> 2   1.2424038010  1.2424038010  1.2424038010  1.2424038010
#> 3   1.4982947689  1.4982947689  1.4982947689  1.4982947689
#> 4   0.9909505955  0.9909505955  0.9909505955  0.9909505955
#> 5   0.5188201727  0.5188201727  0.5188201727  0.5188201727
#> 6   1.3306250748  1.3306250748  1.3306250748  1.3306250748
#> 7  -0.0207190905 -0.0207190905 -0.0207190905 -0.0207190905
#> 8   0.3578640505  0.3578640505  0.3578640505  0.3578640505
#> 9   1.6121834444  1.6121834444  1.6121834444  1.6121834444
#> 10  0.8174125637  0.8174125637  0.8174125637  0.8174125637
#> 11  0.6245784031  0.6245784031  0.6245784031  0.6245784031
#> 12  1.0296261669  1.0296261669  1.0296261669  1.0296261669
#> 13  2.1697925483  2.1697925483  2.1697925483  2.1697925483
#> 14  1.8135307368  1.8135307368  1.8135307368  1.8135307368
#> 15  1.5668160958  1.5668160958  1.5668160958  1.5668160958
#> 16 -0.4913222929 -0.4913222929 -0.4913222929 -0.4913222929
#> 17  0.0003648119  0.0003648119  0.0003648119  0.0003648119
#> 18  0.9670404542  0.9670404542  0.9670404542  0.9670404542
#> 19  0.9155210110  0.9155210110  0.9155210110  0.9155210110
#> 20  0.0147427279  0.0147427279  0.0147427279  0.0147427279
#> 21  0.5787557488  0.5787557488  0.5787557488  0.5787557488
#> 22  0.7677772238  0.7677772238  0.7677772238  0.7677772238
#> 23  0.6902564661  0.6902564661  0.6902564661  0.6902564661
#> 24  0.2269039458  0.2269039458  0.2269039458  0.2269039458
#> 25 -0.1262912840 -0.1262912840 -0.1262912840 -0.1262912840
#> 26  0.7620516870  0.7620516870  0.7620516870  0.7620516870
#> 27  0.2265845367  0.2265845367  0.2265845367  0.2265845367
#> 28  0.9429046207  0.9429046207  0.9429046207  0.9429046207
#> 29  1.5828522058  1.5828522058  1.5828522058  1.5828522058
#> 30  0.3072993447  0.3072993447  0.3072993447  0.3072993447
#> 31  1.3622819484  1.3622819484  1.3622819484  1.3622819484
#> 32  0.4779691553  0.4779691553  0.4779691553  0.4779691553
#> 33  0.0287906836  0.0287906836  0.0287906836  0.0287906836

#Identical to modpls$ttPredictY
predict(modpls,type="scores")
#>        Comp_1      Comp_2      Comp_3       Comp_4       Comp_5      Comp_6
#> 1   2.9096976  1.00710122 -0.24592387 -0.160828305 -0.176676852 -0.04612186
#> 2   0.7632932  0.15976639  0.27373619  0.140033799 -0.211959106  0.23748516
#> 3   2.5797729 -0.15255047  0.29850835 -0.463288186  0.395641948  0.06260773
#> 4   0.0443116  0.18393139  0.35088163 -0.751984567  0.503753361  0.04469555
#> 5   0.8636609 -0.71278066 -0.37239336 -0.161000543  0.039381404 -0.07357890
#> 6   2.0735510  0.01335370 -0.07197122  0.334437598 -0.101229035 -0.13598146
#> 7  -1.8665241 -0.99415606  0.33015396 -0.396546167  0.785963932  0.12857825
#> 8  -0.3528084 -0.47395114 -0.24214142  0.751121043 -0.169208869 -0.36500370
#> 9   2.5760644  0.16552577  0.04928545 -0.089535122  0.167729285  0.03063475
#> 10  0.7101307 -0.07990096 -0.15351493 -0.005071190  0.409378779 -0.43921245
#> 11 -1.4335481  1.07257765 -1.18074795 -0.436193501  0.158685019 -0.09759548
#> 12 -3.3502270  1.30698624  0.87144711  0.386088832  0.978624443 -0.05611513
#> 13  3.6223851  0.68753187  0.40988945 -0.264421225 -0.030412303 -0.06398871
#> 14  2.1481736  0.57279554  0.28246967  0.653041463 -0.327686046  0.03285982
#> 15  1.8241923  0.13197474  0.13629418  0.539338767  0.189873538  0.17720966
#> 16 -4.2769308 -0.28783227  0.30482521  0.105860327 -0.057241843 -0.30620830
#> 17 -2.7842661 -0.16567944  0.07256901 -0.315395828 -0.707648649  0.39219062
#> 18  0.8485036 -0.05290953 -0.61740825 -0.280346593 -0.011117608  0.45336039
#> 19  1.0268524 -0.80640496  0.57912902  0.064174398  0.354166437  0.14689814
#> 20 -2.0252326 -0.58395494  0.04522859  0.075864802  0.204673403 -0.01550492
#> 21 -2.9034527  0.78107186  1.11976594 -0.422652246 -0.632696644 -0.05241835
#> 22 -0.6130182  0.13878788  0.24414686 -0.354981337 -0.127986504  0.14392098
#> 23  0.3973956 -0.47715993 -0.08672426  0.577352623 -0.498808259  0.10940105
#> 24 -1.9919455 -0.11392902  0.83986464 -0.231967944 -0.889717260 -0.14566335
#> 25 -0.9692387 -1.09175820 -0.24633375  0.268105315 -0.001492138 -0.21439636
#> 26  0.4320999 -0.42853732 -0.32668909  0.438180905 -0.212606195  0.32458213
#> 27 -3.0186366  0.68892697 -1.13558954  0.357517970  0.068179402  0.20518691
#> 28  2.7834585 -0.79904726  0.11258827 -0.544298344 -0.268790892 -0.23821771
#> 29  2.4348733  0.11286629  0.15459790  0.102159012  0.238308194 -0.05212571
#> 30 -0.3039968 -0.10418524 -0.64875748 -1.092874683 -0.151109635 -0.05322880
#> 31  0.6490525  0.29413661  0.31920770  0.875287429 -0.027498146  0.04838810
#> 32 -0.5424034  0.43591326 -0.99283694 -0.002253209 -0.288501338 -0.34514010
#> 33 -2.2552401 -0.42850996 -0.47355708  0.305074707  0.398028177  0.16250207
predict(modplsform,type="scores")
#>        Comp_1      Comp_2      Comp_3       Comp_4       Comp_5      Comp_6
#> 1   2.9096976  1.00710122 -0.24592387 -0.160828305 -0.176676852 -0.04612186
#> 2   0.7632932  0.15976639  0.27373619  0.140033799 -0.211959106  0.23748516
#> 3   2.5797729 -0.15255047  0.29850835 -0.463288186  0.395641948  0.06260773
#> 4   0.0443116  0.18393139  0.35088163 -0.751984567  0.503753361  0.04469555
#> 5   0.8636609 -0.71278066 -0.37239336 -0.161000543  0.039381404 -0.07357890
#> 6   2.0735510  0.01335370 -0.07197122  0.334437598 -0.101229035 -0.13598146
#> 7  -1.8665241 -0.99415606  0.33015396 -0.396546167  0.785963932  0.12857825
#> 8  -0.3528084 -0.47395114 -0.24214142  0.751121043 -0.169208869 -0.36500370
#> 9   2.5760644  0.16552577  0.04928545 -0.089535122  0.167729285  0.03063475
#> 10  0.7101307 -0.07990096 -0.15351493 -0.005071190  0.409378779 -0.43921245
#> 11 -1.4335481  1.07257765 -1.18074795 -0.436193501  0.158685019 -0.09759548
#> 12 -3.3502270  1.30698624  0.87144711  0.386088832  0.978624443 -0.05611513
#> 13  3.6223851  0.68753187  0.40988945 -0.264421225 -0.030412303 -0.06398871
#> 14  2.1481736  0.57279554  0.28246967  0.653041463 -0.327686046  0.03285982
#> 15  1.8241923  0.13197474  0.13629418  0.539338767  0.189873538  0.17720966
#> 16 -4.2769308 -0.28783227  0.30482521  0.105860327 -0.057241843 -0.30620830
#> 17 -2.7842661 -0.16567944  0.07256901 -0.315395828 -0.707648649  0.39219062
#> 18  0.8485036 -0.05290953 -0.61740825 -0.280346593 -0.011117608  0.45336039
#> 19  1.0268524 -0.80640496  0.57912902  0.064174398  0.354166437  0.14689814
#> 20 -2.0252326 -0.58395494  0.04522859  0.075864802  0.204673403 -0.01550492
#> 21 -2.9034527  0.78107186  1.11976594 -0.422652246 -0.632696644 -0.05241835
#> 22 -0.6130182  0.13878788  0.24414686 -0.354981337 -0.127986504  0.14392098
#> 23  0.3973956 -0.47715993 -0.08672426  0.577352623 -0.498808259  0.10940105
#> 24 -1.9919455 -0.11392902  0.83986464 -0.231967944 -0.889717260 -0.14566335
#> 25 -0.9692387 -1.09175820 -0.24633375  0.268105315 -0.001492138 -0.21439636
#> 26  0.4320999 -0.42853732 -0.32668909  0.438180905 -0.212606195  0.32458213
#> 27 -3.0186366  0.68892697 -1.13558954  0.357517970  0.068179402  0.20518691
#> 28  2.7834585 -0.79904726  0.11258827 -0.544298344 -0.268790892 -0.23821771
#> 29  2.4348733  0.11286629  0.15459790  0.102159012  0.238308194 -0.05212571
#> 30 -0.3039968 -0.10418524 -0.64875748 -1.092874683 -0.151109635 -0.05322880
#> 31  0.6490525  0.29413661  0.31920770  0.875287429 -0.027498146  0.04838810
#> 32 -0.5424034  0.43591326 -0.99283694 -0.002253209 -0.288501338 -0.34514010
#> 33 -2.2552401 -0.42850996 -0.47355708  0.305074707  0.398028177  0.16250207

# \donttest{
#Identical to modpls2$ValsPredictY
cbind(predict(modpls,newdata=Xpine_sup,type="response"),
predict(modplsform,newdata=Xpine_sup,type="response"))
#>         [,1]      [,2]
#> 1  1.1097381 1.1097381
#> 2  1.6368638 1.6368638
#> 3  1.4742716 1.4742716
#> 4  1.7447487 1.7447487
#> 5  1.4156388 1.4156388
#> 6  2.9500255 2.9500255
#> 7  2.0414347 2.0414347
#> 8  1.8312096 1.8312096
#> 9  1.5718912 1.5718912
#> 10 2.0025140 2.0025140
#> 11 2.0487486 2.0487486
#> 12 2.0535109 2.0535109
#> 13 1.0628496 1.0628496
#> 14 0.8116580 0.8116580
#> 15 0.1798506 0.1798506
#> 16 0.3632888 0.3632888
#> 17 0.9930354 0.9930354
#> 18 1.0399233 1.0399233
#> 19 0.2747613 0.2747613
#> 20 0.7296300 0.7296300
#> 21 1.2241840 1.2241840
#> 22 0.3757749 0.3757749
#> 23 1.2966168 1.2966168
#> 24 0.3423249 0.3423249
#> 25 0.3425252 0.3425252

#Select the number of components to use to derive the prediction
predict(modpls,newdata=Xpine_sup,type="response",comps=1)    
#>         1         2         3         4         5         6         7         8 
#> 0.4529386 1.5275250 0.8653393 1.2623019 1.2181767 0.5365724 1.8005533 1.4130804 
#>         9        10        11        12        13        14        15        16 
#> 1.3482246 0.8525246 1.4451515 1.0083162 0.1933256 0.4868117 0.2004471 0.1145533 
#>        17        18        19        20        21        22        23        24 
#> 0.6559225 1.0049792 0.4994408 0.4326020 0.8987432 0.4734407 1.0680659 0.1914079 
#>        25 
#> 0.6558292 
predict(modpls,newdata=Xpine_sup,type="response",comps=3)    
#>         1         2         3         4         5         6         7         8 
#> 1.4182116 1.6412293 1.6692276 1.8131310 1.4721576 2.4824189 2.3952957 1.9883342 
#>         9        10        11        12        13        14        15        16 
#> 1.5249653 1.8631319 2.3120849 1.6636405 1.0800241 0.9203430 1.0943056 0.6916340 
#>        17        18        19        20        21        22        23        24 
#> 1.3022034 1.2067980 0.1706657 0.7408545 1.3858670 0.2923245 1.4945633 0.4191331 
#>        25 
#> 0.4186188 
predict(modpls,newdata=Xpine_sup,type="response",comps=6)    
#>         1         2         3         4         5         6         7         8 
#> 1.1097381 1.6368638 1.4742716 1.7447487 1.4156388 2.9500255 2.0414347 1.8312096 
#>         9        10        11        12        13        14        15        16 
#> 1.5718912 2.0025140 2.0487486 2.0535109 1.0628496 0.8116580 0.1798506 0.3632888 
#>        17        18        19        20        21        22        23        24 
#> 0.9930354 1.0399233 0.2747613 0.7296300 1.2241840 0.3757749 1.2966168 0.3423249 
#>        25 
#> 0.3425252 
try(predict(modpls,newdata=Xpine_sup,type="response",comps=8))
#> Error in predict.plsRglmmodel(modpls, newdata = Xpine_sup, type = "response",  : 
#>   Cannot predict using more components than extracted.

#Identical to modpls2$ttValsPredictY
predict(modpls,newdata=Xpine_sup,type="scores")    
#>           Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -1.3617679  1.84853757 -0.07167989 -0.78643051 -0.55491628 -0.31285630
#>  [2,]  2.7226457 -0.18222256  0.81656680  0.02721720  0.86067342 -0.37393001
#>  [3,]  0.2057330  0.81889037  1.42664508 -0.15485978  0.43372368 -0.65684336
#>  [4,]  1.7145547  0.87851109  0.32284764  0.37343500  0.23900014 -0.44019550
#>  [5,]  1.5468388  0.06396562  0.85245128 -0.16192486  0.59815956 -0.33518539
#>  [6,] -1.0438828  2.94178014  1.47387097  1.08467443 -0.02394675  0.87054622
#>  [7,]  3.7604036  1.20512548 -0.18065028 -0.40642515 -0.37373716 -0.66809476
#>  [8,]  2.2876515  0.79101480  0.59799022 -0.32260550  0.35381984 -0.45046964
#>  [9,]  2.0411399  0.23491526  0.20046643  0.46551988  0.41574301 -0.22843097
#> [10,]  0.1570251  1.48472812  0.85445008  0.03281035  0.58589348  0.13631629
#> [11,]  2.4095509  1.50815475  0.24927003 -1.08425752  0.08663564 -0.32703134
#> [12,]  0.7491762  1.04259904  0.38939526  1.71739480 -0.33430079  0.52239057
#> [13,] -2.3485356  1.25475466  0.84855868 -0.87653694  0.94681725 -0.07623013
#> [14,] -1.2330191  0.69650062  0.24364744  0.35221831  1.00517071 -0.85601738
#> [15,] -2.3214673  0.90707702  1.59345546 -0.33982651 -0.51746875 -2.19885874
#> [16,] -2.6479422  0.70541253  0.78164085 -0.12218988  0.26382110 -0.97264696
#> [17,] -0.5902429  1.20133709  0.02691916 -0.45526058 -0.38894004 -0.51744565
#> [18,]  0.7364927  0.46852245 -0.18419048 -0.45872544 -0.30400190 -0.15411996
#> [19,] -1.1850170  0.09703486 -1.47443389 -0.31309733  0.46295088  0.22911528
#> [20,] -1.4390656  0.52556741  0.11066551 -0.46711508  0.70135198 -0.12657426
#> [21,]  0.3326983  1.15647992 -0.49742370 -0.49751150  0.03075929 -0.26023128
#> [22,] -1.2838413 -0.23799459 -0.21107354  0.50469061  0.13088191 -0.02655946
#> [23,]  0.9762797  0.70172088  0.20561742 -0.60785236 -0.37714270 -0.15010150
#> [24,] -2.3558246  0.03526826  0.80988172 -0.01076392  0.79025721 -0.53162513
#> [25,] -0.5905978 -0.27969847 -0.34246431  0.49615203  0.23346261 -0.50946404

#Select the number of components in the scores matrix
predict(modpls,newdata=Xpine_sup,type="scores",comps=1)    
#>           Comp_1
#>  [1,] -1.3617679
#>  [2,]  2.7226457
#>  [3,]  0.2057330
#>  [4,]  1.7145547
#>  [5,]  1.5468388
#>  [6,] -1.0438828
#>  [7,]  3.7604036
#>  [8,]  2.2876515
#>  [9,]  2.0411399
#> [10,]  0.1570251
#> [11,]  2.4095509
#> [12,]  0.7491762
#> [13,] -2.3485356
#> [14,] -1.2330191
#> [15,] -2.3214673
#> [16,] -2.6479422
#> [17,] -0.5902429
#> [18,]  0.7364927
#> [19,] -1.1850170
#> [20,] -1.4390656
#> [21,]  0.3326983
#> [22,] -1.2838413
#> [23,]  0.9762797
#> [24,] -2.3558246
#> [25,] -0.5905978
predict(modpls,newdata=Xpine_sup,type="scores",comps=3)    
#>           Comp_1      Comp_2      Comp_3
#>  [1,] -1.3617679  1.84853757 -0.07167989
#>  [2,]  2.7226457 -0.18222256  0.81656680
#>  [3,]  0.2057330  0.81889037  1.42664508
#>  [4,]  1.7145547  0.87851109  0.32284764
#>  [5,]  1.5468388  0.06396562  0.85245128
#>  [6,] -1.0438828  2.94178014  1.47387097
#>  [7,]  3.7604036  1.20512548 -0.18065028
#>  [8,]  2.2876515  0.79101480  0.59799022
#>  [9,]  2.0411399  0.23491526  0.20046643
#> [10,]  0.1570251  1.48472812  0.85445008
#> [11,]  2.4095509  1.50815475  0.24927003
#> [12,]  0.7491762  1.04259904  0.38939526
#> [13,] -2.3485356  1.25475466  0.84855868
#> [14,] -1.2330191  0.69650062  0.24364744
#> [15,] -2.3214673  0.90707702  1.59345546
#> [16,] -2.6479422  0.70541253  0.78164085
#> [17,] -0.5902429  1.20133709  0.02691916
#> [18,]  0.7364927  0.46852245 -0.18419048
#> [19,] -1.1850170  0.09703486 -1.47443389
#> [20,] -1.4390656  0.52556741  0.11066551
#> [21,]  0.3326983  1.15647992 -0.49742370
#> [22,] -1.2838413 -0.23799459 -0.21107354
#> [23,]  0.9762797  0.70172088  0.20561742
#> [24,] -2.3558246  0.03526826  0.80988172
#> [25,] -0.5905978 -0.27969847 -0.34246431
predict(modpls,newdata=Xpine_sup,type="scores",comps=6)    
#>           Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -1.3617679  1.84853757 -0.07167989 -0.78643051 -0.55491628 -0.31285630
#>  [2,]  2.7226457 -0.18222256  0.81656680  0.02721720  0.86067342 -0.37393001
#>  [3,]  0.2057330  0.81889037  1.42664508 -0.15485978  0.43372368 -0.65684336
#>  [4,]  1.7145547  0.87851109  0.32284764  0.37343500  0.23900014 -0.44019550
#>  [5,]  1.5468388  0.06396562  0.85245128 -0.16192486  0.59815956 -0.33518539
#>  [6,] -1.0438828  2.94178014  1.47387097  1.08467443 -0.02394675  0.87054622
#>  [7,]  3.7604036  1.20512548 -0.18065028 -0.40642515 -0.37373716 -0.66809476
#>  [8,]  2.2876515  0.79101480  0.59799022 -0.32260550  0.35381984 -0.45046964
#>  [9,]  2.0411399  0.23491526  0.20046643  0.46551988  0.41574301 -0.22843097
#> [10,]  0.1570251  1.48472812  0.85445008  0.03281035  0.58589348  0.13631629
#> [11,]  2.4095509  1.50815475  0.24927003 -1.08425752  0.08663564 -0.32703134
#> [12,]  0.7491762  1.04259904  0.38939526  1.71739480 -0.33430079  0.52239057
#> [13,] -2.3485356  1.25475466  0.84855868 -0.87653694  0.94681725 -0.07623013
#> [14,] -1.2330191  0.69650062  0.24364744  0.35221831  1.00517071 -0.85601738
#> [15,] -2.3214673  0.90707702  1.59345546 -0.33982651 -0.51746875 -2.19885874
#> [16,] -2.6479422  0.70541253  0.78164085 -0.12218988  0.26382110 -0.97264696
#> [17,] -0.5902429  1.20133709  0.02691916 -0.45526058 -0.38894004 -0.51744565
#> [18,]  0.7364927  0.46852245 -0.18419048 -0.45872544 -0.30400190 -0.15411996
#> [19,] -1.1850170  0.09703486 -1.47443389 -0.31309733  0.46295088  0.22911528
#> [20,] -1.4390656  0.52556741  0.11066551 -0.46711508  0.70135198 -0.12657426
#> [21,]  0.3326983  1.15647992 -0.49742370 -0.49751150  0.03075929 -0.26023128
#> [22,] -1.2838413 -0.23799459 -0.21107354  0.50469061  0.13088191 -0.02655946
#> [23,]  0.9762797  0.70172088  0.20561742 -0.60785236 -0.37714270 -0.15010150
#> [24,] -2.3558246  0.03526826  0.80988172 -0.01076392  0.79025721 -0.53162513
#> [25,] -0.5905978 -0.27969847 -0.34246431  0.49615203  0.23346261 -0.50946404
try(predict(modpls,newdata=Xpine_sup,type="scores",comps=8))
#> Error in predict.plsRglmmodel(modpls, newdata = Xpine_sup, type = "scores",  : 
#>   Cannot predict using more components than extracted.

#Identical to modpls2NA$ValsPredictY
predict(modpls,newdata=Xpine_supNA,type="response",methodNA="missingdata")    
#> Prediction as if missing values in every row.
#>          1          2          3          4          5          6          7 
#>  2.6822545  1.1863259  1.1158440  1.3838529  0.9095165  3.0886290  1.4840306 
#>          8          9         10         11         12         13         14 
#>  1.3932964  1.5820746  1.7099538  1.7180268  1.7661632  0.8530780  0.4951882 
#>         15         16         17         18         19         20         21 
#>  0.3444462  0.4816824  0.8115274  1.0833567  0.3552001  0.4309125  1.2581587 
#>         22         23         24         25 
#>  0.7244769  1.3761161 -0.0205930  0.1081691 

cbind(predict(modpls,newdata=Xpine_supNA,type="response"),
predict(modplsform,newdata=Xpine_supNA,type="response"))
#> Missing value in row  1 .
#> Missing value in row  1 .
#>         [,1]      [,2]
#> 1  2.6822545 2.6822545
#> 2  1.6368638 1.6368638
#> 3  1.4742716 1.4742716
#> 4  1.7447487 1.7447487
#> 5  1.4156388 1.4156388
#> 6  2.9500255 2.9500255
#> 7  2.0414347 2.0414347
#> 8  1.8312096 1.8312096
#> 9  1.5718912 1.5718912
#> 10 2.0025140 2.0025140
#> 11 2.0487486 2.0487486
#> 12 2.0535109 2.0535109
#> 13 1.0628496 1.0628496
#> 14 0.8116580 0.8116580
#> 15 0.1798506 0.1798506
#> 16 0.3632888 0.3632888
#> 17 0.9930354 0.9930354
#> 18 1.0399233 1.0399233
#> 19 0.2747613 0.2747613
#> 20 0.7296300 0.7296300
#> 21 1.2241840 1.2241840
#> 22 0.3757749 0.3757749
#> 23 1.2966168 1.2966168
#> 24 0.3423249 0.3423249
#> 25 0.3425252 0.3425252

predict(modpls,newdata=Xpine_supNA,type="response",comps=1)    
#> Missing value in row  1 .
#>         1         2         3         4         5         6         7         8 
#> 0.7935852 1.5275250 0.8653393 1.2623019 1.2181767 0.5365724 1.8005533 1.4130804 
#>         9        10        11        12        13        14        15        16 
#> 1.3482246 0.8525246 1.4451515 1.0083162 0.1933256 0.4868117 0.2004471 0.1145533 
#>        17        18        19        20        21        22        23        24 
#> 0.6559225 1.0049792 0.4994408 0.4326020 0.8987432 0.4734407 1.0680659 0.1914079 
#>        25 
#> 0.6558292 
predict(modpls,newdata=Xpine_supNA,type="response",comps=3)    
#> Missing value in row  1 .
#>         1         2         3         4         5         6         7         8 
#> 2.6350800 1.6412293 1.6692276 1.8131310 1.4721576 2.4824189 2.3952957 1.9883342 
#>         9        10        11        12        13        14        15        16 
#> 1.5249653 1.8631319 2.3120849 1.6636405 1.0800241 0.9203430 1.0943056 0.6916340 
#>        17        18        19        20        21        22        23        24 
#> 1.3022034 1.2067980 0.1706657 0.7408545 1.3858670 0.2923245 1.4945633 0.4191331 
#>        25 
#> 0.4186188 
predict(modpls,newdata=Xpine_supNA,type="response",comps=6)    
#> Missing value in row  1 .
#>         1         2         3         4         5         6         7         8 
#> 2.6822545 1.6368638 1.4742716 1.7447487 1.4156388 2.9500255 2.0414347 1.8312096 
#>         9        10        11        12        13        14        15        16 
#> 1.5718912 2.0025140 2.0487486 2.0535109 1.0628496 0.8116580 0.1798506 0.3632888 
#>        17        18        19        20        21        22        23        24 
#> 0.9930354 1.0399233 0.2747613 0.7296300 1.2241840 0.3757749 1.2966168 0.3423249 
#>        25 
#> 0.3425252 
try(predict(modpls,newdata=Xpine_supNA,type="response",comps=8))
#> Error in predict.plsRglmmodel(modpls, newdata = Xpine_supNA, type = "response",  : 
#>   Cannot predict using more components than extracted.

#Identical to modpls2NA$ttPredictY
predict(modpls,newdata=Xpine_supNA,type="scores",methodNA="missingdata")
#> Prediction as if missing values in every row.
#>            Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -0.06699854  3.66196285 -0.41608333  0.45187568  1.59546224 -0.70283222
#>  [2,]  2.70687391 -0.58366935  0.27090780 -0.23268469  0.41783324 -0.34378821
#>  [3,]  0.19202296  0.49815234  0.85544720 -0.24904846  0.19019882 -0.62164030
#>  [4,]  1.70925990  0.55904242 -0.30881117  0.25656004  0.01838154 -0.37653562
#>  [5,]  1.52593733 -0.38881272  0.06295091 -0.28629453  0.25482060 -0.30053699
#>  [6,] -1.05490144  3.06326417  1.16226073  1.75918466  0.63562354  0.76498730
#>  [7,]  3.76970759  0.71212677 -0.93264756 -1.01046463 -1.05410585 -0.43291609
#>  [8,]  2.27575778  0.40145391 -0.07597958 -0.49309936  0.02646672 -0.39687347
#>  [9,]  2.05501340  0.24531251 -0.02869079  0.50618778  0.53512630 -0.12610842
#> [10,]  0.14426832  1.22229503  0.30409563  0.03954890  0.46422395  0.16211651
#> [11,]  2.42011239  1.21572929 -0.52692173 -1.23349885 -0.07511353 -0.13789070
#> [12,]  0.71325904  0.78138784 -0.22320815  2.05984947 -0.23708707  0.39657611
#> [13,] -2.36496665  1.06490787  0.67009104 -0.97605714  0.71251859 -0.10284336
#> [14,] -1.24656968  0.41305228  0.07580642  0.00245363  0.50871863 -0.84205602
#> [15,] -2.30296146  1.06483113  1.46884767  0.00434439 -0.02752066 -2.23807126
#> [16,] -2.64053336  0.81365140  0.52481842  0.27545183  0.73661798 -0.97879522
#> [17,] -0.60476055  1.04011407 -0.29486241 -0.35457355 -0.40072127 -0.57840396
#> [18,]  0.72843736  0.50469321 -0.16432560 -0.30879645 -0.18587858 -0.20436368
#> [19,] -1.18710588  0.16576762 -1.16075056 -0.42137277  0.35583549  0.21512882
#> [20,] -1.45582497  0.26069143 -0.29422583 -0.49842200  0.51864437 -0.17557750
#> [21,]  0.32934702  1.18545904 -0.32589387 -0.54271388 -0.02733918 -0.28729932
#> [22,] -1.27473171  0.07149663 -0.08468023  0.98077026  0.73852299 -0.05307274
#> [23,]  0.99076234  0.77336043  0.10840383 -0.54965195 -0.22267535 -0.06219731
#> [24,] -2.37627373 -0.28604262  0.49260588 -0.18770162  0.42544962 -0.60255367
#> [25,] -0.60942177 -0.48739596 -0.69025348  0.57675181  0.16727880 -0.59655697
predict(modplsform,newdata=Xpine_supNA,type="scores",methodNA="missingdata")
#> Prediction as if missing values in every row.
#>            Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -0.06699854  3.66196285 -0.41608333  0.45187568  1.59546224 -0.70283222
#>  [2,]  2.70687391 -0.58366935  0.27090780 -0.23268469  0.41783324 -0.34378821
#>  [3,]  0.19202296  0.49815234  0.85544720 -0.24904846  0.19019882 -0.62164030
#>  [4,]  1.70925990  0.55904242 -0.30881117  0.25656004  0.01838154 -0.37653562
#>  [5,]  1.52593733 -0.38881272  0.06295091 -0.28629453  0.25482060 -0.30053699
#>  [6,] -1.05490144  3.06326417  1.16226073  1.75918466  0.63562354  0.76498730
#>  [7,]  3.76970759  0.71212677 -0.93264756 -1.01046463 -1.05410585 -0.43291609
#>  [8,]  2.27575778  0.40145391 -0.07597958 -0.49309936  0.02646672 -0.39687347
#>  [9,]  2.05501340  0.24531251 -0.02869079  0.50618778  0.53512630 -0.12610842
#> [10,]  0.14426832  1.22229503  0.30409563  0.03954890  0.46422395  0.16211651
#> [11,]  2.42011239  1.21572929 -0.52692173 -1.23349885 -0.07511353 -0.13789070
#> [12,]  0.71325904  0.78138784 -0.22320815  2.05984947 -0.23708707  0.39657611
#> [13,] -2.36496665  1.06490787  0.67009104 -0.97605714  0.71251859 -0.10284336
#> [14,] -1.24656968  0.41305228  0.07580642  0.00245363  0.50871863 -0.84205602
#> [15,] -2.30296146  1.06483113  1.46884767  0.00434439 -0.02752066 -2.23807126
#> [16,] -2.64053336  0.81365140  0.52481842  0.27545183  0.73661798 -0.97879522
#> [17,] -0.60476055  1.04011407 -0.29486241 -0.35457355 -0.40072127 -0.57840396
#> [18,]  0.72843736  0.50469321 -0.16432560 -0.30879645 -0.18587858 -0.20436368
#> [19,] -1.18710588  0.16576762 -1.16075056 -0.42137277  0.35583549  0.21512882
#> [20,] -1.45582497  0.26069143 -0.29422583 -0.49842200  0.51864437 -0.17557750
#> [21,]  0.32934702  1.18545904 -0.32589387 -0.54271388 -0.02733918 -0.28729932
#> [22,] -1.27473171  0.07149663 -0.08468023  0.98077026  0.73852299 -0.05307274
#> [23,]  0.99076234  0.77336043  0.10840383 -0.54965195 -0.22267535 -0.06219731
#> [24,] -2.37627373 -0.28604262  0.49260588 -0.18770162  0.42544962 -0.60255367
#> [25,] -0.60942177 -0.48739596 -0.69025348  0.57675181  0.16727880 -0.59655697

predict(modpls,newdata=Xpine_supNA,type="scores")    
#> Missing value in row  1 .
#>            Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -0.06699854  3.66196285 -0.41608333  0.45187568  1.59546224 -0.70283222
#>  [2,]  2.72264571 -0.18222256  0.81656680  0.02721720  0.86067342 -0.37393001
#>  [3,]  0.20573296  0.81889037  1.42664508 -0.15485978  0.43372368 -0.65684336
#>  [4,]  1.71455473  0.87851109  0.32284764  0.37343500  0.23900014 -0.44019550
#>  [5,]  1.54683876  0.06396562  0.85245128 -0.16192486  0.59815956 -0.33518539
#>  [6,] -1.04388279  2.94178014  1.47387097  1.08467443 -0.02394675  0.87054622
#>  [7,]  3.76040357  1.20512548 -0.18065028 -0.40642515 -0.37373716 -0.66809476
#>  [8,]  2.28765145  0.79101480  0.59799022 -0.32260550  0.35381984 -0.45046964
#>  [9,]  2.04113990  0.23491526  0.20046643  0.46551988  0.41574301 -0.22843097
#> [10,]  0.15702512  1.48472812  0.85445008  0.03281035  0.58589348  0.13631629
#> [11,]  2.40955090  1.50815475  0.24927003 -1.08425752  0.08663564 -0.32703134
#> [12,]  0.74917624  1.04259904  0.38939526  1.71739480 -0.33430079  0.52239057
#> [13,] -2.34853556  1.25475466  0.84855868 -0.87653694  0.94681725 -0.07623013
#> [14,] -1.23301912  0.69650062  0.24364744  0.35221831  1.00517071 -0.85601738
#> [15,] -2.32146728  0.90707702  1.59345546 -0.33982651 -0.51746875 -2.19885874
#> [16,] -2.64794221  0.70541253  0.78164085 -0.12218988  0.26382110 -0.97264696
#> [17,] -0.59024285  1.20133709  0.02691916 -0.45526058 -0.38894004 -0.51744565
#> [18,]  0.73649265  0.46852245 -0.18419048 -0.45872544 -0.30400190 -0.15411996
#> [19,] -1.18501704  0.09703486 -1.47443389 -0.31309733  0.46295088  0.22911528
#> [20,] -1.43906556  0.52556741  0.11066551 -0.46711508  0.70135198 -0.12657426
#> [21,]  0.33269832  1.15647992 -0.49742370 -0.49751150  0.03075929 -0.26023128
#> [22,] -1.28384132 -0.23799459 -0.21107354  0.50469061  0.13088191 -0.02655946
#> [23,]  0.97627971  0.70172088  0.20561742 -0.60785236 -0.37714270 -0.15010150
#> [24,] -2.35582456  0.03526826  0.80988172 -0.01076392  0.79025721 -0.53162513
#> [25,] -0.59059777 -0.27969847 -0.34246431  0.49615203  0.23346261 -0.50946404
predict(modplsform,newdata=Xpine_supNA,type="scores")    
#> Missing value in row  1 .
#>            Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -0.06699854  3.66196285 -0.41608333  0.45187568  1.59546224 -0.70283222
#>  [2,]  2.72264571 -0.18222256  0.81656680  0.02721720  0.86067342 -0.37393001
#>  [3,]  0.20573296  0.81889037  1.42664508 -0.15485978  0.43372368 -0.65684336
#>  [4,]  1.71455473  0.87851109  0.32284764  0.37343500  0.23900014 -0.44019550
#>  [5,]  1.54683876  0.06396562  0.85245128 -0.16192486  0.59815956 -0.33518539
#>  [6,] -1.04388279  2.94178014  1.47387097  1.08467443 -0.02394675  0.87054622
#>  [7,]  3.76040357  1.20512548 -0.18065028 -0.40642515 -0.37373716 -0.66809476
#>  [8,]  2.28765145  0.79101480  0.59799022 -0.32260550  0.35381984 -0.45046964
#>  [9,]  2.04113990  0.23491526  0.20046643  0.46551988  0.41574301 -0.22843097
#> [10,]  0.15702512  1.48472812  0.85445008  0.03281035  0.58589348  0.13631629
#> [11,]  2.40955090  1.50815475  0.24927003 -1.08425752  0.08663564 -0.32703134
#> [12,]  0.74917624  1.04259904  0.38939526  1.71739480 -0.33430079  0.52239057
#> [13,] -2.34853556  1.25475466  0.84855868 -0.87653694  0.94681725 -0.07623013
#> [14,] -1.23301912  0.69650062  0.24364744  0.35221831  1.00517071 -0.85601738
#> [15,] -2.32146728  0.90707702  1.59345546 -0.33982651 -0.51746875 -2.19885874
#> [16,] -2.64794221  0.70541253  0.78164085 -0.12218988  0.26382110 -0.97264696
#> [17,] -0.59024285  1.20133709  0.02691916 -0.45526058 -0.38894004 -0.51744565
#> [18,]  0.73649265  0.46852245 -0.18419048 -0.45872544 -0.30400190 -0.15411996
#> [19,] -1.18501704  0.09703486 -1.47443389 -0.31309733  0.46295088  0.22911528
#> [20,] -1.43906556  0.52556741  0.11066551 -0.46711508  0.70135198 -0.12657426
#> [21,]  0.33269832  1.15647992 -0.49742370 -0.49751150  0.03075929 -0.26023128
#> [22,] -1.28384132 -0.23799459 -0.21107354  0.50469061  0.13088191 -0.02655946
#> [23,]  0.97627971  0.70172088  0.20561742 -0.60785236 -0.37714270 -0.15010150
#> [24,] -2.35582456  0.03526826  0.80988172 -0.01076392  0.79025721 -0.53162513
#> [25,] -0.59059777 -0.27969847 -0.34246431  0.49615203  0.23346261 -0.50946404
predict(modpls,newdata=Xpine_supNA,type="scores",comps=1)    
#> Missing value in row  1 .
#>            Comp_1
#>  [1,] -0.06699854
#>  [2,]  2.72264571
#>  [3,]  0.20573296
#>  [4,]  1.71455473
#>  [5,]  1.54683876
#>  [6,] -1.04388279
#>  [7,]  3.76040357
#>  [8,]  2.28765145
#>  [9,]  2.04113990
#> [10,]  0.15702512
#> [11,]  2.40955090
#> [12,]  0.74917624
#> [13,] -2.34853556
#> [14,] -1.23301912
#> [15,] -2.32146728
#> [16,] -2.64794221
#> [17,] -0.59024285
#> [18,]  0.73649265
#> [19,] -1.18501704
#> [20,] -1.43906556
#> [21,]  0.33269832
#> [22,] -1.28384132
#> [23,]  0.97627971
#> [24,] -2.35582456
#> [25,] -0.59059777
predict(modpls,newdata=Xpine_supNA,type="scores",comps=3)    
#> Missing value in row  1 .
#>            Comp_1      Comp_2      Comp_3
#>  [1,] -0.06699854  3.66196285 -0.41608333
#>  [2,]  2.72264571 -0.18222256  0.81656680
#>  [3,]  0.20573296  0.81889037  1.42664508
#>  [4,]  1.71455473  0.87851109  0.32284764
#>  [5,]  1.54683876  0.06396562  0.85245128
#>  [6,] -1.04388279  2.94178014  1.47387097
#>  [7,]  3.76040357  1.20512548 -0.18065028
#>  [8,]  2.28765145  0.79101480  0.59799022
#>  [9,]  2.04113990  0.23491526  0.20046643
#> [10,]  0.15702512  1.48472812  0.85445008
#> [11,]  2.40955090  1.50815475  0.24927003
#> [12,]  0.74917624  1.04259904  0.38939526
#> [13,] -2.34853556  1.25475466  0.84855868
#> [14,] -1.23301912  0.69650062  0.24364744
#> [15,] -2.32146728  0.90707702  1.59345546
#> [16,] -2.64794221  0.70541253  0.78164085
#> [17,] -0.59024285  1.20133709  0.02691916
#> [18,]  0.73649265  0.46852245 -0.18419048
#> [19,] -1.18501704  0.09703486 -1.47443389
#> [20,] -1.43906556  0.52556741  0.11066551
#> [21,]  0.33269832  1.15647992 -0.49742370
#> [22,] -1.28384132 -0.23799459 -0.21107354
#> [23,]  0.97627971  0.70172088  0.20561742
#> [24,] -2.35582456  0.03526826  0.80988172
#> [25,] -0.59059777 -0.27969847 -0.34246431
predict(modpls,newdata=Xpine_supNA,type="scores",comps=6)    
#> Missing value in row  1 .
#>            Comp_1      Comp_2      Comp_3      Comp_4      Comp_5      Comp_6
#>  [1,] -0.06699854  3.66196285 -0.41608333  0.45187568  1.59546224 -0.70283222
#>  [2,]  2.72264571 -0.18222256  0.81656680  0.02721720  0.86067342 -0.37393001
#>  [3,]  0.20573296  0.81889037  1.42664508 -0.15485978  0.43372368 -0.65684336
#>  [4,]  1.71455473  0.87851109  0.32284764  0.37343500  0.23900014 -0.44019550
#>  [5,]  1.54683876  0.06396562  0.85245128 -0.16192486  0.59815956 -0.33518539
#>  [6,] -1.04388279  2.94178014  1.47387097  1.08467443 -0.02394675  0.87054622
#>  [7,]  3.76040357  1.20512548 -0.18065028 -0.40642515 -0.37373716 -0.66809476
#>  [8,]  2.28765145  0.79101480  0.59799022 -0.32260550  0.35381984 -0.45046964
#>  [9,]  2.04113990  0.23491526  0.20046643  0.46551988  0.41574301 -0.22843097
#> [10,]  0.15702512  1.48472812  0.85445008  0.03281035  0.58589348  0.13631629
#> [11,]  2.40955090  1.50815475  0.24927003 -1.08425752  0.08663564 -0.32703134
#> [12,]  0.74917624  1.04259904  0.38939526  1.71739480 -0.33430079  0.52239057
#> [13,] -2.34853556  1.25475466  0.84855868 -0.87653694  0.94681725 -0.07623013
#> [14,] -1.23301912  0.69650062  0.24364744  0.35221831  1.00517071 -0.85601738
#> [15,] -2.32146728  0.90707702  1.59345546 -0.33982651 -0.51746875 -2.19885874
#> [16,] -2.64794221  0.70541253  0.78164085 -0.12218988  0.26382110 -0.97264696
#> [17,] -0.59024285  1.20133709  0.02691916 -0.45526058 -0.38894004 -0.51744565
#> [18,]  0.73649265  0.46852245 -0.18419048 -0.45872544 -0.30400190 -0.15411996
#> [19,] -1.18501704  0.09703486 -1.47443389 -0.31309733  0.46295088  0.22911528
#> [20,] -1.43906556  0.52556741  0.11066551 -0.46711508  0.70135198 -0.12657426
#> [21,]  0.33269832  1.15647992 -0.49742370 -0.49751150  0.03075929 -0.26023128
#> [22,] -1.28384132 -0.23799459 -0.21107354  0.50469061  0.13088191 -0.02655946
#> [23,]  0.97627971  0.70172088  0.20561742 -0.60785236 -0.37714270 -0.15010150
#> [24,] -2.35582456  0.03526826  0.80988172 -0.01076392  0.79025721 -0.53162513
#> [25,] -0.59059777 -0.27969847 -0.34246431  0.49615203  0.23346261 -0.50946404
try(predict(modpls,newdata=Xpine_supNA,type="scores",comps=8))
#> Error in predict.plsRglmmodel(modpls, newdata = Xpine_supNA, type = "scores",  : 
#>   Cannot predict using more components than extracted.
# }