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("leaps-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('leaps') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "leaps" > > ### * leaps > > flush(stderr()); flush(stdout()) > > ### Name: leaps > ### Title: all-subsets regressiom > ### Aliases: leaps > ### Keywords: regression > > ### ** Examples > > x<-matrix(rnorm(100),ncol=4) > y<-rnorm(25) > leaps(x,y) $which 1 2 3 4 1 FALSE FALSE FALSE TRUE 1 FALSE TRUE FALSE FALSE 1 FALSE FALSE TRUE FALSE 1 TRUE FALSE FALSE FALSE 2 FALSE TRUE FALSE TRUE 2 FALSE FALSE TRUE TRUE 2 TRUE FALSE FALSE TRUE 2 FALSE TRUE TRUE FALSE 2 TRUE TRUE FALSE FALSE 2 TRUE FALSE TRUE FALSE 3 FALSE TRUE TRUE TRUE 3 TRUE TRUE FALSE TRUE 3 TRUE FALSE TRUE TRUE 3 TRUE TRUE TRUE FALSE 4 TRUE TRUE TRUE TRUE $label [1] "(Intercept)" "1" "2" "3" "4" $size [1] 2 2 2 2 3 3 3 3 3 3 4 4 4 4 5 $Cp [1] -0.67787686 -0.21697751 0.03250031 0.13958017 1.14729529 1.25681621 [7] 1.25907777 1.66597363 1.77705302 2.02996871 3.07304210 3.07896557 [13] 3.18966462 3.65699065 5.00000000 > > > > cleanEx(); ..nameEx <- "plot.regsubsets" > > ### * plot.regsubsets > > flush(stderr()); flush(stdout()) > > ### Name: plot.regsubsets > ### Title: Graphical table of best subsets > ### Aliases: plot.regsubsets > ### Keywords: hplot regression > > ### ** Examples > > data(swiss) > a<-regsubsets(Fertility~.,nbest=3,data=swiss) > par(mfrow=c(1,2)) > plot(a) > plot(a,scale="r2") > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "regsubsets" > > ### * regsubsets > > flush(stderr()); flush(stdout()) > > ### Name: regsubsets > ### Title: functions for model selection > ### Aliases: regsubsets regsubsets.default print.regsubsets > ### print.summary.regsubsets regsubsets.formula summary.regsubsets > ### Keywords: regression > > ### ** Examples > > data(swiss) > a<-regsubsets(as.matrix(swiss[,-1]),swiss[,1]) > summary(a) Subset selection object 5 Variables (and intercept) Forced in Forced out Agriculture FALSE FALSE Examination FALSE FALSE Education FALSE FALSE Catholic FALSE FALSE Infant.Mortality FALSE FALSE 1 subsets of each size up to 5 Selection Algorithm: exhaustive Agriculture Examination Education Catholic Infant.Mortality 1 ( 1 ) " " " " "*" " " " " 2 ( 1 ) " " " " "*" "*" " " 3 ( 1 ) " " " " "*" "*" "*" 4 ( 1 ) "*" " " "*" "*" "*" 5 ( 1 ) "*" "*" "*" "*" "*" > b<-regsubsets(Fertility~.,data=swiss) > summary(a) Subset selection object 5 Variables (and intercept) Forced in Forced out Agriculture FALSE FALSE Examination FALSE FALSE Education FALSE FALSE Catholic FALSE FALSE Infant.Mortality FALSE FALSE 1 subsets of each size up to 5 Selection Algorithm: exhaustive Agriculture Examination Education Catholic Infant.Mortality 1 ( 1 ) " " " " "*" " " " " 2 ( 1 ) " " " " "*" "*" " " 3 ( 1 ) " " " " "*" "*" "*" 4 ( 1 ) "*" " " "*" "*" "*" 5 ( 1 ) "*" "*" "*" "*" "*" > > > > ### *