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("locfit-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('locfit') Locfit for R. August 3, 2000. (Updated for R 1.7.0, March 21, 2003) Attaching package: 'locfit' The following object(s) are masked from package:stats : knots > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "aicplot" > > ### * aicplot > > flush(stderr()); flush(stdout()) > > ### Name: aicplot > ### Title: Compute an AIC plot. > ### Aliases: aicplot > ### Keywords: smooth hplot > > ### ** Examples > > data(morths) > plot(aicplot(deaths~age,weights=n,data=morths,family="binomial",alpha=seq(0.2,1.0,by=0.05))) > > > > cleanEx(); ..nameEx <- "ang" > > ### * ang > > flush(stderr()); flush(stdout()) > > ### Name: ang > ### Title: Angular Term for a Locfit model. > ### Aliases: ang > ### Keywords: models > > ### ** Examples > > # generate an x variable, and a response with period 0.2 > x <- seq(0, 1, length=200) > y <- sin(10*pi*x) + rnorm(200) / 5 > > # compute the periodic local fit. Note the scale argument is period/(2pi) > fit <- locfit(y ~ ang(x), scale=0.2/(2*pi)) > > # plot the fit over a single period > plot(fit) > > # plot the fit over the full range of the data > plot(fit, xlim=c(0,1)) > > > > cleanEx(); ..nameEx <- "cpar" > > ### * cpar > > flush(stderr()); flush(stdout()) > > ### Name: cpar > ### Title: Conditionally parametric term for a Locfit model. > ### Aliases: cpar > ### Keywords: models > > ### ** Examples > > data(ethanol) > # fit a conditionally parametric model > fit <- locfit(NOx~E+cpar(C),data=ethanol) > plot(fit) > # one way to force a parametric fit with locfit > fit <- locfit(NOx~cpar(E),data=ethanol) > > > > cleanEx(); ..nameEx <- "cpplot" > > ### * cpplot > > flush(stderr()); flush(stdout()) > > ### Name: cpplot > ### Title: Compute a Cp plot. > ### Aliases: cpplot > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > plot(cpplot(NOx~E,data=ethanol,alpha=seq(0.2,1.0,by=0.05))) > > > > cleanEx(); ..nameEx <- "crit" > > ### * crit > > flush(stderr()); flush(stdout()) > > ### Name: crit > ### Title: Compute critical values for confidence intervals. > ### Aliases: crit > ### Keywords: smooth > > ### ** Examples > > # compute and plot 99% confidence intervals, with local variance estimate. > data(ethanol) > fit <- locfit(NOx~E,data=ethanol) > crit(fit) <- crit(fit,cov=0.99) > plot(fit,band="local") > > # compute and plot 99% simultaneous bands > crit(fit) <- kappa0(NOx~E,data=ethanol,cov=0.99) Warning: constants are approximate for varying h > plot(fit,band="local") > > > > cleanEx(); ..nameEx <- "crita" > > ### * crita > > flush(stderr()); flush(stdout()) > > ### Name: crita > ### Title: Substitute critical values on ``locfit'' object. > ### Aliases: crit<- > ### Keywords: smooth > > ### ** Examples > > # compute and plot 99% confidence intervals, with local variance estimate. > data(ethanol) > fit <- locfit(NOx~E,data=ethanol) > crit(fit) <- crit(fit,cov=0.99) > plot(fit,band="local") > > # compute and plot 99% simultaneous bands > crit(fit) <- kappa0(NOx~E,data=ethanol,cov=0.99) Warning: constants are approximate for varying h > plot(fit, band="local") > > > > cleanEx(); ..nameEx <- "density.lf" > > ### * density.lf > > flush(stderr()); flush(stdout()) > > ### Name: density.lf > ### Title: Density estimation using Locfit > ### Aliases: density.lf > ### Keywords: smooth > > ### ** Examples > > data(geyser) > density.lf(geyser, window="tria") $x [1] 1.564723 1.635550 1.706378 1.777206 1.848033 1.918861 1.989689 2.060516 [9] 2.131344 2.202172 2.272999 2.343827 2.414654 2.485482 2.556310 2.627137 [17] 2.697965 2.768793 2.839620 2.910448 2.981276 3.052103 3.122931 3.193759 [25] 3.264586 3.335414 3.406241 3.477069 3.547897 3.618724 3.689552 3.760380 [33] 3.831207 3.902035 3.972863 4.043690 4.114518 4.185346 4.256173 4.327001 [41] 4.397828 4.468656 4.539484 4.610311 4.681139 4.751967 4.822794 4.893622 [49] 4.964450 5.035277 $y [1] 1.182697e-16 1.890007e-01 4.623314e-01 7.174016e-01 8.081279e-01 [6] 5.571365e-01 3.739426e-01 1.256785e-01 3.316671e-03 8.002072e-02 [11] 1.963319e-01 1.132892e-01 3.419681e-02 7.653125e-02 4.129095e-02 [16] 1.046841e-02 7.019261e-02 4.762960e-02 2.512419e-02 1.445726e-01 [21] 9.107183e-02 4.838509e-02 9.322311e-02 9.322311e-02 6.792613e-02 [26] 1.022381e-01 1.911011e-01 3.630067e-01 3.338104e-01 2.442562e-01 [31] 5.441002e-01 5.917874e-01 3.663234e-01 3.868570e-01 6.537848e-01 [36] 8.292375e-01 6.788447e-01 4.238963e-01 4.480279e-01 4.545461e-01 [41] 4.034270e-01 3.677768e-01 5.616119e-01 7.364176e-01 3.963838e-01 [46] 1.409679e-01 9.322311e-02 9.322311e-02 5.972420e-02 5.913483e-17 > # the same result with density, except less precision. > density(geyser, window="tria") Call: density(x = geyser, window = "tria") Data: geyser (107 obs.); Bandwidth 'bw' = 0.3677 x y Min. :0.5668 Min. :-1.711e-17 1st Qu.:1.9334 1st Qu.: 6.050e-02 Median :3.3000 Median : 1.560e-01 Mean :3.3000 Mean : 1.828e-01 3rd Qu.:4.6666 3rd Qu.: 2.568e-01 Max. :6.0332 Max. : 4.834e-01 > > > > cleanEx(); ..nameEx <- "gcvplot" > > ### * gcvplot > > flush(stderr()); flush(stdout()) > > ### Name: gcvplot > ### Title: Compute a generalized cross-validation plot. > ### Aliases: gcvplot > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > plot(gcvplot(NOx~E,data=ethanol,alpha=seq(0.2,1.0,by=0.05))) > > > > cleanEx(); ..nameEx <- "kappa0" > > ### * kappa0 > > flush(stderr()); flush(stdout()) > > ### Name: kappa0 > ### Title: Critical Values for Simultaneous Confidence Bands. > ### Aliases: kappa0 > ### Keywords: smooth > > ### ** Examples > > # compute and plot simultaneous confidence bands > data(ethanol) > fit <- locfit(NOx~E,data=ethanol) > crit(fit) <- kappa0(NOx~E,data=ethanol) Warning: constants are approximate for varying h > plot(fit,crit=crit,band="local") Warning: parameter "crit" could not be set in high-level plot() function Warning: parameter "crit" could not be set in high-level plot() function Warning: parameter "crit" could not be set in high-level plot() function Warning: parameter "crit" could not be set in high-level plot() function Warning: parameter "crit" could not be set in high-level plot() function Warning: parameter "crit" could not be set in high-level plot() function > > > > cleanEx(); ..nameEx <- "km.mrl" > > ### * km.mrl > > flush(stderr()); flush(stdout()) > > ### Name: km.mrl > ### Title: Mean Residual Life using Kaplan-Meier estimate > ### Aliases: km.mrl > ### Keywords: smooth > > ### ** Examples > > # censored regression using the Kaplan-Meier estimate. > data(heart) > fit <- locfit.censor(log10(surv+0.5)~age, cens=cens, data=heart, km=TRUE) > plotbyfactor(heart$age, 0.5+heart$surv, heart$cens, ylim=c(0.5,16000), log="y") > lines(fit, tr=function(x)10^x) > > > > cleanEx(); ..nameEx <- "lcvplot" > > ### * lcvplot > > flush(stderr()); flush(stdout()) > > ### Name: lcvplot > ### Title: Compute the likelihood cross-validation plot. > ### Aliases: lcvplot > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > plot(lcvplot(NOx~E,data=ethanol,alpha=seq(0.2,1.0,by=0.05))) > > > > cleanEx(); ..nameEx <- "left" > > ### * left > > flush(stderr()); flush(stdout()) > > ### Name: left > ### Title: One-sided left smooth for a Locfit model. > ### Aliases: left > ### Keywords: models > > ### ** Examples > > # compute left and right smooths > data(penny) > xev <- (1945:1988)+0.5 > fitl <- locfit(thickness~left(year), alpha=c(0,10), deg=1, ev=xev, data=penny) > fitr <- locfit(thickness~right(year),alpha=c(0,10), deg=1, ev=xev, data=penny) > # plot the squared difference, to show the change points. > plot( xev, (predict(fitr,where="ev") - predict(fitl,where="ev"))^2 ) > > > > cleanEx(); ..nameEx <- "lf" > > ### * lf > > flush(stderr()); flush(stdout()) > > ### Name: lf > ### Title: Locfit term in Additive Model formula > ### Aliases: lf > ### Keywords: models > > ### ** Examples > > # fit an additive semiparametric model to the ethanol data. > if (exists("gam")) { # shut up R's checks + fit <- gam(NOx~lf(E)+C,data=ethanol) + plot(fit) + } > > > > cleanEx(); ..nameEx <- "lfbas" > > ### * lfbas > > flush(stderr()); flush(stdout()) > > ### Name: lfbas > ### Title: User-specified basis functions for Locfit. > ### Aliases: lfbas > ### Keywords: smooth > > ### ** Examples > > # Specify a bivariate linear with interaction basis. > data(ethanol) > my.basis <- function(x,t) + { + u1 <- x[, 1] - t[1] + u2 <- x[, 2] - t[2] + cbind(1, u1, u2, u1 * u2) + } > fit <- locfit(NOx~E+C, data=ethanol, scale=0, basis=my.basis) > # With this basis, Locfit's standard interpolation and plot methods > # should be reasonable. > plot(fit,get.data=TRUE) > > # Estimation of change points. This provides an alternative to using > # left() and right(), and can easily be modified to detecting > # a change in slopes or other parameters. Note that the first > # component is the indicator of x>t, so the coefficient estimates > # the size of the change, assuming the change occurs at t. > data(penny) > my.basis <- function(x,t) cbind(x>t,1,x-t) > xev <- (1945:1988) + 0.5 > fit <- locfit(thickness~year, data=penny, alpha=c(0,10), ev=xev, basis=my.basis) > # The plot will show peaks where change points are most likely. > # in S4, S-Plus 5 etc, > # plot(preplot(fit,where="fitp")^2, type="b") is an alternative. > plot(xev, predict(fit,where="fitp")^2, type="b") > > # Estimate the mean function using local linear regression, with > # discontinuities at 1958.5 and 1974.5. > # The basis functions must consist of the constant 1, the linear term > # x-t, and indicator functions for two of the three sections. > # Note the care taken to ensure my.basis(t,t) = c(1,0,0,0) for all t. > my.basis <- function(x,t) + { ret <- NULL + if (t<1958.5) ret <- cbind(1, x>=1958.5, x>1974.5, x-t) + if (t>1974.5) ret <- cbind(1, x<=1974.5, x<1958.5, x-t) + if (is.null(ret)) + ret <- cbind(1, x<1958.5, x>1974.5, x-t) + ret + } > fit <- locfit(thickness~year, data=penny, alpha=c(0,10), ev=xev, basis=my.basis) > plot(preplot(fit,where="fitp", get.data=TRUE)) > > > > cleanEx(); ..nameEx <- "locfit" > > ### * locfit > > flush(stderr()); flush(stdout()) > > ### Name: locfit > ### Title: Local Regression, Likelihood and Density Estimation. > ### Aliases: locfit > ### Keywords: smooth > > ### ** Examples > > # fit and plot a univariate local regression > data(ethanol) > fit <- locfit(NOx~E,data=ethanol) > plot(fit,get.data=TRUE) > > # a bivariate local regression with smaller smoothing parameter > fit <- locfit(NOx~E+C, data=ethanol, scale=0, alpha=0.5) > plot(fit) > > # density estimation > data(geyser) > fit <- locfit(~geyser, alpha=c(0.1,0.8)) > plot(fit,get.data=TRUE) > > > > cleanEx(); ..nameEx <- "locfit.censor" > > ### * locfit.censor > > flush(stderr()); flush(stdout()) > > ### Name: locfit.censor > ### Title: Censored Local Regression > ### Aliases: locfit.censor > ### Keywords: smooth > > ### ** Examples > > data(heart) > fit <- locfit.censor(log10(surv+0.5)~age, cens=cens, data=heart) > plotbyfactor(heart$age, 0.5+heart$surv, heart$cens, ylim=c(0.5,16000), log="y") > lines(fit, tr=function(x)10^x) > > > > cleanEx(); ..nameEx <- "lscv" > > ### * lscv > > flush(stderr()); flush(stdout()) > > ### Name: lscv > ### Title: Least Squares Cross Validation Statistic. > ### Aliases: lscv > ### Keywords: smooth > > ### ** Examples > > # approximate calculation for a kernel density estimate > data(geyser) > lscv(~geyser, alpha=cbind(0,1), ev="grid", mg=100, deg=0, + flim=c(1,6), kern="gauss") [1] -0.3648199 3.3894323 > # same computation, exact > lscv(geyser,alpha=1,exact=TRUE) [1] -0.3649103 3.3871090 > > > > cleanEx(); ..nameEx <- "lscv.exact" > > ### * lscv.exact > > flush(stderr()); flush(stdout()) > > ### Name: lscv.exact > ### Title: Exact LSCV Calculation > ### Aliases: lscv.exact > ### Keywords: smooth > > ### ** Examples > > data(geyser) > lscv.exact(geyser,alpha=0.25) [1] -0.4201239 12.7251170 > # equivalent form using lscv > lscv(geyser,alpha=0.25,exact=TRUE) [1] -0.4201239 12.7251170 > > > > cleanEx(); ..nameEx <- "panel.locfit" > > ### * panel.locfit > > flush(stderr()); flush(stdout()) > > ### Name: panel.locfit > ### Title: Locfit panel function > ### Aliases: panel.locfit > ### Keywords: smooth > > ### ** Examples > > library("lattice") > > # a simple multi-panel display > data(ethanol) > xyplot(NOx~E|C,data=ethanol,panel=panel.locfit) Called from: panel(x = c(0.696, 1.009, 1.142, 0.767, 1.006, 0.762, 1.144, 1.045, 0.765, 0.878, 0.811, 0.729, 0.911, 0.808, 1.168, 0.749, 0.892, 1.002, 0.899, 1.227, 0.795, 0.629), y = c(0.926, 2.845, 1.013, 1.869, 2.836, 1.634, 1.021, 2.157, 1.732, 3.206, 2.471, 1.397, 3.536, 2.202, 0.756, 1.62, 3.656, 2.964, 3.488, 0.754, 2.064, 0.561), subscripts = c(15, 22, 23, 28, 29, 38, 39, 40, 49, 50, 51, 57, 58, 59, 60, 61, 62, 63, 77, 78, 80, 83), panel.number = 1, panel.counter = 1) Browse[1]> Called from: panel(x = c(1.001, 1.231, 1.123, 0.808, 1.071, 0.893, 1.081, 0.868, 0.637, 0.733, 0.715, 0.872, 0.696, 1.199, 1.03, 1.18, 0.608), y = c(3.12, 0.638, 1.17, 3.148, 1.836, 3.567, 1.719, 3.423, 0.571, 2.219, 1.419, 3.519, 1.139, 0.727, 2.581, 0.797, 0.563), subscripts = c(6, 7, 8, 20, 21, 30, 36, 37, 45, 46, 47, 48, 69, 70, 71, 79, 84), panel.number = 2, panel.counter = 2) Browse[1]> # The second example uses some Locfit optional arguments. Called from: panel(x = c(0.907, 0.761, 1.108, 1.016, 1.189, 1.042, 1.215, 0.93, 1.152, 0.686, 1.072, 0.813, 1.002, 0.584), y = c(3.741, 2.295, 1.498, 2.881, 0.76, 2.358, 0.606, 3.669, 1, 1.59, 1.806, 3.517, 3.29, 0.678), subscripts = c(1, 2, 3, 4, 5, 9, 10, 11, 12, 16, 17, 67, 68, 85), panel.number = 3, panel.counter = 3) Browse[1]> # Note we can pass the alpha (bandwidth) and family arguments directly to Called from: panel(x = c(1.138, 1.074, 0.934, 0.568, 0.977, 1.152, 0.693, 1.232, 1.036, 1.125, 0.676, 0.846, 0.684, 0.602, 0.694, 0.816, 1.037, 1.181, 0.562), y = c(0.981, 1.962, 4.028, 0.374, 3.623, 0.866, 1.369, 0.542, 2.739, 1.2, 1.777, 3.931, 1.587, 0.923, 1.527, 3.388, 2.085, 0.966, 0.37), subscripts = c(13, 18, 19, 26, 27, 31, 32, 33, 34, 35, 52, 55, 56, 72, 73, 74, 75, 76, 86 ), panel.number = 4, panel.counter = 4) Browse[1]> # xyplot. The cens argument must be given in full; not as a data frame variable. Called from: panel(x = c(0.601, 1.229, 1.175, 0.797, 1.115, 1.07, 1.219, 1.045, 0.968, 0.812, 1.23, 0.804, 0.99, 1.201, 0.535, 0.655), y = c(1.192, 0.414, 0.812, 3.361, 1.39, 1.947, 0.962, 2.571, 3.952, 3.76, 0.672, 3.677, 3.732, 0.586, 0.53, 1.9), subscripts = c(14, 24, 25, 41, 42, 43, 44, 53, 54, 64, 65, 66, 81, 82, 87, 88), panel.number = 5, panel.counter = 5) Browse[1]> # The resulting plot does not (yet) distinguish the censored points, but > # the fit will correctly apply censoring. > data(border) > xyplot(runs~day,data=border,panel=panel.locfit,family="poisson", + alpha=0.3,cens=border$no) Called from: panel(x = c(1978.995, 1979.003, 1979.019, 1979.03, 1979.077, 1979.085, 1979.192, 1979.203, 1979.23, 1979.241, 1979.696, 1979.71, 1979.718, 1979.732, 1979.756, 1979.767, 1979.789, 1979.795, 1979.819, 1979.83, 1979.849, 1979.852, 1979.918, 1979.926, 1979.953, 1979.959, 1979.995, 1980, 1980.014, 1980.025, 1980.074, 1980.082, 1980.09, 1980.159, 1980.164, 1980.184, 1980.214, 1980.225, 1980.66, 1980.668, 1980.912, 1980.951, 1980.986, 1980.995, 1981.008, 1981.063, 1981.071, 1981.107, 1981.115, 1981.468, 1981.471, 1981.507, 1981.515, 1981.542, 1981.553, 1981.578, 1981.586, 1981.619, 1981.627, 1981.658, 1981.666, 1981.868, 1981.874, 1981.91, 1981.951, 1981.953, 1981.986, 1981.992, 1982.011, 1982.016, 1982.082, 1982.09, 1982.195, 1982.205, 1982.214, 1982.729, 1982.737, 1982.753, 1982.759, 1982.786, 1982.797, 1982.871, 1982.879, 1982.907, 1982.918, 1982.945, 1982.989, 1982.995, 1983.008, 1983.016, 1983.31, 1983.866, 1983.904, 1983.94, 1983.951, 1983.992, 1984.014, 1984.17, 1984.178, 1984.208, 1984.219, 1984.244, 1984.258, 1984.266, 1984.277, 1984.323, 1984.329, 1984.86, 1984.863, 1984.896, 1984.901, 1984.94, 1984.945, 1984.981, 1984.989, 1985, 1985.449, 1985.46, 1985.493, 1985.501, 1985.532, 1985.584, 1985.597, 1985.622, 1985.633, 1985.663, 1985.671, 1985.855, 1985.863, 1985.896, 1985.904, 1985.915, 1985.923, 1985.951, 1985.986, 1985.995, 1986.014, 1986.016, 1986.142, 1986.162, 1986.173, 1986.197, 1986.205, 1986.718, 1986.723, 1986.789, 1986.8, 1986.877, 1986.882, 1986.915, 1986.923, 1986.951, 1986.959, 1986.986, 1986.992, 1987.027, 1987.033, 1987.929, 1987.951, 1987.989, 1987.997, 1988.085, 1988.09, 1988.118, 1988.712, 1988.721, 1988.734, 1988.767, 1988.775, 1988.882, 1988.888, 1988.926, 1988.932, 1988.986, 1988.995, 1989.077, 1989.082, 1989.093, 1989.104, 1989.436, 1989.447, 1989.477, 1989.488, 1989.512, 1989.575, 1989.611, 1989.647, 1989.66, 1989.899, 1989.937, 1989.959, 1989.964, 1990.025, 1990.03, 1990.055, 1990.063, 1990.107, 1990.203, 1990.211, 1990.899, 1990.992, 1991.011, 1991.022, 1991.068, 1991.077, 1991.09, 1991.167, 1991.225, 1991.238, 1991.26, 1991.274, 1991.301, 1991.312, 1991.321, 1991.326, 1991.915, 1991.989, 1991.995, 1992.005, 1992.016, 1992.068, 1992.077, 1992.088, 1992.096, 1992.627, 1992.638, 1992.658, 1992.668, 1992.688, 1992.699, 1992.907, 1992.915, 1992.989, 1992.995, 1993.008, 1993.066, 1993.071, 1993.082, 1993.088, 1993.156, 1993.181, 1993.195, 1993.2, 1993.422, 1993.43, 1993.463, 1993.504, 1993.512, 1993.559, 1993.597, 1993.636, 1993.644, 1993.866, 1993.907, 1993.929, 1993.995, 1994.008, 1994.014, 1994.079, 1994.085, 1994.175, 1994.184, 1994.214, 1994.23, 1994.241), y = c(29, 0, 60, 45, 11, 1, 20, 105, 85, 66, 162, 50, 44, 19, 24, 8, 24, 46, 54, 6, 23, 61, 1, 7, 4, 115, 17, 15, 15, 2, 54, 24, 63, 30, 58, 4, 150, 153, 56, 21, 36, 10, 45, 9, 31, 57, 7, 124, 9, 63, 20, 64, 12, 8, 0, 2, 40, 11, 123, 106, 84, 3, 37, 36, 7, 1, 4, 66, 53, 9, 78, 126, 0, 38, 6, 55, 8, 9, 31, 9, 6, 8, 32, 0, 15, 26, 2, 62, 89, 83, 47, 32, 118, 117, 66, 32, 64, 5, 54, 98, 100, 38, 8, 98, 19, 41, 60, 15, 6, 17, 24, 21, 18, 35, 41, 69, 32, 8, 196, 41, 23, 8, 146, 45, 2, 38, 58, 1, 152, 20, 11, 12, 83, 49, 11, 163, 71, 4, 13, 140, 114, 17, 6, 106, 27, 46, 66, 7, 23, 125, 16, 70, 100, 15, 34, 34, 49, 9, 205, 31, 43, 2, 48, 88, 4, 18, 113, 75, 20, 4, 41, 6, 26, 0, 20, 75, 16, 64, 6, 66, 60, 35, 1, 8, 80, 65, 76, 51, 50, 56, 24, 85, 24, 62, 13, 8, 27, 1, 78, 9, 62, 78, 20, 12, 83, 17, 31, 47, 34, 43, 27, 29, 0, 59, 5, 28, 0, 5, 19, 53, 0, 91, 59, 20, 3, 15, 13, 28, 106, 78, 73, 17, 110, 4, 74, 19, 1, 0, 0, 88, 30, 0, 71, 17, 31, 77, 38, 2, 200, 3, 48, 17, 16, 60, 105, 2, 49, 7, 84, 4, 34, 14, 45, 17, 42), subscripts = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265), family = "poisson", alpha = 0.3, cens = c(0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), panel.number = 1, panel.counter = 1) Browse[1]> > > > cleanEx(); ..nameEx <- "plot.eval" > > ### * plot.eval > > flush(stderr()); flush(stdout()) > > ### Name: plot.eval > ### Title: Plot evaluation points from a 2-d locfit object. > ### Aliases: plot.eval > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > fit <- locfit(NOx~E+C,data=ethanol,scale=0) > plot.eval(fit) > > > > cleanEx(); ..nameEx <- "plot.gcvplot" > > ### * plot.gcvplot > > flush(stderr()); flush(stdout()) > > ### Name: plot.gcvplot > ### Title: Produce a cross-validation plot. > ### Aliases: plot.gcvplot > ### Keywords: methods > > ### ** Examples > > data(ethanol) > plot(gcvplot(NOx~E,data=ethanol,alpha=seq(0.2,1.0,by=0.05))) > > > > cleanEx(); ..nameEx <- "plot.locfit" > > ### * plot.locfit > > flush(stderr()); flush(stdout()) > > ### Name: plot.locfit > ### Title: Plot an object of class locfit. > ### Aliases: plot.locfit > ### Keywords: smooth > > ### ** Examples > > x <- rnorm(100) > y <- dnorm(x)+rnorm(100)/5 > plot(locfit(y ~ x), vband=TRUE) Warning: parameter "vband" could not be set in high-level plot() function Warning: parameter "vband" could not be set in high-level plot() function Warning: parameter "vband" could not be set in high-level plot() function Warning: parameter "vband" could not be set in high-level plot() function Warning: parameter "vband" could not be set in high-level plot() function Warning: parameter "vband" could not be set in high-level plot() function > x <- cbind(rnorm(100), rnorm(100)) > plot(locfit(~x), type="persp") > > > > cleanEx(); ..nameEx <- "plot.scb" > > ### * plot.scb > > flush(stderr()); flush(stdout()) > > ### Name: plot.scb > ### Title: Plot method for simultaneous confidence bands > ### Aliases: plot.scb > ### Keywords: methods > > ### ** Examples > > # corrected confidence bands for a linear logistic model > data(insect) > fit <- scb(deaths ~ lconc, type=4, w=nins, data=insect, + deg=1, family="binomial", kern="parm") > plot(fit) > > > > cleanEx(); ..nameEx <- "plotbyfactor" > > ### * plotbyfactor > > flush(stderr()); flush(stdout()) > > ### Name: plotbyfactor > ### Title: x-y scatterplot, colored by levels of a factor. > ### Aliases: plotbyfactor > ### Keywords: smooth > > ### ** Examples > > data(iris) > plotbyfactor(petal.wid,petal.len,species,data=iris) > > > > cleanEx(); ..nameEx <- "predict.locfit" > > ### * predict.locfit > > flush(stderr()); flush(stdout()) > > ### Name: predict.locfit > ### Title: Prediction from a Locfit object. > ### Aliases: predict.locfit > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > fit <- locfit(NOx~E,data=ethanol) > predict(fit,c(0.6,0.8,1.0)) [1] 0.7402965 2.9038494 2.9159805 > > > > cleanEx(); ..nameEx <- "right" > > ### * right > > flush(stderr()); flush(stdout()) > > ### Name: right > ### Title: One-sided right smooth for a Locfit model. > ### Aliases: right > ### Keywords: models > > ### ** Examples > > # compute left and right smooths > data(penny) > xev <- (1945:1988)+0.5 > fitl <- locfit(thickness~left(year), alpha=c(0,10), deg=1, ev=xev, data=penny) > fitr <- locfit(thickness~right(year),alpha=c(0,10), deg=1, ev=xev, data=penny) > # plot the squared difference, to show the change points. > plot( xev, (predict(fitr,where="ev") - predict(fitl,where="ev"))^2 ) > > > > cleanEx(); ..nameEx <- "rv" > > ### * rv > > flush(stderr()); flush(stdout()) > > ### Name: rv > ### Title: Residual variance from a "locfit" object. > ### Aliases: rv > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > fit <- locfit(NOx~E,data=ethanol) > rv(fit) rv 0.1435404 > > > > cleanEx(); ..nameEx <- "scb" > > ### * scb > > flush(stderr()); flush(stdout()) > > ### Name: scb > ### Title: Simultaneous Confidence Bands > ### Aliases: scb > ### Keywords: htest smooth > > ### ** Examples > > # corrected confidence bands for a linear logistic model > data(insect) > fit <- scb(deaths ~ lconc, type=4, w=nins, data=insect, + deg=1, family="binomial", kern="parm") > plot(fit) > > > > cleanEx(); ..nameEx <- "sjpi" > > ### * sjpi > > flush(stderr()); flush(stdout()) > > ### Name: sjpi > ### Title: Sheather-Jones Plug-in bandwidth criterion. > ### Aliases: sjpi > ### Keywords: smooth > > ### ** Examples > > # Fig 10.2 (S-J parts) from Loader (1999). > data(geyser) > gf <- 2.5 > a <- seq(0.05, 0.7, length=100) > z <- sjpi(geyser, a) > > # the plug-in curve. Multiplying by gf=2.5 corresponds to Locfit's standard > # scaling for the Gaussian kernel. > plot(gf*z[, 2], gf*z[, 1], type = "l", xlab = "Pilot Bandwidth k", ylab + = "Bandwidth h") > > # Add the assumed curve. > lines(gf * z[, 3], gf * z[, 1], lty = 2) > legend(gf*0.05, gf*0.4, lty = 1:2, legend = c("Plug-in", "SJ assumed")) > > > > cleanEx(); ..nameEx <- "spence.15" > > ### * spence.15 > > flush(stderr()); flush(stdout()) > > ### Name: spence.15 > ### Title: Spencer's 15 point graduation rule. > ### Aliases: spence.15 > ### Keywords: smooth > > ### ** Examples > > data(spencer) > yy <- spence.15(spencer$mortality) > plot(spencer$age, spencer$mortality) > lines(spencer$age, yy) > > > > cleanEx(); ..nameEx <- "spence.21" > > ### * spence.21 > > flush(stderr()); flush(stdout()) > > ### Name: spence.21 > ### Title: Spencer's 21 point graduation rule. > ### Aliases: spence.21 > ### Keywords: smooth > > ### ** Examples > > data(spencer) > yy <- spence.21(spencer$mortality) > plot(spencer$age, spencer$mortality) > lines(spencer$age, yy) > > > > cleanEx(); ..nameEx <- "summary.gcvplot" > > ### * summary.gcvplot > > flush(stderr()); flush(stdout()) > > ### Name: summary.gcvplot > ### Title: Summary method for a gcvplot structure. > ### Aliases: summary.gcvplot > ### Keywords: smooth > > ### ** Examples > > data(ethanol) > summary(gcvplot(NOx ~ E, data=ethanol, alpha=seq(0.2, 1.0, by=0.05))) df GCV [1,] 18.812657 0.1183932 [2,] 13.967891 0.1094681 [3,] 11.469598 0.1065792 [4,] 10.465337 0.1082955 [5,] 8.435026 0.1180386 [6,] 7.859473 0.1208126 [7,] 7.011088 0.1216522 [8,] 6.523260 0.1235520 [9,] 6.068841 0.1265091 [10,] 5.337439 0.1413958 [11,] 5.089902 0.1517506 [12,] 4.767998 0.1744947 [13,] 4.567191 0.1936765 [14,] 4.416665 0.2084184 [15,] 4.207973 0.2322066 [16,] 3.979570 0.2557630 [17,] 3.838952 0.2664913 > > > > ### *