scb.equal: Compare Two Mean Functions

Description Usage Arguments Value References See Also Examples

View source: R/scb.equal.R

Description

This two-sample test builds simultaneous confidence bands (SCB) for the difference between two population mean functions and retains the equality assumption if the null function is contained in the bands. Equivalently, SCB are built around one of the local linear estimates (the one for say, population 1), and the equality hypothesis is accepted if the other estimate (the one for population 2) lies within the bands.

Usage

1
2
3
4
scb.equal(x, y, bandwidth, level = .05, degree = 1, 
	scbtype = c("normal","bootstrap","both","no"), gridsize = NULL, 
	keep.y = TRUE, nrep = 2e4, nboot = 1e4, parallel = c("no","multicore","snow"), 
	ncpus = getOption("boot.ncpus",1L), cl = NULL)

Arguments

x

a list of length 2 or matrix with 2 columns containing the x values of each sample. If the two samples are observed on the same grid, x can be specified as a single vector. The range of x must be the same for each sample; missing values are not accepted.

y

a list of length 2 containing matrices or data frames with functional observations (= curves) stored in rows. The number of columns of each component of y must match the length of the corresponding x. Missing values are not accepted.

bandwidth

the kernel bandwidths (numeric vector of length 1 or 2).

level

the significance level of the test (default = .05).

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 over which the mean function is to be estimated. Defaults to the length of the smallest x grid.

keep.y

logical; if TRUE, keep y in the result.

nrep

the number of replicates for the normal SCB method (default = 20,000).

nboot

the number of replicates for the bootstrap SCB method (default = 5,000).

parallel

the computation method for the bootstrap SCB. By default, computations are sequential ("no").
The function boot is used and can be run in parallel using the package parallel.
Both options "multicore" and "snow" are available for parallel computing.

ncpus

the number of cores to use for parallel computing if parallel = "multicore".

cl

the name of the cluster to use for parallel computing if parallel = "snow".

Value

A list object of class "SCBand". Depending on the function used to create the object (scb.mean, scb.model, or scb.equal), some of its components are set to NULL. For scb.mean, the object has components:

x

the argument x.

y

if keep.y is TRUE, the argument y, else NULL.

call

the function call.

model

NULL.

par

NULL.

nonpar

a list of two local linear estimates, one for each population.

bandwidth

the argument bandwidth.

degree

the degree of local polynomial used. Currently, only local linear estimation is supported.

level

the argument level.

scbtype

the argument scbtype.

teststat

the test statistic.

pnorm

the p value for the normal-based statistical test.

pboot

the p value for the boostrap-based statistical test.

qnorm

the quantile used to build the normal SCB.

qboot

the quantile used to build the bootstrap SCB.

normscb

a matrix containing the normal SCB stored in columns.

bootscb

a matrix containing the bootstrap SCB stored in columns.

gridsize

the argument gridsize, or length(x) if no argument was specified.

nrep

the argument nrep.

nboot

the argument nboot.

Depending on the value of scbtype, some or all of the fields pnorm, qnorm, normscb, nrep, pboot, qboot, normboot and nboot may be NULL.

References

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

See Also

scb.mean, scb.model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
# Phoneme data: compare the mean log-periodograms 
# for phonemes "aa" as the vowel in "dark" and "ao" 
# as the first vowel in "water"
data(phoneme)
n <- nrow(phoneme)
N <- ncol(phoneme) 
classes <- split(1:n,phoneme[,N])
names(classes) <- c("sh", "iy", "dcl", "aa", "ao")
freq    <- 1:150
compare.aa.ao <- scb.equal(freq, list(phoneme[classes$aa,-N], 
  phoneme[classes$ao,-N]), bandwidth = c(.75, .75), scbtype = "both", nboot = 2e3)
summary(compare.aa.ao)

## End(Not run)

Example output

Call:
scb.equal(x = freq, y = list(phoneme[classes$aa, -N], phoneme[classes$ao, 
    -N]), bandwidth = c(0.75, 0.75), scbtype = "both", nboot = 2000)

Data:
             Data 1           Data 2        
Range.x      [1, 150]         [1, 150]      
Range.y      [0.071, 26.553]  [0.418, 26.91]
Sample size  400              400           

Analysis:
Equality test for mean functions
Bandwidths: 0.75 0.75 
Grid size: 150 
SCB type: normal and bootstrap 
Significance level: 0.05 
Replicates: 20000 (normal) 2000 (bootstrap)
Test statistic and p value(s)
  supnorm  normal p  bootstrap p
  22.42    <1e-16    <1e-16     

SCBmeanfd documentation built on May 2, 2019, 4:19 a.m.