| Group: | Matrix Manipulation |
| Topic: | Sorting and Counting |
| See also: | mknn |
| Function: | knn | |
| Description: | computes a running mean over (2k+1) consecutive values of a given vector. To have the same length at the beginning and at the end the first and last value are repeated k times. |
| Usage: | m = knn (x, k) | |
| Input: | ||
| x | n vector of the obervations | |
| k | scalar range of the running mean | |
| Output: | ||
| m | n vector containing the smoothed values | |
randomize(1) knn (uniform (8), 2)
Contents of knn [1,] 0.25989 [2,] 0.25989 [3,] 0.25989 [4,] 0.28321 [5,] 0.28438 [6,] 0.31511 [7,] 0.31511 [8,] 0.31511
| Group: | Matrix Manipulation |
| Topic: | Sorting and Counting |
| See also: | mknn |