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("gpls-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('gpls') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "glpls1a" > > ### * glpls1a > > flush(stderr()); flush(stdout()) > > ### Name: glpls1a > ### Title: Fit IRWPLS and IRWPLSF model > ### Aliases: glpls1a > ### Keywords: regression > > ### ** Examples > > x <- matrix(rnorm(20),ncol=2) > y <- sample(0:1,10,TRUE) > ## no bias reduction > glpls1a(x,y,br=FALSE) Call: NULL Coefficients: Intercept X:1 X:2 2.973 -2.878 -1.259 > > ## no bias reduction and 1 PLS component > glpls1a(x,y,K.prov=1,br=FALSE) Call: NULL Coefficients: Intercept X:1 X:2 2.809 -2.486 -1.363 > > ## bias reduction > glpls1a(x,y,br=TRUE) Call: NULL Coefficients: Intercept X:1 X:2 1.4564 -1.1928 -0.4512 > > > > cleanEx(); ..nameEx <- "glpls1a.cv.error" > > ### * glpls1a.cv.error > > flush(stderr()); flush(stdout()) > > ### Name: glpls1a.cv.error > ### Title: Leave-one-out cross-validation error using IRWPLS and IRWPLSF > ### model > ### Aliases: glpls1a.cv.error > ### Keywords: regression > > ### ** Examples > > x <- matrix(rnorm(20),ncol=2) > y <- sample(0:1,10,TRUE) > > ## no bias reduction > glpls1a.cv.error(x,y,br=FALSE) $error [1] 0.4 $error.obs [1] 4 7 8 9 > ## bias reduction and 1 PLS component > glpls1a.cv.error(x,y,K.prov=1, br=TRUE) $error [1] 0.3 $error.obs [1] 4 7 8 > > > > cleanEx(); ..nameEx <- "glpls1a.logit.all" > > ### * glpls1a.logit.all > > flush(stderr()); flush(stdout()) > > ### Name: glpls1a.logit.all > ### Title: Fit MIRWPLS and MIRWPLSF model separately for logits > ### Aliases: glpls1a.logit.all > ### Keywords: regression > > ### ** Examples > > x <- matrix(rnorm(20),ncol=2) > y <- sample(1:3,10,TRUE) > ## no bias reduction > glpls1a.logit.all(x,y,br=FALSE) $coefficients [,1] [,2] [1,] -1.599558 3.144428 [2,] 5.063456 -22.248319 [3,] 2.087350 21.477995 > ## bias reduction > glpls1a.logit.all(x,y,br=TRUE) $coefficients [,1] [,2] [1,] -0.2469014 0.3882321 [2,] 1.5438948 -2.2676992 [3,] 0.6578717 2.0499759 > > > > cleanEx(); ..nameEx <- "glpls1a.mlogit" > > ### * glpls1a.mlogit > > flush(stderr()); flush(stdout()) > > ### Name: glpls1a.mlogit > ### Title: Fit MIRWPLS and MIRWPLSF model > ### Aliases: glpls1a.mlogit > ### Keywords: regression > > ### ** Examples > > x <- matrix(rnorm(20),ncol=2) > y <- sample(1:3,10,TRUE) > ## no bias reduction and 1 PLS component > glpls1a.mlogit(cbind(rep(1,10),x),y,K.prov=1,br=FALSE) $coefficients [,1] [,2] [1,] 0.9260784 0.8217932 [2,] 1.5412616 -1.5312377 [3,] 0.2589442 0.3241784 $convergence [1] FALSE $niter [1] 100 $bias.reduction [1] FALSE > ## bias reduction > glpls1a.mlogit(cbind(rep(1,10),x),y,br=TRUE) $coefficients [,1] [,2] [1,] 0.2940383 0.9193367 [2,] 0.9557165 -0.9675655 [3,] 0.4721678 0.1683686 $convergence [1] TRUE $niter [1] 12 $bias.reduction [1] TRUE > > > > cleanEx(); ..nameEx <- "glpls1a.mlogit.cv.error" > > ### * glpls1a.mlogit.cv.error > > flush(stderr()); flush(stdout()) > > ### Name: glpls1a.mlogit.cv.error > ### Title: Leave-one-out cross-validation error using MIRWPLS and MIRWPLSF > ### model > ### Aliases: glpls1a.mlogit.cv.error > ### Keywords: regression > > ### ** Examples > > x <- matrix(rnorm(20),ncol=2) > y <- sample(1:3,10,TRUE) > > ## no bias reduction > glpls1a.mlogit.cv.error(x,y,br=FALSE) $error [1] 0.5 $error.obs [1] 2 5 7 8 9 > glpls1a.mlogit.cv.error(x,y,mlogit=FALSE,br=FALSE) $error [1] 0.5 $error.obs [1] 2 4 5 7 9 > ## bias reduction > glpls1a.mlogit.cv.error(x,y,br=TRUE) $error [1] 0.5 $error.obs [1] 2 5 7 8 9 > glpls1a.mlogit.cv.error(x,y,mlogit=FALSE,br=TRUE) $error [1] 0.6 $error.obs [1] 2 3 4 5 7 9 > > > > > cleanEx(); ..nameEx <- "glpls1a.train.test.error" > > ### * glpls1a.train.test.error > > flush(stderr()); flush(stdout()) > > ### Name: glpls1a.train.test.error > ### Title: out-of-sample test set error using IRWPLS and IRWPLSF model > ### Aliases: glpls1a.train.test.error > ### Keywords: regression > > ### ** Examples > > x <- matrix(rnorm(20),ncol=2) > y <- sample(0:1,10,TRUE) > x1 <- matrix(rnorm(10),ncol=2) > y1 <- sample(0:1,5,TRUE) > > ## no bias reduction > glpls1a.train.test.error(x,y,x1,y1,br=FALSE) $error [1] 0.8 $error.obs [1] 1 3 4 5 $predict.test [,1] [1,] 0.8058771 [2,] 0.9720929 [3,] 0.9987910 [4,] 0.9880673 [5,] 0.9708083 > ## bias reduction > glpls1a.train.test.error(x,y,x1,y1,br=TRUE) $error [1] 0.8 $error.obs [1] 1 3 4 5 $predict.test [,1] [1,] 0.7130766 [2,] 0.8440395 [3,] 0.9541642 [4,] 0.8860480 [5,] 0.8290839 > > > > cleanEx(); ..nameEx <- "gpls" > > ### * gpls > > flush(stderr()); flush(stdout()) > > ### Name: gpls > ### Title: A function to fit Generalized partial least squares models. > ### Aliases: gpls print.gpls gpls.formula gpls.default > ### Keywords: classif > > ### ** Examples > > library(MASS) > m1 = gpls(type~., data=Pima.tr, K=3) > > > > > cleanEx(); ..nameEx <- "predict.gpls" > > ### * predict.gpls > > flush(stderr()); flush(stdout()) > > ### Name: predict.gpls > ### Title: A prediction method for gpls. > ### Aliases: predict.gpls > ### Keywords: classif > > ### ** Examples > > example(gpls) gpls> library(MASS) gpls> m1 = gpls(type ~ ., data = Pima.tr, K = 3) > p1 = predict(m1) > > > > ### *