Learn R Programming

fdars (version 0.3.3)

S.KNN: K-Nearest Neighbors Smoother Matrix

Description

Compute a smoother matrix using adaptive bandwidth based on the k nearest neighbors. The bandwidth at each point is the distance to the k-th nearest neighbor.

Usage

S.KNN(tt, knn, Ker = "norm", w = NULL, cv = FALSE)

Value

An n x n smoother matrix S.

Arguments

tt

Evaluation points (numeric vector).

knn

Number of nearest neighbors.

Ker

Kernel function or name.

w

Optional weights vector.

cv

Logical. If TRUE, compute leave-one-out cross-validation matrix.

Examples

Run this code
tt <- seq(0, 1, length.out = 50)
S <- S.KNN(tt, knn = 10)

Run the code above in your browser using DataLab