fregion.band: Makes confidence bands

Description Usage Arguments Value Examples

Description

Makes confidence bands

Usage

1
2
3
fregion.band(x, cov, N = 1, type = c("Bs", "BEc"), conf.level = c(0.95),
  grid.size = 200, inv.method = "gamma.approx", prec = NULL,
  sim.size = 10000)

Arguments

x

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

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

The band(s) to be constructed.

  • BEc : The suggested modified Scheffe style band from hyper-ellipsoie Ec, which uses up to the very last dimension.

  • BEc1 : Another modified Scheffe style band from hyper-ellipsoie Ec1. (Wider than BEc although it does not require smoothness assumption. For comparision purpose only, not recommend for use)

  • Bs : Parametric bootstrap simultaneous confidence band, similar to the one appeard in Degras(2011) (for comparision purpose)

  • naive-t : A collection of point-wise t-intervals. (for comparision purpose)

  • BEPC.x : Scheffe band from 'x' dimensional chi-square ellipse. (for comparision purpose)

conf.level

A vector of confidence levels for the bands to achieve.

grid.size

This determines on how fine grid the bands will be constructed before converted as an ‘fd’ object. This parameter is used only when 'x' is fd object and 'cov' is bifd object.

inv.method

(Currently Not Used) This determines how the inverse of the sum of chi squares distribution will be achieved. It can be either "gamma.approx", or "inv.imhof". Currently, only "gamma.approx" works.

prec

(Currently Not Used) This determines the accuracy of imhof. It's used only when inv.method is inv.imhof.

sim.size

This determines bootstrap sample size for Bs

Value

fregion.band Either a collection of vector valued bands or ‘fd’ object whose objectname is changed to fregion.band.

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
35
36
# 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.1)) ; 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.

# Make and visualize/compare confidence bands
b <- fregion.band(hat.mu,hat.cov.m,N=N,type=c("Bs","BEc","BEPC.10","naive.t"),conf.level=c(0.95))
plot(b)


# 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.

# Make and visualize/compare confidence bands.
b.fd <- fregion.band(hat.mu.fd,hat.cov.fd,N=N,type=c("Bs","BEc"), conf.level=c(0.95, 0.9))
plot(b.fd)

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