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("ash-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('ash') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "ash1" > > ### * ash1 > > flush(stderr()); flush(stdout()) > > ### Name: ash1 > ### Title: univariate ASH > ### Aliases: ash1 > ### Keywords: nonparametric > > ### ** Examples > > x <- rnorm(100) # data > f <- ash1(bin1(x,nbin=50),5) # compute ash estimate [1] "ash estimate nonzero outside interval ab" > plot( f , type="l" ) # line plot of estimate > > > > cleanEx(); ..nameEx <- "ash2" > > ### * ash2 > > flush(stderr()); flush(stdout()) > > ### Name: ash2 > ### Title: bivariate ASH > ### Aliases: ash2 > ### Keywords: nonparametric > > ### ** Examples > > ## Don't show: > # prepare variables from other example pages if they are not already there: > if(length(ls(pat="bins"))==0){example(bin2)} bin2> x <- matrix(rnorm(200), 100, 2) bin2> ab <- matrix(c(-5, -5, 5, 5), 2, 2) bin2> nbin <- c(20, 20) bin2> bins <- bin2(x, ab, nbin) > ## End Don't show > > # Continuing example from help(bin2) > m <- c(5,5) > f <- ash2(bins,m) > image(f$x,f$y,f$z) > contour(f$x,f$y,f$z,add=TRUE) > > > > cleanEx(); ..nameEx <- "bin1" > > ### * bin1 > > flush(stderr()); flush(stdout()) > > ### Name: bin1 > ### Title: univariate binning > ### Aliases: bin1 > ### Keywords: nonparametric > > ### ** Examples > > x <- rnorm(100) # data vector > ab <- c(-5,5) # bin interval > bins <- bin1(x,ab,10) # bin x into 10 bins over ab > > > > cleanEx(); ..nameEx <- "bin2" > > ### * bin2 > > flush(stderr()); flush(stdout()) > > ### Name: bin2 > ### Title: 2D binning > ### Aliases: bin2 > ### Keywords: nonparametric > > ### ** Examples > > x <- matrix( rnorm(200), 100 , 2) # bivariate normal n=100 > ab <- matrix( c(-5,-5,5,5), 2, 2) # interval [-5,5) x [-5,5) > nbin <- c( 20, 20) # 400 bins > bins <- bin2(x, ab, nbin) # bin counts,ab,nskip > > > > ### *