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.pcr-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.pcr') This package has been superseded by the package 'pls', authored by Bjørn-Helge Mevik and Ron Wehrens. Package 'pls.pcr' will not be actively supported anymore, and will eventually be deprecated. > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "kernelpls" > > ### * kernelpls > > flush(stderr()); flush(stdout()) > > ### Name: kernelpls > ### Title: Kernel PLS (Dayal and MacGregor) > ### Aliases: kernelpls > ### Keywords: regression > > ### ** Examples > > data(NIR) > attach(NIR) > NIR.kernelpls <- mvr(Xtrain, Ytrain, 1:6, validation="CV", method="kernelPLS") > > > > cleanEx(); ..nameEx <- "mvr" > > ### * mvr > > flush(stderr()); flush(stdout()) > > ### Name: mvr > ### Title: Multivariate Regression > ### Aliases: mvr pcr pls > ### Keywords: regression > > ### ** Examples > > data(NIR) > attach(NIR) > NIR.pcr <- mvr(Xtrain, Ytrain, 1:6, validation="CV") > NIR.simpls <- mvr(Xtrain, Ytrain, 1:6, validation="CV", method="SIMPLS") > NIR.kernelpls <- mvr(Xtrain, Ytrain, 1:6, validation="CV", method="kernelPLS") > > data(sensory) > Pn <- scale(sensory$Panel) > Ql <- scale(sensory$Quality) > sens.pcr <- mvr(Ql, Pn, 1:5) > sens.simpls <- mvr(Ql, Pn, 1:5, method="SIMPLS") > sens.kernelpls <- mvr(Ql, Pn, 1:5, method="kernelPLS") > > > > cleanEx(); ..nameEx <- "plot.mvr" > > ### * plot.mvr > > flush(stderr()); flush(stdout()) > > ### Name: plot.mvr > ### Title: Plot a MVR object > ### Aliases: plot.mvr > ### Keywords: regression > > ### ** Examples > > data(NIR) > attach(NIR) > nir.pcr <- pcr(Xtrain,Ytrain,1:9, validat="CV") > ## Not run: plot(nir.pcr) > plot(nir.pcr, "coefficients", nlv=3:6, type="l") > ## Not run: plot(nir.pcr, "prediction", nlv=3:6) > plot(nir.pcr, "prediction", nlv=3:6, which=2) > > data(sensory) > Pn <- scale(sensory$Panel) > Ql <- scale(sensory$Quality) > sens.simpls <- mvr(Ql, Pn, 1:5, method="SIMPLS") > plot(sens.simpls, "loadings") > plot(sens.simpls, "scores") > > > > cleanEx(); ..nameEx <- "predict.mvr" > > ### * predict.mvr > > flush(stderr()); flush(stdout()) > > ### Name: predict.mvr > ### Title: MVR predictions > ### Aliases: predict.mvr > ### Keywords: regression > > ### ** Examples > > data(NIR) > attach(NIR) > nir.mvr <- mvr(Xtrain, Ytrain, 2) > nir.predictions <- predict(nir.mvr, Xtest) > > > > cleanEx(); ..nameEx <- "simpls" > > ### * simpls > > flush(stderr()); flush(stdout()) > > ### Name: simpls > ### Title: De Jong's SIMPLS > ### Aliases: simpls > ### Keywords: regression > > ### ** Examples > > data(NIR) > attach(NIR) > NIR.simpls <- mvr(Xtrain, Ytrain, 1:6, validation="CV", method="SIMPLS") > > > > cleanEx(); ..nameEx <- "summary.mvr" > > ### * summary.mvr > > flush(stderr()); flush(stdout()) > > ### Name: summary.mvr > ### Title: Summary of a MVR object > ### Aliases: summary.mvr > ### Keywords: regression > > ### ** Examples > > data(NIR) > attach(NIR) > nir.mvr <- mvr(Xtrain, Ytrain, 2:8, valid="CV", grps=1) > summary(nir.mvr) Data: X dimension: 21 268 Y dimension: 21 1 Method: PCR Number of latent variables considered: 2-8 Suggested number of latent variables: 8 (cross validation) VALIDATION: Y RMS sd(RMS) Q^2 2 LV's 4.8361 1.08069 0.9737 3 LV's 2.7033 0.60446 0.9918 4 LV's 2.5618 0.57156 0.9928 5 LV's 1.7195 0.38243 0.9968 6 LV's 0.5782 0.12917 0.9996 7 LV's 0.6199 0.13840 0.9996 8 LV's 0.3394 0.07535 0.9999 TRAINING: % variance explained X Y 2 LV's 98.78 98.21 3 LV's 99.51 99.47 4 LV's 99.74 99.77 5 LV's 99.89 99.95 6 LV's 99.98 99.99 7 LV's 99.99 99.99 8 LV's 99.99 100.00 > > > > ### *