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 |
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)
shows the geyser data and the sknn regression smoother