fregion.test: Performs hypothesis test(s) based on functional confidence...

Description Usage Arguments Examples

Description

Performs hypothesis test(s) based on functional confidence region(s).

Usage

1
2
fregion.test(x, x0 = 0, cov, N = 1, type = c("Ec"), pc.cut = c(0.99),
  prec = NULL, hat.cov = NULL, df = NULL)

Arguments

x

Functional parameter estimate. It can be either a vector or fd object from fda.

x0

Functional parameter under the null hypothesis. Zero function is assumed if it's not given.

cov

N * Cov(X), in which X is the functional estimator. It can be either matrix or bifd object from fda. The eigen decomposition of Cov(X) can be used instead.

N

It should be '1' if 'cov' is the covariance operator for X itself, which is the default value.

type

This specifies which regions to be used for the tests. It should be a collection of the following: "Enorm", "Epc", "Ec", "Ec1", "Rz", "Rz1", "Rzs", or "Rz1s".

  • Enorm : The Hilbert space norm based test, which uses a ‘ball’ in the function space(H).

  • Epc : fPCA based test, which is a finite-dimensional chi-square ellipse in H

  • Ec : The suggested test based on the ellipsoid region in which radius are proportional to the square-root of corresponding eigenvalues.

  • Ec1 : The second suggestion for ellipsoie region, in which radius are proportional to the square-root of tails sums of eigenvalues. Doesn't require any smoothness assumption.

  • Rz : The suggested rectangular region based test.

  • Rz1 : The second suggested rectangular region based test.

  • Rzs : The small sample version of Rz.

  • Rz1s : The small sample version of Rz1.

pc.cut

It takes a vector of number of fPC to use in each HT. For integer values, fPC up to those values will be used. If it's a value from 0 to 1, this specifies the proportion of (estimated) variance that should be explained by the fPCs. If it is 0, all the available fPCs will be used as long as the size of eigenvalues are greater than .Machine$double.eps.

prec

This determines the accuracy of imhof. One may try to modify this if p-value achieved in Ellipsoid form other than Epc gives negative value. It should the the form of c(epsabs, epsrel, limit).

hat.cov

An optional estimated covariance operator, which will be used when 'cov' is given as the true covariance and small sample version(s) are used. Usually not needed.

df

Degree of freedom to use in small sample versions.

Examples

 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
# 1. Vector/matrix version

# Generate a sample
p = 200 ; N = 80 ; rangeval = c(0,1)
grid = make.grid(p, rangevals=rangeval)
mu0 = meanf.poly(grid,c(0,1)) ; names(mu0) = grid
mu = meanf.poly(grid,c(0,1.2)) ; names(mu) = grid
cov.m = make.cov.m(cov.f = covf.st.matern, grid=grid, cov.f.params=c(2/2,1,1))
x = make.sample(mu,cov.m,N)

# Find the estimate and covariance
hat.mu = rowMeans(x)
hat.cov.m = crossprod(t(x - hat.mu)) / (N-1)
e.hat.cov.m = eigen(hat.cov.m)   # <- This is optional and can be provide into the functions instead of hat.cov.m below.

# Compare different methods for Hypothesis testings.
(a1 <- fregion.test(hat.mu,mu0,hat.cov.m,N,type=c("ALL"),pc.cut=c(1,3,4,5,0.99,0.999)))


# 2. fd/bifd version

# create basis, convert vector/matrix into fd/bifd objects.
require(fda)
nbasis <- round(p*0.9)
fd.basis <- create.bspline.basis(rangeval,nbasis)
mu0.fd <- Data2fd(names(mu0),mu0,fd.basis)
mu.fd <- Data2fd(names(mu),mu,fd.basis)
x.fd <- Data2fd(rownames(x),x,fd.basis)
hat.mu.fd <- mean.fd(x.fd)
hat.cov.fd <- var.fd(x.fd)
e.hat.cov.fd <- eigen.fd(hat.cov.fd)   # <- This is optional and can be provide into the functions instead of hat.cov.fd below.

# Compare different methods for Hypothesis testings.
(a1.fd=fregion.test(hat.mu.fd,mu0.fd,hat.cov.fd,N,type=c("ALL"),pc.cut=c(1,3,4,5,0.99,0.999)))

hpchoi/fregion documentation built on May 17, 2019, 4:53 p.m.