R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("pls-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('pls') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "MSEP" > > ### * MSEP > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: MSEP > ### Title: MSEP, RMSEP and R2 of PLSR and PCR models > ### Aliases: MSEP RMSEP R2 > ### Keywords: regression multivariate > > ### ** Examples > > data(sensory) > mod <- plsr(Panel ~ Quality, ncomp = 4, data = sensory, validation = "LOO") > RMSEP(mod) Response: yellow (Intercept) 1 comps 2 comps 3 comps 4 comps CV 20.10 18.97 16.10 16.71 18.11 adjCV 20.10 18.91 16.03 16.61 17.93 Response: green (Intercept) 1 comps 2 comps 3 comps 4 comps CV 24.26 23.88 20.45 21.35 23.96 adjCV 24.26 23.80 20.35 21.20 23.70 Response: brown (Intercept) 1 comps 2 comps 3 comps 4 comps CV 5.297 4.019 3.987 3.987 4.107 adjCV 5.297 3.990 3.955 3.947 4.050 Response: glossy (Intercept) 1 comps 2 comps 3 comps 4 comps CV 6.391 5.109 5.161 5.571 6.446 adjCV 6.391 5.087 5.129 5.522 6.363 Response: transp (Intercept) 1 comps 2 comps 3 comps 4 comps CV 8.58 7.258 7.158 7.665 8.794 adjCV 8.58 7.232 7.118 7.607 8.691 Response: syrup (Intercept) 1 comps 2 comps 3 comps 4 comps CV 3.166 2.134 2.325 2.478 2.939 adjCV 3.166 2.128 2.310 2.458 2.901 > ## Not run: plot(R2(mod)) > > > > cleanEx(); ..nameEx <- "biplot.mvr" > > ### * biplot.mvr > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: biplot.mvr > ### Title: Biplots of PLSR and PCR Models. > ### Aliases: biplot.mvr > ### Keywords: regression multivariate hplot > > ### ** Examples > > data(sensory) > mod <- plsr(Panel ~ Quality, data = sensory) > ## Not run: > ##D ## These are equivalent > ##D biplot(mod) > ##D plot(mod, plottype = "biplot") > ##D > ##D ## The four combinations of x and y points: > ##D par(mfrow = c(2,2)) > ##D biplot(mod, which = "x") # Default > ##D biplot(mod, which = "y") > ##D biplot(mod, which = "scores") > ##D biplot(mod, which = "loadings") > ## End(Not run) > > > > cleanEx(); ..nameEx <- "coef.mvr" > > ### * coef.mvr > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: coef.mvr > ### Title: Extract Information From a Fitted PLSR or PCR Model > ### Aliases: coef.mvr model.matrix.mvr > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > mod <- pcr(y ~ X, data = NIR[NIR$train,], ncomp = 5) > B <- coef(mod, comps = 3, intercept = TRUE) > ## A manual predict method: > stopifnot(drop(B[1,,] + NIR$X[!NIR$train,] %*% B[-1,,]) == + drop(predict(mod, comps = 3, newdata = NIR[!NIR$train,]))) > > > > cleanEx(); ..nameEx <- "coefplot" > > ### * coefplot > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: coefplot > ### Title: Plot Regression Coefficients of PLSR and PCR models > ### Aliases: coefplot > ### Keywords: regression multivariate hplot > > ### ** Examples > > data(NIR) > mod.nir <- plsr(y ~ X, ncomp = 8, data = NIR) > ## Not run: > ##D coefplot(mod.nir, ncomp = 1:6) > ##D plot(mod.nir, plottype = "coefficients", ncomp = 1:6) # Equivalent to the previous > ## End(Not run) > > data(sensory) > mod.sens <- plsr(Quality ~ Panel, ncomp = 4, data = sensory) > ## Not run: coefplot(mod.sens, ncomp = 2:4, separate = TRUE) > > > > cleanEx(); ..nameEx <- "crossval" > > ### * crossval > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: crossval > ### Title: Cross-validation of PLSR and PCR models > ### Aliases: crossval > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > NIR.pcr <- pcr(y ~ msc(X), 6, data = NIR) > NIR.cv <- crossval(NIR.pcr, segments = 10) > plot(MSEP(NIR.cv)) > > > > cleanEx(); ..nameEx <- "cvsegments" > > ### * cvsegments > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: cvsegments > ### Title: Generate segments for cross-validation > ### Aliases: cvsegments > ### Keywords: models > > ### ** Examples > > ## Segments for 10-fold randomised cross-validation: > cvsegments(100, 10) $V1 [1] 27 19 75 87 50 24 99 11 80 52 $V2 [1] 37 16 17 42 39 85 47 71 66 74 $V3 [1] 57 61 51 70 46 22 18 35 8 68 $V4 [1] 89 34 10 13 82 12 95 31 91 72 $V5 [1] 20 67 21 55 30 4 60 40 33 93 $V6 [1] 86 43 29 44 65 5 77 49 92 15 $V7 [1] 97 88 1 78 2 14 41 76 100 56 $V8 [1] 62 83 28 7 84 23 53 9 54 48 $V9 [1] 58 32 81 45 59 73 3 38 98 90 $V10 [1] 6 63 25 26 36 79 69 64 94 96 attr(,"incomplete") [1] 0 attr(,"type") [1] "random" > > ## Segments with four objects, taken consecutive: > cvsegments(60, length.seg = 4, type = "cons") $V1 [1] 1 2 3 4 $V2 [1] 5 6 7 8 $V3 [1] 9 10 11 12 $V4 [1] 13 14 15 16 $V5 [1] 17 18 19 20 $V6 [1] 21 22 23 24 $V7 [1] 25 26 27 28 $V8 [1] 29 30 31 32 $V9 [1] 33 34 35 36 $V10 [1] 37 38 39 40 $V11 [1] 41 42 43 44 $V12 [1] 45 46 47 48 $V13 [1] 49 50 51 52 $V14 [1] 53 54 55 56 $V15 [1] 57 58 59 60 attr(,"incomplete") [1] 0 attr(,"type") [1] "consecutive" > > ## Incomplete segments > segs <- cvsegments(50, length.seg = 3) > attr(segs, "incomplete") [1] 1 > > ## Leave-one-out cross-validation: > cvsegments(100, 100) $V1 [1] 62 $V2 [1] 56 $V3 [1] 33 $V4 [1] 44 $V5 [1] 49 $V6 [1] 18 $V7 [1] 50 $V8 [1] 8 $V9 [1] 26 $V10 [1] 20 $V11 [1] 92 $V12 [1] 80 $V13 [1] 40 $V14 [1] 68 $V15 [1] 76 $V16 [1] 36 $V17 [1] 6 $V18 [1] 28 $V19 [1] 60 $V20 [1] 83 $V21 [1] 51 $V22 [1] 67 $V23 [1] 79 $V24 [1] 31 $V25 [1] 29 $V26 [1] 87 $V27 [1] 48 $V28 [1] 55 $V29 [1] 97 $V30 [1] 65 $V31 [1] 21 $V32 [1] 14 $V33 [1] 61 $V34 [1] 34 $V35 [1] 58 $V36 [1] 13 $V37 [1] 96 $V38 [1] 46 $V39 [1] 59 $V40 [1] 78 $V41 [1] 43 $V42 [1] 23 $V43 [1] 84 $V44 [1] 53 $V45 [1] 16 $V46 [1] 98 $V47 [1] 66 $V48 [1] 45 $V49 [1] 17 $V50 [1] 88 $V51 [1] 69 $V52 [1] 11 $V53 [1] 25 $V54 [1] 71 $V55 [1] 9 $V56 [1] 24 $V57 [1] 74 $V58 [1] 54 $V59 [1] 64 $V60 [1] 30 $V61 [1] 39 $V62 [1] 4 $V63 [1] 41 $V64 [1] 85 $V65 [1] 38 $V66 [1] 42 $V67 [1] 100 $V68 [1] 32 $V69 [1] 77 $V70 [1] 35 $V71 [1] 93 $V72 [1] 5 $V73 [1] 10 $V74 [1] 94 $V75 [1] 72 $V76 [1] 47 $V77 [1] 7 $V78 [1] 2 $V79 [1] 81 $V80 [1] 95 $V81 [1] 57 $V82 [1] 3 $V83 [1] 91 $V84 [1] 73 $V85 [1] 70 $V86 [1] 52 $V87 [1] 22 $V88 [1] 37 $V89 [1] 82 $V90 [1] 86 $V91 [1] 89 $V92 [1] 12 $V93 [1] 90 $V94 [1] 1 $V95 [1] 19 $V96 [1] 75 $V97 [1] 15 $V98 [1] 99 $V99 [1] 63 $V100 [1] 27 attr(,"incomplete") [1] 0 attr(,"type") [1] "leave-one-out" > ## Leave-one-out with variable/unknown data set size n: > n <- 50 > cvsegments(n, length.seg = 1) $V1 [1] 39 $V2 [1] 46 $V3 [1] 23 $V4 [1] 29 $V5 [1] 48 $V6 [1] 5 $V7 [1] 11 $V8 [1] 22 $V9 [1] 16 $V10 [1] 50 $V11 [1] 21 $V12 [1] 13 $V13 [1] 44 $V14 [1] 30 $V15 [1] 26 $V16 [1] 6 $V17 [1] 3 $V18 [1] 25 $V19 [1] 20 $V20 [1] 35 $V21 [1] 2 $V22 [1] 4 $V23 [1] 38 $V24 [1] 45 $V25 [1] 8 $V26 [1] 27 $V27 [1] 7 $V28 [1] 33 $V29 [1] 28 $V30 [1] 17 $V31 [1] 1 $V32 [1] 43 $V33 [1] 42 $V34 [1] 24 $V35 [1] 32 $V36 [1] 34 $V37 [1] 49 $V38 [1] 15 $V39 [1] 37 $V40 [1] 41 $V41 [1] 19 $V42 [1] 12 $V43 [1] 36 $V44 [1] 10 $V45 [1] 47 $V46 [1] 31 $V47 [1] 18 $V48 [1] 14 $V49 [1] 40 $V50 [1] 9 attr(,"incomplete") [1] 0 attr(,"type") [1] "leave-one-out" > > > > cleanEx(); ..nameEx <- "msc" > > ### * msc > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: msc > ### Title: Multiplicative Scatter Correction > ### Aliases: msc predict.msc makepredictcall.msc > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > ## Direct correction: > Ztrain <- msc(NIR$X[NIR$train,]) > Ztest <- predict(Ztrain, NIR$X[!NIR$train,]) > > ## Used in formula: > mod <- plsr(y ~ msc(X), ncomp = 6, data = NIR[NIR$train,]) > pred <- predict(mod, newdata = NIR[!NIR$train,]) # Automatically scatter correction > > > > cleanEx(); ..nameEx <- "mvr" > > ### * mvr > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: mvr > ### Title: Partial Least Squares and Principal Components Regression > ### Aliases: mvr pcr plsr > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > ## Default methods: > NIR.pcr <- pcr(y ~ X, 6, data = NIR, validation = "CV") > NIR.pls <- plsr(y ~ X, 6, data = NIR, validation = "CV") > > ## Alternative methods: > NIR.oscorespls <- mvr(y ~ X, 6, data = NIR, validation = "CV", + method = "oscorespls") > NIR.simpls <- mvr(y ~ X, 6, data = NIR, validation = "CV", + method = "simpls") > > data(sensory) > Pn <- scale(sensory$Panel) > Ql <- scale(sensory$Quality) > sens.pcr <- pcr(Ql ~ Pn, ncomp = 4) > sens.pls <- plsr(Ql ~ Pn, ncomp = 4) > > > > cleanEx(); ..nameEx <- "mvrCv" > > ### * mvrCv > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: mvrCv > ### Title: Cross-validation > ### Aliases: mvrCv > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > NIR.pcr <- pcr(y ~ X, 6, data = NIR, validation = "CV", segments = 10) > ## Not run: plot(MSEP(NIR.pcr)) > > > > cleanEx(); ..nameEx <- "plot.mvr" > > ### * plot.mvr > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: plot.mvr > ### Title: Plot Method for MVR objects > ### Aliases: plot.mvr > ### Keywords: regression multivariate hplot > > ### ** Examples > > data(NIR) > nir.pcr <- pcr(y ~ X, ncomp = 9, data = NIR, validation = "CV") > ## Not run: > ##D plot(nir.pcr, ncomp = 5) # Plot of cross-validated predictions > ##D plot(nir.pcr, "scores") # Score plot > ##D plot(nir.pcr, "loadings", comps = 1:3) # The three first loadings > ##D plot(nir.pcr, "coef", ncomp = 5) # Coefficients > ##D plot(nir.pcr, "val") # RMSEP curves > ##D plot(nir.pcr, "val", val.type = "MSEP", estimate = "CV") # CV MSEP > ## End(Not run) > > > > cleanEx(); ..nameEx <- "predict.mvr" > > ### * predict.mvr > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: predict.mvr > ### Title: Predict Method for PLSR and PCR > ### Aliases: predict.mvr > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > nir.mvr <- mvr(y ~ X, ncomp = 5, data = NIR[NIR$train,]) > > ## Predicted responses for models with 1, 2, 3 and 4 components > pred.resp <- predict(nir.mvr, comps = 1:4, newdata = NIR[!NIR$train,]) > > ## Predicted responses for a single model with components 1, 2, 3, 4 > predict(nir.mvr, comps = 1:4, cumulative = FALSE, newdata = NIR[!NIR$train,]) y 110 51.04992 22 50.72019 31 32.01454 41 34.29076 51 30.35994 61 20.57832 71 19.07786 > > ## Predicted scores > predict(nir.mvr, comps = 1:3, type = "scores", newdata = NIR[!NIR$train,]) Comp 1 Comp 2 Comp 3 110 0.141826839 0.06103555 -0.1868236 22 0.142264852 -0.03200534 -0.1335956 31 0.003114755 0.14183105 -0.2645071 41 0.027585394 0.02948577 -0.2574162 51 -0.006228066 -0.11556152 -0.1281703 61 -0.095932724 0.13546998 -0.1292624 71 -0.082835344 -0.04981311 -0.2493806 > > > > cleanEx(); ..nameEx <- "predplot" > > ### * predplot > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: predplot > ### Title: Prediction Plots > ### Aliases: predplot predplot.default predplot.mvr predplotXy > ### Keywords: regression multivariate hplot > > ### ** Examples > > data(NIR) > mod <- plsr(y ~ X, ncomp = 10, data = NIR[NIR$train,], validation = "CV") > ## Not run: > ##D predplot(mod, ncomp = 1:6) > ##D plot(mod, ncomp = 1:6) # Equivalent to the previous > ##D ## Both cross-validated and test set predictions: > ##D predplot(mod, ncomp = 4:6, which = c("validation", "test"), > ##D newdata = NIR[!NIR$train,]) > ## End(Not run) > > data(sensory) > mod.sens <- plsr(Quality ~ Panel, ncomp = 4, data = sensory) > ## Not run: plot(mod.sens, ncomp = 2:4) # Several responses gives several plots > > > > cleanEx(); ..nameEx <- "scoreplot" > > ### * scoreplot > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: scoreplot > ### Title: Plots of Scores and Loadings > ### Aliases: scoreplot plot.scores loadingplot plot.loadings > ### Keywords: regression multivariate hplot > > ### ** Examples > > data(NIR) > mod <- plsr(y ~ X, ncomp = 10, data = NIR) > ## These three are equivalent: > ## Not run: > ##D scoreplot(mod, comps = 1:5) > ##D plot(scores(mod), comps = 1:5) > ##D plot(mod, plottype = "scores", comps = 1:5) > ##D > ##D loadingplot(mod, comps = 1:5) > ##D loadingplot(mod, comps = 1:5, scatter = TRUE) # Plot as scatterplots > ## End(Not run) > > > > cleanEx(); ..nameEx <- "scores" > > ### * scores > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: scores > ### Title: Extract Scores and Loadings from PLSR and PCR Models > ### Aliases: scores scores.prcomp scores.default loading.weights Yscores > ### Yloadings > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > plsmod <- plsr(y ~ X, 6, data = NIR) > scores(plsmod) Comp 1 Comp 2 Comp 3 Comp 4 Comp 5 1 0.409179813 -0.008784768 0.523728078 -0.023590598 0.28257621 2 0.290221737 0.086251903 0.282727042 0.129470112 -0.06046771 3 0.335401827 -0.079546117 0.068941588 -0.158106337 0.24942764 4 0.158491452 0.174388578 0.152801468 0.235291233 -0.16995631 5 0.193879472 0.011561311 -0.001745150 0.002704967 -0.17175315 6 0.222557826 -0.171330892 -0.025111808 -0.282910278 -0.21359642 7 0.041285552 0.268429180 -0.159925584 0.225199369 0.20048867 8 0.048482910 0.096640503 -0.103900617 0.139677315 -0.11884022 9 0.101484377 -0.064648475 -0.384088009 -0.076118114 0.43869619 10 0.102290460 -0.259149228 -0.220365644 -0.247923898 -0.14720275 11 -0.100297791 0.299597676 0.042515273 -0.126051034 -0.31191605 12 -0.107259164 0.166769818 -0.009491464 0.130753404 -0.22444482 13 -0.094778901 0.017041622 -0.076235656 0.115579526 -0.07487045 14 -0.076731273 -0.165801118 -0.086620635 -0.012218665 -0.14918846 15 -0.061013351 -0.350839672 -0.120832487 -0.138514150 0.01823246 16 -0.230537785 0.335861951 0.136569922 -0.683816959 0.04495015 17 -0.254876960 0.224228500 0.075408412 -0.171633405 0.23942238 18 -0.270541343 0.090285664 0.141261029 0.081073584 0.12590512 19 -0.274626332 -0.083837842 0.199690644 0.166568223 0.09043754 20 -0.271111813 -0.260331335 0.264987363 0.126705480 -0.03768058 21 -0.255341535 -0.451910791 0.235800476 0.065335843 0.06570659 110 0.133172382 0.054578692 -0.124627601 0.083301894 0.02879014 22 0.134068706 -0.035955155 -0.078724797 -0.026706391 -0.21906668 31 -0.002170868 0.132022347 -0.196235931 0.158751024 0.10454883 41 0.022155628 0.022981746 -0.192941963 0.076277632 0.03129014 51 -0.010006843 -0.118469389 -0.080107295 -0.019172099 -0.25880544 61 -0.098439346 0.124747279 -0.076108930 0.145860618 -0.05596695 71 -0.084938838 -0.054781990 -0.187367726 0.084211702 0.29328394 Comp 6 1 0.193939979 2 -0.053356965 3 -0.103978058 4 -0.132615654 5 -0.015532301 6 0.129509559 7 -0.389401093 8 0.042956978 9 -0.004961549 10 0.024554706 11 -0.325154216 12 0.034059989 13 0.212751948 14 0.138872268 15 -0.189557215 16 -0.044365115 17 0.061696627 18 0.257267305 19 0.229917542 20 0.076976519 21 -0.563830941 110 -0.086860035 22 0.040759248 31 -0.043636342 41 0.158765785 51 0.210824202 61 -0.011601908 71 0.151998735 attr(,"class") [1] "scores" > loadings(plsmod)[,1:4] Comp 1 Comp 2 Comp 3 Comp 4 X1 0.0741483603 0.1604154071 -0.1931935400 -0.0239400227 X2 0.2387328225 0.3391554985 -0.2386958521 -0.0454774962 X3 0.4373925427 0.5904104458 -0.2252121027 -0.0653496912 X4 0.5800264394 0.8583944416 -0.1472653481 -0.0564667700 X5 0.6016293715 1.0872608096 -0.0556917663 -0.0420557952 X6 0.5161563261 1.2718581472 0.0030901834 -0.0365405351 X7 0.3531572365 1.4303571397 0.0253848088 -0.0389396594 X8 0.1282969872 1.5622222811 0.0218854956 -0.0462387101 X9 -0.1308499175 1.6794551690 0.0024123580 -0.0509075564 X10 -0.3958223831 1.8153512286 -0.0277874169 -0.0450939196 X11 -0.6641502692 1.9799226026 -0.0640975734 -0.0288712888 X12 -0.9297808414 2.1555547795 -0.1007036726 -0.0053982251 X13 -1.1557875628 2.3225018929 -0.1355135743 0.0267694682 X14 -1.3182193914 2.4682377834 -0.1709282279 0.0740056718 X15 -1.4586292588 2.5954648227 -0.2105910558 0.1363118421 X16 -1.6409291647 2.7008904066 -0.2566474526 0.2015230837 X17 -1.8358353455 2.7690680589 -0.2941492923 0.2415733656 X18 -1.9512747291 2.7831511101 -0.3076503262 0.2307915052 X19 -1.9405169072 2.7421292849 -0.2938798097 0.1676869203 X20 -1.8122901437 2.6461203546 -0.2540394105 0.0639891171 X21 -1.6216674276 2.4843536154 -0.1981967805 -0.0532103032 X22 -1.4293682568 2.2613046401 -0.1467444408 -0.1440561490 X23 -1.2424664053 2.0221652004 -0.1115732926 -0.1877755312 X24 -1.0589354408 1.7812534663 -0.0862383587 -0.1950127610 X25 -0.9485616833 1.5298457408 -0.0687940799 -0.1901492790 X26 -0.9379221047 1.2978389885 -0.0577587172 -0.1826022819 X27 -0.9049070932 1.0634837219 -0.0495838208 -0.1622245893 X28 -0.7067004492 0.7567267718 -0.0620176600 -0.1033779532 X29 -0.4370154656 0.4667995366 -0.0753128406 -0.0534623092 X30 -0.2184258652 0.2631852657 -0.0748881596 -0.0233161791 X31 -0.0924159328 0.1498612504 -0.0679395260 -0.0058692510 X32 -0.0584859186 0.1066876155 -0.0632397482 0.0000780767 X33 -0.0813919962 0.1061429591 -0.0639740763 -0.0010424222 X34 -0.1175962532 0.1242608780 -0.0680683629 -0.0045039730 X35 -0.1551773107 0.1296698501 -0.0730965451 -0.0070978793 X36 -0.2062580375 0.0917541514 -0.0800994911 -0.0072361058 X37 -0.2669383345 0.0376422459 -0.0890970745 -0.0061900362 X38 -0.3235119918 0.0258336511 -0.0978405863 -0.0080110312 X39 -0.3656856740 0.0340655611 -0.1057635264 -0.0111844540 X40 -0.3828480019 0.0092651923 -0.1121558897 -0.0096967903 X41 -0.3655078661 -0.0269339459 -0.1143819312 -0.0054619918 X42 -0.3340756750 -0.0187643145 -0.1109950578 -0.0044026653 X43 -0.3292284126 0.0202365891 -0.1065412445 -0.0070858043 X44 -0.3518787056 0.0257932474 -0.1084044654 -0.0092229375 X45 -0.3751723373 -0.0138013361 -0.1154863536 -0.0080990939 X46 -0.3837466462 -0.0207784619 -0.1201560274 -0.0089665622 X47 -0.3768316068 0.0530633452 -0.1175670701 -0.0150364721 X48 -0.3862588164 0.1213234977 -0.1140580650 -0.0214897473 X49 -0.4296882403 0.1270471916 -0.1213122141 -0.0239663046 X50 -0.4827664642 0.1108331143 -0.1358097061 -0.0255565906 X51 -0.5110094095 0.0434932901 -0.1512012542 -0.0215705780 X52 -0.4666649289 -0.1790387553 -0.1707725071 0.0025042688 X53 -0.3609060751 -0.4275437002 -0.1842444028 0.0233456325 X54 -0.2643699746 -0.5115207306 -0.1803706589 0.0337808413 X55 -0.1851850784 -0.3865232113 -0.1595724044 0.0319140900 X56 -0.1309215643 -0.1171838176 -0.1285883300 0.0082919386 X57 -0.1135732514 0.1253834533 -0.0989369680 -0.0245761107 X58 -0.0550565771 0.1435692730 -0.0889339542 -0.0254046520 X59 0.0532298501 0.0097420806 -0.0852074221 -0.0037923550 X60 0.0919246986 -0.1178337069 -0.0819773469 0.0231981497 X61 0.0576092058 -0.2128517989 -0.0924097756 0.0460810889 X62 0.0706542375 -0.2292484778 -0.1017709160 0.0559662050 X63 0.1458904566 -0.1676330944 -0.0951809097 0.0546122408 X64 0.1591759067 -0.1151393407 -0.0829709008 0.0464889991 X65 0.0881304572 -0.0561309547 -0.0746763225 0.0266164562 X66 0.0802605878 0.1183990348 -0.0737014966 -0.0016686251 X67 0.1676941546 0.2352252690 -0.0629852024 -0.0146908092 X68 0.2914118046 0.4964959669 -0.0701288784 -0.0270924198 X69 0.7145301820 0.8836668744 -0.0488286425 -0.0329452680 X70 1.1197109724 0.7994978353 0.0261514199 0.0240618453 X71 1.2760432522 0.6108850235 0.0627945281 0.0490677142 X72 1.2979061154 0.4829525854 0.0681895695 0.0600822686 X73 1.2722659556 0.4186312349 0.0645261777 0.0650601575 X74 1.2364421674 0.3868834966 0.0594106933 0.0661678452 X75 1.2027098200 0.3676388715 0.0536092810 0.0656260556 X76 1.1782765615 0.3541143655 0.0477320725 0.0644931191 X77 1.1682106095 0.3458326206 0.0418194277 0.0634709552 X78 1.1728572858 0.3429901270 0.0351188080 0.0627498082 X79 1.1895327523 0.3444056128 0.0266353684 0.0626439553 X80 1.2163438735 0.3491461694 0.0176778265 0.0622267584 X81 1.2494546517 0.3575054793 0.0085026234 0.0608481666 X82 1.2805270999 0.3703477290 -0.0047175161 0.0597281139 X83 1.3016320242 0.3869447664 -0.0242754376 0.0586209887 X84 1.3107389228 0.4031858446 -0.0502231566 0.0565197620 X85 1.3079045726 0.4131715086 -0.0797171438 0.0543905659 X86 1.2899825968 0.4139734731 -0.1119123500 0.0525597902 X87 1.2629606380 0.4078159803 -0.1475610447 0.0491859607 X88 1.2307534759 0.4027644789 -0.1814687413 0.0443981647 X89 1.1884589987 0.4076642651 -0.2130351550 0.0425927798 X90 1.1450458271 0.4209518473 -0.2397087577 0.0368291926 X91 1.1162032626 0.4352226013 -0.2507985882 0.0231996229 X92 1.0993048067 0.4499443517 -0.2552473696 0.0107458315 X93 1.0852249069 0.4677180756 -0.2610998183 0.0013992605 X94 1.0794296946 0.4863708304 -0.2667764115 -0.0035578311 X95 1.0852975483 0.5071963374 -0.2763927659 -0.0042091854 X96 1.1051597036 0.5310181721 -0.2813566617 -0.0025486447 X97 1.1350983055 0.5494108839 -0.2802487833 0.0011990524 X98 1.1601384495 0.5581229086 -0.2769773108 0.0049763595 X99 1.1811114678 0.5625195900 -0.2630693466 0.0055265150 X100 1.2049447034 0.5651882821 -0.2409276334 0.0040286629 X101 1.2259618108 0.5702573022 -0.2213017746 0.0059794876 X102 1.2360452416 0.5774796031 -0.2050465578 0.0104852502 X103 1.2360032290 0.5832588188 -0.1903738750 0.0121960959 X104 1.2324224566 0.5901899189 -0.1749124584 0.0130492582 X105 1.2250098767 0.5949735131 -0.1573322904 0.0109678115 X106 1.2104000305 0.5980553652 -0.1441594374 0.0067857850 X107 1.1917605531 0.6031315120 -0.1361594778 0.0055333531 X108 1.1709369841 0.6084708929 -0.1283820178 0.0040707295 X109 1.1495867661 0.6155138484 -0.1204532284 0.0014675270 X110 1.1327489808 0.6254308844 -0.1119616430 -0.0003332830 X111 1.1183918017 0.6367456232 -0.1048162072 -0.0014269434 X112 1.1031596503 0.6500007959 -0.1009880354 -0.0037184872 X113 1.0880071593 0.6664239861 -0.0956513446 -0.0095545342 X114 1.0720944521 0.6870080470 -0.0835047580 -0.0152097839 X115 1.0530017483 0.7122344562 -0.0693076913 -0.0189695561 X116 1.0365569107 0.7386729849 -0.0609310277 -0.0226284375 X117 1.0291400691 0.7668856216 -0.0537699186 -0.0248242107 X118 1.0265015006 0.7978326777 -0.0442845726 -0.0268873576 X119 1.0228441575 0.8265587815 -0.0337190928 -0.0299187442 X120 1.0169899581 0.8518186122 -0.0234448259 -0.0326886487 X121 1.0101424562 0.8747643381 -0.0120641182 -0.0354612241 X122 1.0015719063 0.8942954505 0.0002400852 -0.0367963344 X123 0.9919797065 0.9123160740 0.0096984410 -0.0380556197 X124 0.9848908253 0.9357652817 0.0182136810 -0.0400215988 X125 0.9799594780 0.9664075538 0.0300942638 -0.0413923158 X126 0.9752290905 0.9946815548 0.0433808313 -0.0426625339 X127 0.9722961714 1.0113283229 0.0544406697 -0.0442702908 X128 0.9652944890 1.0164582308 0.0675713655 -0.0439304508 X129 0.9348034557 1.0117697554 0.0827688840 -0.0414880834 X130 0.8761566260 0.9972974911 0.0918841442 -0.0401893283 X131 0.8118188232 0.9725477905 0.0942121915 -0.0410505765 X132 0.7586375481 0.9347204442 0.0934507062 -0.0415465255 X133 0.7189239134 0.8868321616 0.0913273301 -0.0400584896 X134 0.6877077329 0.8391874392 0.0887279360 -0.0383947758 X135 0.6548386782 0.7975166173 0.0855534695 -0.0379615514 X136 0.6121697285 0.7569403593 0.0814493050 -0.0381327923 X137 0.5664704616 0.7134544248 0.0759528961 -0.0379173657 X138 0.5332804660 0.6700900694 0.0700202931 -0.0371677604 X139 0.5143222670 0.6310860426 0.0654797388 -0.0356870891 X140 0.4987348023 0.5905182775 0.0615364431 -0.0330797793 X141 0.4790169653 0.5348961331 0.0576172724 -0.0286358321 X142 0.4474411936 0.4552012837 0.0562666709 -0.0225397941 X143 0.4103730318 0.3614305324 0.0573038040 -0.0153389444 X144 0.4051669962 0.2866240781 0.0537398343 -0.0092454594 X145 0.4351727623 0.2533475173 0.0411863778 -0.0060147463 X146 0.4437556826 0.2504474162 0.0265871893 -0.0048060686 X147 0.3840762024 0.2510771915 0.0168145900 -0.0054387271 X148 0.2571887612 0.2332363895 0.0072226928 -0.0087017142 X149 0.1106163347 0.1957370090 -0.0066785005 -0.0130956783 X150 0.0113648788 0.1614874504 -0.0208938256 -0.0160983895 X151 -0.0066668777 0.1470177554 -0.0299737865 -0.0161997634 X152 0.0346515085 0.1327483749 -0.0329288032 -0.0110577242 X153 0.0826470769 0.1108788117 -0.0328010548 -0.0034414049 X154 0.1075051771 0.1065313146 -0.0322074256 0.0009384429 X155 0.1307688889 0.1163900217 -0.0307011698 0.0027828269 X156 0.1722122504 0.1159253610 -0.0269011481 0.0060288148 X157 0.2139435483 0.1133098608 -0.0211826690 0.0092531414 X158 0.2319243598 0.1246168633 -0.0162091518 0.0098539356 X159 0.2248338251 0.1421333158 -0.0140893262 0.0081767455 X160 0.2015465243 0.1537429234 -0.0151131571 0.0060422522 X161 0.1780073360 0.1560700979 -0.0180129204 0.0045653412 X162 0.1798980891 0.1471134053 -0.0192246080 0.0051709609 X163 0.1970894986 0.1302457883 -0.0164654726 0.0077803541 X164 0.1901602746 0.1146441931 -0.0150746996 0.0093035030 X165 0.1580162558 0.1015625474 -0.0185234823 0.0087479378 X166 0.1240637703 0.0892205245 -0.0238995273 0.0077656328 X167 0.0984232477 0.0779841991 -0.0286190374 0.0073402975 X168 0.0788213871 0.0683757962 -0.0320040419 0.0071685143 X169 0.0625630864 0.0600070618 -0.0346245459 0.0070840343 X170 0.0488311005 0.0525230126 -0.0371236433 0.0071821621 X171 0.0371947578 0.0458917497 -0.0392955388 0.0072512342 X172 0.0275603205 0.0402342918 -0.0409770107 0.0072223121 X173 0.0199832392 0.0356166728 -0.0424560208 0.0072572277 X174 0.0137596346 0.0316739002 -0.0437455610 0.0072612663 X175 0.0081161658 0.0279832641 -0.0446374527 0.0071930647 X176 0.0029669966 0.0245922654 -0.0455172829 0.0072286247 X177 -0.0018990375 0.0216241453 -0.0464105549 0.0072750624 X178 -0.0067814583 0.0189249316 -0.0470887722 0.0071676738 X179 -0.0112984817 0.0164751411 -0.0477693683 0.0070646414 X180 -0.0151238620 0.0144599468 -0.0485365804 0.0070736986 X181 -0.0184056481 0.0129592571 -0.0490751495 0.0069523222 X182 -0.0209353467 0.0119407992 -0.0494221410 0.0067901932 X183 -0.0223940360 0.0112566879 -0.0498905851 0.0068041273 X184 -0.0232850200 0.0103166261 -0.0501505088 0.0068596993 X185 -0.0241272148 0.0088667958 -0.0501845992 0.0068951026 X186 -0.0248236641 0.0074102285 -0.0503885414 0.0070204378 X187 -0.0254239260 0.0065131196 -0.0506081543 0.0070799605 X188 -0.0259874272 0.0061206308 -0.0506695021 0.0069933193 X189 -0.0259406523 0.0059256217 -0.0507455594 0.0070026657 X190 -0.0250813008 0.0056009584 -0.0508536350 0.0071148886 X191 -0.0238391698 0.0048874124 -0.0506515634 0.0072102081 X192 -0.0223003488 0.0037328461 -0.0504241492 0.0073691003 X193 -0.0204547704 0.0024218285 -0.0504055689 0.0076604862 X194 -0.0184411153 0.0015051952 -0.0502251418 0.0077937735 X195 -0.0159467586 0.0016215573 -0.0498839476 0.0077652372 X196 -0.0128216664 0.0028007451 -0.0495912416 0.0078218284 X197 -0.0097987629 0.0041323344 -0.0491839477 0.0078839635 X198 -0.0078503790 0.0049943107 -0.0485900013 0.0078694751 X199 -0.0082231966 0.0054376321 -0.0482400902 0.0078615822 X200 -0.0128120169 0.0051594984 -0.0481244129 0.0077100459 X201 -0.0223273068 0.0035811692 -0.0482499203 0.0072878720 X202 -0.0356155387 0.0009081289 -0.0490246699 0.0067857295 X203 -0.0513385376 -0.0022832068 -0.0504229752 0.0062337821 X204 -0.0684002884 -0.0053948318 -0.0520426578 0.0053746501 X205 -0.0853415283 -0.0077495132 -0.0538179671 0.0044018959 X206 -0.1011319652 -0.0097667004 -0.0558055016 0.0035584450 X207 -0.1159741582 -0.0122586514 -0.0576122351 0.0027525435 X208 -0.1303445330 -0.0147049174 -0.0591995056 0.0018987575 X209 -0.1443121040 -0.0162179075 -0.0608911685 0.0010433832 X210 -0.1567443743 -0.0170136021 -0.0627793788 0.0001465063 X211 -0.1647480889 -0.0181215986 -0.0647507545 -0.0005210089 X212 -0.1667215678 -0.0209188730 -0.0666276888 -0.0005537706 X213 -0.1646977505 -0.0267608534 -0.0680246236 -0.0001389930 X214 -0.1621338931 -0.0350945865 -0.0687853059 0.0003768218 X215 -0.1605378441 -0.0442242321 -0.0695860132 0.0009917884 X216 -0.1597413293 -0.0541920381 -0.0706411871 0.0016693251 X217 -0.1597712096 -0.0674063103 -0.0717408387 0.0024985385 X218 -0.1608883803 -0.0879102517 -0.0734556306 0.0038912185 X219 -0.1599551560 -0.1180192224 -0.0764294654 0.0062882065 X220 -0.1473007387 -0.1534908220 -0.0801301935 0.0099623958 X221 -0.1135440080 -0.1857552294 -0.0826058547 0.0146828508 X222 -0.0635483147 -0.2089041585 -0.0814125342 0.0195733306 X223 -0.0193000077 -0.2225269521 -0.0758261112 0.0234460801 X224 -0.0009643496 -0.2290002960 -0.0696935203 0.0254860615 X225 -0.0078537121 -0.2289346359 -0.0669455873 0.0258782574 X226 -0.0314396738 -0.2192345323 -0.0664166452 0.0245055310 X227 -0.0746062810 -0.1904418272 -0.0665553003 0.0201636615 X228 -0.1384370840 -0.1335862150 -0.0687812005 0.0119226287 X229 -0.2027260946 -0.0585055277 -0.0731743292 0.0013659246 X230 -0.2345692463 0.0099389218 -0.0764917922 -0.0074665867 X231 -0.2156764462 0.0521206307 -0.0756666618 -0.0110429953 X232 -0.1589788341 0.0629316225 -0.0701257717 -0.0088414625 X233 -0.0966601222 0.0563862266 -0.0621933251 -0.0042594988 X234 -0.0544227609 0.0492031253 -0.0548733874 -0.0004830207 X235 -0.0379193956 0.0441461452 -0.0501990811 0.0018481989 X236 -0.0351637365 0.0395277809 -0.0486611132 0.0029272201 X237 -0.0309299796 0.0367597063 -0.0487458384 0.0033464960 X238 -0.0206349200 0.0358712165 -0.0487117436 0.0038382025 X239 -0.0081870113 0.0342664347 -0.0479040757 0.0045446013 X240 0.0039302554 0.0287925436 -0.0468304510 0.0056712425 X241 0.0154234020 0.0185847107 -0.0462102441 0.0074317823 X242 0.0261521657 0.0074944546 -0.0459737604 0.0092952310 X243 0.0366519530 -0.0007405944 -0.0454607566 0.0106838377 X244 0.0440667839 -0.0071709271 -0.0445049414 0.0117562197 X245 0.0423435161 -0.0129052352 -0.0438383238 0.0123864232 X246 0.0297235127 -0.0150712098 -0.0438921566 0.0120934853 X247 0.0101938917 -0.0109479085 -0.0447189657 0.0107942170 X248 -0.0114272803 -0.0016331463 -0.0461979048 0.0087970141 X249 -0.0278196523 0.0106943336 -0.0479309321 0.0065676629 X250 -0.0311715143 0.0225000405 -0.0488436381 0.0051122801 X251 -0.0245404830 0.0291105375 -0.0483696921 0.0050415967 X252 -0.0173582886 0.0293506680 -0.0472047959 0.0056731914 X253 -0.0128723589 0.0246834286 -0.0462643019 0.0063575362 X254 -0.0098540933 0.0173698686 -0.0460327185 0.0071614301 X255 -0.0086194752 0.0096943152 -0.0462447578 0.0080041882 X256 -0.0096283730 0.0030895455 -0.0466673484 0.0086364125 X257 -0.0121172943 -0.0020875704 -0.0475161814 0.0091646711 X258 -0.0158198559 -0.0061318350 -0.0485284597 0.0094696282 X259 -0.0204671140 -0.0090405341 -0.0493704993 0.0094091086 X260 -0.0249258210 -0.0105073281 -0.0501464066 0.0092315208 X261 -0.0282609035 -0.0113699661 -0.0509220595 0.0091297697 X262 -0.0307726467 -0.0127151557 -0.0513972245 0.0090514870 X263 -0.0328082146 -0.0140819410 -0.0517306968 0.0090248057 X264 -0.0342628659 -0.0147274759 -0.0521745043 0.0090947436 X265 -0.0353761638 -0.0148710131 -0.0524369547 0.0091074984 X266 -0.0361260390 -0.0149963730 -0.0524656169 0.0090149688 X267 -0.0364028401 -0.0152672534 -0.0525303511 0.0090100077 X268 -0.0364405491 -0.0156934585 -0.0526432200 0.0090917580 > > > > cleanEx(); ..nameEx <- "summary.mvr" > > ### * summary.mvr > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: summary.mvr > ### Title: Summary and Print Methods for PLSR and PCR objects > ### Aliases: summary.mvr print.mvr print.mvrVal > ### Keywords: regression multivariate > > ### ** Examples > > data(NIR) > nir.mvr <- mvr(y ~ X, ncomp = 8, validation = "LOO", data = NIR) > nir.mvr Partial least squares regression, fitted with the kernel algorithm. Cross-validated using 28 leave-one-out segments. Call: mvr(formula = y ~ X, ncomp = 8, data = NIR, validation = "LOO") > summary(nir.mvr) Data: X dimension: 28 268 Y dimension: 28 1 Fit method: kernelpls Number of components considered: 8 VALIDATION: RMSEP Cross-validated using 28 leave-one-out segments. (Intercept) 1 comps 2 comps 3 comps 4 comps 5 comps 6 comps CV 27.46 4.600 3.900 2.090 0.7686 0.5004 0.4425 adjCV 27.46 4.454 3.973 2.084 0.7570 0.4967 0.4398 7 comps 8 comps CV 0.2966 0.2643 adjCV 0.2926 0.2610 TRAINING: % variance explained 1 comps 2 comps 3 comps 4 comps 5 comps 6 comps 7 comps 8 comps X 46.83 98.38 99.46 99.67 99.85 99.97 99.98 99.99 y 98.12 98.25 99.64 99.97 99.99 99.99 100.00 100.00 > RMSEP(nir.mvr) (Intercept) 1 comps 2 comps 3 comps 4 comps 5 comps 6 comps CV 27.46 4.600 3.900 2.090 0.7686 0.5004 0.4425 adjCV 27.46 4.454 3.973 2.084 0.7570 0.4967 0.4398 7 comps 8 comps CV 0.2966 0.2643 adjCV 0.2926 0.2610 > > > > cleanEx(); ..nameEx <- "validationplot" > > ### * validationplot > > flush(stderr()); flush(stdout()) > > ### Encoding: latin1 > > ### Name: validationplot > ### Title: Validation Plots > ### Aliases: validationplot plot.mvrVal > ### Keywords: regression multivariate hplot > > ### ** Examples > > data(sensory) > mod <- plsr(Panel ~ Quality, data = sensory, validation = "LOO") > ## Not run: > ##D ## These three are equivalent: > ##D validationplot(mod, estimate = "all") > ##D plot(mod, "validation", estimate = "all") > ##D plot(RMSEP(mod, estimate = "all")) > ##D ## Plot R2: > ##D plot(mod, "validation", val.type = "R2") > ## End(Not run) > > > > ### *