Learn R Programming

SCBmeanfd (version 1.2.2)

scb.mean: Build Simultaneous Confidence Bands for Mean Functions

Description

Fit a local linear estimator and build simultaneous confidence bands (SCB) for the mean of functional data.

Usage

scb.mean(x, y, bandwidth, level = .95, degree = 1, scbtype = c("normal","bootstrap","both","no"), gridsize = length(x), keep.y = TRUE, nrep = 2e4, nboot = 5e3, parallel = c("no", "multicore", "snow"), ncpus = getOption("boot.ncpus",1L), cl = NULL)

Arguments

x
a numeric vector of x data. Missing values are not accepted.
y
a matrix or data frame with functional observations (= curves) stored in rows. The number of columns of y must match the length of x. Missing values are not accepted.
bandwidth
the kernel bandwidth smoothing parameter.
level
the level of the simultaneous confidence bands.
degree
the degree of the local polynomial fit.
scbtype
the type of simultaneous confidence bands to build: "normal", "bootstrap", "both", or "no".
gridsize
the size of the grid used to evaluate the mean function estimates and SCB. Defaults to length(x).
keep.y
logical; if TRUE, keep y in the result.
nrep
number of replicates for the Gaussian SCB method (20,000 by default).
nboot
number of replicates for the bootstrap SCB method (5,000 by default).
parallel
the computation method for the SCB. By default, computations are sequential ("no"). The bootstrap method uses function boot and can be run in parallel using the package parallel. In this case both options "multicore" and "snow" are available.
ncpus
number of cores to use for parallel computing when parallel = "multicore".
cl
name of the cluster to use for parallel computing when parallel = "snow".

Value

An object of class "SCBand". To accommodate the different functions creating objects of this class (scb.mean, scb.model, and scb.equal), some components of the object are set to NULL. The component list is:Depending on the value of scbtype, some of the fields qnorm, normscb, nrep, qboot, normboot and nboot may be NULL.

Details

The local polynomial fitting uses a standard normal kernel and is implemented via the locpoly function. Bootstrap SCB are implemented with the boot function and typically require more computation time than normal SCB.

References

Degras, D. (2011). Simultaneous confidence bands for nonparametric regression with functional data. Statistica Sinica, 21, 1735--1765.

See Also

scb.equal, scb.model

Examples

Run this code
## Not run: 
# ## Plasma citrate data
# data(plasma)
# time <- 8:21
# h <- cv.select(time, plasma, 1, c(.5, 1))
# scbplasma <- scb.mean(time, plasma, bandwidth = h, scbtype = "both", gridsize = 100)
# scbplasma
# plot(scbplasma, cex = .2, legend.cex = .85, xlab = "Time", ylab = "Concentration", 
#   main = "Plasma citrate data")
# ## End(Not run)

Run the code above in your browser using DataLab