Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Statistical Data Analysis
Topic: Nonparametric Methods
See also: sker isoreg rmed l1line lowess

Function: sknn
Description: sknn computes the k-nearest neighbour smooth regression from scatter plot data. As inputs you have to specify the explanatory variable x, the dependent variable y and the smoothing parameter k.

Usage: yh = sknn (x, y, k)
Input:
x n x 1 vector
y n x 1 vector
k scalar
Output:
yh n x 1 vector

Note:

Example:
x = read("geyser")
x = sort(x, #(1,2))
mh = x[,1]~sknn(x[,1],x[,2], 11)
d = createdisplay(1,1)
show(d, 1, 1, x, mh)

Result:
shows the geyser data and the sknn regression smoother



(C) MD*TECH Method and Data Technologies, 05.02.2006