Given i.i.d samples (x1,y1), ... (xn,yn) such that yi = f0(xi) + $\epsilon$i, i = 1,... n for some f0
Suppose I want an estimate $\hat{f}$ of f0 using k-nearest-neighbors regression in the neighborhood of each xi in my dataset. So for each xi, I must search for the k nearest neighboring elements and take the average of the set of all yj such that j $\in$ $\mathcal{N}$k(xi) where $\mathcal{N}$k(x) contains the k nearest points of x:
$$\hat{f}(x_i) = \frac{1}{k}\sum_{j\in\mathcal{N}_k(x_i)} y_j$$
Now if my xi are all evenly spaced, then I could simply sort them in ascending order and calculate a moving average over corresponding elements in y with window size k. My question is: Will this moving average be approximately equivalent to k-nearest neighbors regression even if (x1, ... xn) are not evenly spaced? Are there any tests I can do on the distribution P(x) to check the quality of approximation?