confidence_intervals_LP: Asymptotic confidence intervals for the local polynomial...

Description Usage Arguments Value Examples

Description

Asymptotic confidence intervals for the local polynomial estimator

Usage

1
2
3
4
5
6
7
8
9
confidence_intervals_LP(
  x,
  X,
  Y,
  kernel = epanechnikov,
  bw,
  degree = 1L,
  alpha = 0.05
)

Arguments

x

Evaluation points (vector).

X

Data for the regressor (vector).

Y

Data for the regressand (vector).

kernel

Kernel (function). Default is epanechnikov.

bw

Bandwidth (scalar).

degree

Degree of the locally fitted polynomial (integer). Default is 1L.

alpha

Significance level (scalar). Default is 0.05.

Value

List containing:

confidence_intervals_lower

Lower points for the (1 - alpha) asymptotic confidence intervals (vector).

confidence_intervals_upper

Upper points for the (1 - alpha) asymptotic confidence intervals (vector).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
m_fun <- function(x) {sin(2*pi*x)} # True regression function
n <- 100 # Sample size
X <- seq(0, 1, length.out = n) # Data for the regressor
m_X <- m_fun(X) # True values of regression function
epsilon <- rnorm(n, sd = 0.25) # Error term
Y <- m_X + epsilon # Data for the regressand
bw <- 0.2 # Bandwidth
x <- seq(0, 1, length.out = n/2) # Evaluation points

output_confidence_intervals_LP <- confidence_intervals_LP(x = x, X = X, Y = Y, bw = bw,
                                                          alpha = 0.05)
confidence_intervals_lower <- output_confidence_intervals_LP$confidence_intervals_lower
confidence_intervals_upper <- output_confidence_intervals_LP$confidence_intervals_upper

svjaco/lpreba documentation built on March 4, 2022, 12:42 a.m.