I asked the following question in the site Cross Validated: https://stats.stackexchange.com/questions/444320/convergence-of-kernel-density-estimate-as-the-sample-size-grows/444479#444479. It was about estimating the probability density function via a kernel-based method.
For example, let $X\sim\text{Normal}(0,1)$ and let $f_X$ be its probability density function. Let $\hat{f}_X^M$ the kernel density estimate using $M$ realizations. Let $$\epsilon=E\left[\|f_X-\hat{f}_X^M\|_\infty\right]$$ be the error, where $E$ is the expectation. The procedure for estimating $\epsilon$ is as follows:
Consider a geometric sequence of lengths $M$ (in log-log scale, these points will be at the same distance).
For each $M$, generate $M$ realizations for constructing $\hat{f}_X^M$.
Compute $\|f_X-\hat{f}_X^M\|_\infty$ for all lengths $M$ (the infinity norm is approximated by discretizing the domain).
Repeat steps 1-3 several times, say 10 times, and compute the average to estimate $\epsilon$. Compute sample quantiles to derive an estimated $90\%$ confidence interval for $\|f_X-\hat{f}_X^M\|_\infty$.
Using the built-in function SmoothKernelDistribution
with no specified option for step 2, I observed that the error $\epsilon$ goes down with $M$ until a certain length $M_0$, from which $\epsilon$ stabilizes:
It seems that the bandwidth selected is not sufficiently small, which produces bias (stabilization of the error) and small variance (more narrow confidence intervals) when $M$ grows. According to the documentation, SmoothKernelDistribution
employs Silverman's rule with Gaussian kernel by default.
I implemented Silverman's rule myself with bandwidth choice $1.06\times\hat{\sigma}_X\times M^{-1/5}$, see the answer from Cross Validated. In such case, the error tends to 0 as $M$ grows with no problem:
If the bandwidth selection is $0.9\times\min\{\hat{\sigma}_X,\frac{\text{IQR}}{1.34}\}\times M^{-1/5}$, the error also tends to 0 with $M$:
Notice also that, in these last two cases, the error attained is smaller and the confidence interval has a similar width for every $M$.
I cannot post the code because it is part of a work. I just want to know which is the bandwidth selected by SmoothKernelDistribution
(to know if I can use this function in the future), or if you have experienced any problems with this function as the sample size grows.