I need to find the expected value and variance of KDE given that $$(i) E[u] = 0 \to \int u\phi(u)du=0\\ (ii)V[u] = \sigma^2 \to \int u^2\phi(u)du=\sigma^2$$ where $\phi$ is the kernel function.
I've tried to do it and also searched for online resourced and while I've found answer, they aren't really explained and I don't really understand where they come from. For expected value $$\mathbf{E}(p_n (x)) = \mathbf{E}\left(\frac{1}{Nh} \sum_{i=1}^{N} \phi(\frac{x-x_i}{h})\right) = \frac{1}{h}\mathbf{E}\left(\phi(\frac{x-x_1}{h})\right) \\= h^{-1} \int \phi(\frac{x-x_1}{h}) p(x_1) dx_1 =\int \phi(z) p(x - hz) dz $$ By using Taylor's theorem $ p(x+(-hz)) = p(x) - p'(x)hz + \frac{1}{2}p''(x)h^2 z^2 + Ο(h^3)$ we get $$ \mathbf{E}(p_n (x)) = \int \phi(z) [p(x) - p'(x)hz + \frac{1}{2}p''(x)h^2 z^2+O(h^3)]dz \\ = p(x)\int \phi(z)dz -hp'(x)\int \phi(z)zdz + \frac{1}{2}h^2 p''(x) \int \phi(z)z^2dz + O(h^3) \\ = p(x) - 0 + \frac{1}{2}h^2p''(x) \int\phi(z)z^2dz + O(h^3) \\ = p(x) +\frac{1}{2}h^2p''(x) \sigma^2 + O(h^3)$$
I think I understand what's going on so far and I could probably do it myself but I can't figure out the variance. $$Var(p_n(x)) = Var\left(\frac{1}{Nh}\sum_{i=1}^{N} \phi(\frac{x-x_i}{h})\right) =\\ =\frac{1}{N^2h^2} \sum_{i=1}^{N}Var\left(\phi(\frac{x-x_i}{h})\right) + 0 \\ \\ =\frac{1}{Nh^2}Var\left(\phi(\frac{x-x_1}{h})\right) = \\ =\frac{1}{Nh^2}\left[\mathbf{E}\left(\phi^2(\frac{x-x_1}{h})\right)-\left[\mathbf{E}\left(\phi(\frac{x-x_1}{h})\right)\right]^2\right] =\\ =\frac{1}{Nh^2}\left[\int \phi^2(\frac{x-x_1}{h})p(x_1)dx_1 - \left[ \int \phi(\frac{x-x_1}{h})p(x_1)dx_1\right]^2\right] = \frac{1}{Nh^2}\left[h\int \phi^2(z)p(x-hz)dz - \left[h\int \phi(z)p(x-hz)dz\right]^2\right]= \\ $$
I've gotten that far but im not sure how to continue. The 2nd term of the last line is the expected value we calculated above. The online resources I found use taylor's expansion again and write $O(h^2)$ to describe the second term, then switch to $O(h)$ then swap to $o(h)$ and Im totally confused, especially because I dont completely understand this notation.. Any help would be appreciated.. thanks.