NpregBand: Confidence band for nonparametric regression

Description Usage Arguments Value Examples

View source: R/main.R

Description

Constructs a minimax optimal honest confidence band for nonparametric regression function values under a specified function class.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
NpregBand(
  y,
  x,
  C,
  level,
  fclass = c("L", "H"),
  n.eval = length(x)/5,
  eval = NULL,
  q.int = 0.025,
  n.sim = 10^3,
  kern = "tri",
  deg = 1,
  var.reg = "npr",
  seed = NULL,
  root.robust = FALSE,
  ng = 10,
  x.out = NULL,
  c.method = "supp2",
  print.t = TRUE
)

Arguments

y

vector of dependent variables.

x

vector of regressors.

C

bound on the first or the second derivative, depending on fclass.

level

coverage probability.

fclass

function class specification, "L" for the Lipschitz class, and "H" for the Hölder class.

n.eval

number of grid points to use when constructing confidence band; default is n.eval = length(x) / 5.

eval

grid points to use when constructing confidence band; if it is not specified, eval is automatically determined by n.eval and q.int.

q.int

parameter determining the distance from the boundary of the support of x. Confidence band is formed for points between the q.int quantile and the 1 - q.int quantile of x. q.int should be between 0 and 0.5. The default is q.int = 0.025. Setting q.int > 0 is recommended, and it is only relevant when eval is not specified.

n.sim

number of bootstrap samples to use when calculating quantiles of suprema of empirical processes; the default is n.sim = 10^3

kern

type of kernel used in estimation; currently, only the triangle kernel (kern = "tri") is supported.

deg

degree of local polynomial estimator used in the first-stage variance estimation; the default is deg = 1.

var.reg

nonparametric regression method used to calculate residuals; either "npr" (standing for nprobust package) or "locpol" (standing for locpol package). Default is var.reg = "npr".

seed

seed number for bootstrap random sample generation. The default is seed = NULL.

root.robust

if TRUE, the fuction conducts diagnostic test whether optimizaiton worked well; default is root.robust = FALSE. Currently, this feature is obsolete.

ng

the number of grids of quantile values over which the diagnostic test would be peformed if root.robust = TRUE; default is ng = 10. Currently, this feature is obsolete.

x.out

the grid of points the confidence band is evaluated; If x.out is not NULL, confidence band is calculated over x.out using linear interpolation. Default value is NULL.

c.method

method to calculate the optimal value of c_n. Currently, using the default value c.method = "supp2" is recommended and other options are obsolete.

print.t

if TRUE, print the progress of confidence band construction with the number of loop.

Value

data.frame object containing index set and corresponding confidence band values.

Examples

1
2
3
4
x <- seq(-1, 1, length.out = 500)
y <- x^2 + rnorm(500, 0, 1/4)
NpregBand(y, x, 2, 0.95, "L", n.eval = 25)
NpregBand(y, x, 2, 0.95, "H", n.eval = 25)

koohyun-kwon/HTEBand documentation built on Dec. 21, 2021, 7:42 a.m.