<figure><img src="image_1.png" /></figure>

HAL
open science

# Pointwise Sharp Moderate Deviations for a Kernel Density Estimator

Siyu Liu, Xiequan Fan, Haijuan Hu, Paul Doukhan

<figure><img src="image_2.png" /></figure>

## To cite this version:

Siyu Liu, Xiequan Fan, Haijuan Hu, Paul Doukhan. Pointwise Sharp Moderate Deviations for a Kernel Density Estimator. Mathematics, 2024, 12, 10.3390/math12203161. [hal-05321561]

HAL Id: hal-05321561

https://hal.science/hal-05321561v1

Submitted on 19 Oct 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_3.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Article

# Pointwise Sharp Moderate Deviations for a Kernel Density Estimator

Siyu Liu<fnref n="1" />, Xiequan Fan<fnref n="1" />*, Haijuan Hu<fnref n="1" /> and Paul Doukhan<fnref n="2" />

**Abstract:** Let $f_n$ be the non-parametric kernel density estimator based on a kernel function $K$ and a sequence of independent and identically distributed random vectors taking values in $\mathbb{R}^d$. With some mild conditions, we establish sharp moderate deviations for the kernel density estimator. This means that we provide an equivalent for the tail probabilities of this estimator.

**Keywords:** Cramér moderate deviations; kernel density estimator; kernel function

**MSC:** 60F10; 62G07; 60E05; 62E20

## 1. Introduction

Let $\{X_i; i \ge 1\}$ be a sequence of independent and identically distributed (i.i.d.) random vectors taking values in $\mathbb{R}^d$ on probability space $(\Omega, \mathcal{F}, \mathbf{P})$ with density function $f$. Let $K: \mathbb{R}^d \to \mathbb{R}$ be a kernel function. The kernel density estimator of $f$ is defined by

$$f_n(x) = \frac{1}{na_n^d} \sum_{i=1}^{n} K\left(\frac{x - X_i}{a_n}\right), \quad x = (x_1, x_2, \dots, x_d)^T \in \mathbb{R}^d,$$

where $\{a_n, n \ge 1\}$ is a bandwidth sequence, that is, a sequence of positive numbers satisfying

$$a_n \to 0, \quad na_n^d \to +\infty \quad \text{as} \quad n \to +\infty.$$

A great and synthetic reference for such estimates is [1]. Among the huge number of applications of kernel density estimation, let us cite the elegant paper in [2] which makes use of this estimator for an important problem related with green algae: using our results may be used to derive a decision rule for this important ecological question.

In this paper, we are interested in the pointwise sharp moderate deviations for $\{f_n, n \ge 1\}$ by the empirical process approach; the volume in [3] is a perfect overview for such questions. In order to present our main result, let us first introduce some notations and assumptions. Let $g: \mathbb{R}^d \to \mathbb{R}$ be a real function. As usual, denote by

$$\|g\|_p = \left( \int_{x \in \mathbb{R}^d} |g(x)|^p dx \right)^{\frac{1}{p}}, \quad 1 \le p < \infty \quad \text{and} \quad \|g\|_{\infty} = \sup_{x \in \mathbb{R}^d} |g(x)|$$

the $L_p$-norm of $g$ and the supermum norm, respectively.

The consistency for the kernel density estimator has been studied widely. Let $f$ be continuously differentiable on $\mathbb{R}$ such that $\|f\|_{\infty} < \infty$ and $\|f'\|_{\infty} < \infty$ ($f'$ is the derivative of $f$). In addition, suppose that $\lim_{N \to \infty} na_n = \infty$ and $\lim_{N \to \infty} na_n^2 = c \ge 0$, where $c$ is a

check for
updates

**Citation:** Liu, S.; Fan, X.; Hu, H.; Doukhan, P. Pointwise Sharp Moderate Deviations for a Kernel Density Estimator. Mathematics 2024, 12, 3161. https://doi.org/10.3390/math12203161

Academic Editors: Leonid V. Bogachev, Alexander Tikhomirov, Vladimir Ulyanov and Elena Yarovaya

Received: 27 July 2024
Revised: 9 September 2024
Accepted: 25 September 2024
Published: 10 October 2024

<figure><img src="image_4.png" /></figure>

**Copyright:** © 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

<footnote n="1">¹ School of Mathematics and Statistics, Northeastern University at Qinhuangdao, Qinhuangdao 066004, China</footnote>

<footnote n="2">² CY University, AGM UMR 8088, Saint-Martin, 95000 Cergy-Pontoise, France</footnote>

<footnote>* Correspondence: fanxiequan@neuq.edu.cn</footnote>
constant. With some mild conditions, Joutard [4] proved the following pointwise sharp large deviation: for any $\alpha > 0$ and $n \to \infty$,

$$ \mathbf{P}(f_n(x) - f(x) > \alpha) = \frac{\exp\{-na_n\Lambda^*(\alpha) + cH(\tau)\}}{\tau(2\pi na_n f(x)I''(\tau))^{\frac{1}{2}}} (1 + O(1)), $$

where $\Lambda^*(\alpha) = \tau(\alpha + f(x)) - f(x)I(\tau)$, $\tau \in [0, \alpha]$, is such that $\alpha + f(x) = f(x)I'(\tau)$ and $H(\tau) = -(f^2(x)I^2(\tau)/2 + f'(x)J(\tau))$, with $J(t) = \int_{\mathbb{R}} z \exp\{tK(z)\}dz$. For uniform consistency, with some mild conditions, Gao [5] proved the following moderate deviation principle (MDP) result. Let $\{b_n, n \ge 1\}$ be a sequence of positive real numbers satisfying

$$ \frac{na_n^d}{b_n} \to +\infty, \quad \frac{na_n^d \log a_n^{-1}}{b_n^2} \to +\infty \quad \text{as} \quad n \to +\infty. $$

Gao [5] proved that for any $\lambda > 0$,

$$ \lim_{n \to \infty} \frac{na_n^d}{b_n} \ln \mathbf{P} \left( \frac{na_n^d}{b_n} \|f_n - \mathbf{E}f_n\|_{\infty} > \lambda \right) = -I(\lambda), $$

where

$$ I(\lambda) = \frac{\lambda^2}{2 \|f\|_{\infty} \|K\|_2^2}. $$

A pointwise MDP is also established in Gao [5]. A class of refinements of pointwise MDP is called sharp moderate deviations. Sharp moderate deviations are also known as Cramér moderate deviations, and have attracted a lot of interest. We refer to Cramér [6], Petrov [7], Beknazaryan et al. [8] and Fan et al. [9] for such type results. In this paper, we are interested in establishing sharp moderate deviations for the kernel density estimator.

The paper is organized as follows. Our main result is stated and discussed in Section 2. The proof of our theorem is given in Section 3.

## 2. Main Results

The following assumptions will be used in this paper.

(A) Assume that the kernel function $K$ satisfies

$$ \int_{x \in \mathbb{R}^d} K(x) dx = 1 \quad \text{and} \quad \|K\|_{\infty} < +\infty. $$

(B) There exist a constant $\beta \in (0, 1]$ and a non-negative integer $s$ such that for any $x, y, z \in \mathbb{R}^d$,

$$ |(z \cdot \nabla)^s f(x) - (z \cdot \nabla)^s f(y)| \le A \|x - y\|_2^\beta \|z\|_2^s, $$

where $A$ is a positive constant, $\| \cdot \|_2$ is the Euclidean distance and

$$ z \cdot \nabla = z_1 \frac{\partial}{\partial x_1} + z_2 \frac{\partial}{\partial x_2} + \dots + z_d \frac{\partial}{\partial x_d}. $$

(C) Assume

$$ \int_{x \in \mathbb{R}^d} K^2(x) \|x\|_2^{s+\beta} dx < +\infty \quad \text{and} \quad \int_{x \in \mathbb{R}^d} K(x) \prod_{i=1}^{d} x_i^{j_i} dx = 0, \quad 0 < \sum_{i=1}^{d} j_i \le s. $$

**Remark 1.** After [1], we recall that the previous assumptions are pretty standard and we restate them in the current multivariate setting:

1. The first condition in Assumption (A) is necessary to ensure that the estimate remains a function with integral 1;
the second one is not necessary but no striking or useful unbounded kernel was used in the frame of density estimation. Moreover, this condition makes it useless to assume that $\int_{x \in \mathbb{R}^d} K^2(x) dx < \infty$, for example.

2. Assumption (B) is a regularity condition on $f$ with order $s + \beta$, with $\beta > 0$ and $s \in \mathbb{N}$ as considered before.

3. The first condition in Assumption (C) is useful to prove that the involved expressions are square-integrable. The second part of this condition is more tricky and ensures that the Taylor expansion up to order $s$ provides the relation

$$ \int_{z \in \mathbb{R}^d} K(z)f(x+z) dz = f(x) + O(\|x\|^{s+\beta}), \quad (1) $$

since all the intermediate terms simply vanish. It is important to also quote that such kernels $K$ exist. A very simple and usual case is $s = \beta = 1$ (second-order regularity), which holds in case $K$ is symmetric with respect to each of its coordinates; it this case, it is possible to obtain $K(z) \ge 0$ and then the estimator $f_n$ is still a density (since it is non-negative). For the general case $s \in \mathbb{N}$, a standard procedure to prove the existence of such kernels is to define $K(z) = P(z)\delta(z)$ for a fixed bounded density function and $d^\circ P = s$, where $d^\circ P$ is the degree of the polynomial $P$. Then, it is easy to prove that the system of equations in (C) together with the first part of (A) is invertible and linear because the matrix with coefficients

$$ a_{j,k} = \int_{z \in \mathbb{R}^d} K(x) \prod_{i=1}^{d} x_i^{j_i+k_i} dx, \quad 0 < \sum_{i=1}^{d} j_i \le s, \ 0 < \sum_{i=1}^{d} k_i \le s, $$

is symmetric non-negative definite; this point is a straightforward extension of Lemma 3.3.1 in [10] to our multidimensional setting.

Assume that $f(x) > 0$ for some $x \in \mathbb{R}^d$. Denote

$$ D_n(x) = \frac{\sqrt{na_n^d}(f_n(x) - \mathbf{E}f_n(x))}{\sqrt{f(x)\|K\|_2^2 + \sum_{t=1}^s a_n^{\frac{1}{t}} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz}}. $$

We have the following pointwise sharp moderate deviations for the kernel density estimator.

**Theorem 1.** Assume that Conditions (A)–(C) are satisfied. Assume $f(x) > 0$ for some $x \in \mathbb{R}^d$. Then, it holds that

$$ \ln \frac{\mathbf{P}(D_n(x) \ge t)}{1 - \Phi(t)} = O\left( \frac{1 + t^3}{\sqrt{na_n^d}} + t^2 a_n^{(s+\beta)\wedge d} \right) \quad (2) $$

uniformly for $0 \le t = o(\sqrt{na_n^d})$ as $n \to \infty$. Moreover, the same equality remains valid when $\ln \frac{\mathbf{P}(D_n(x) \ge t)}{1 - \Phi(t)}$ is replaced by $\ln \frac{\mathbf{P}(D_n(x) \le -t)}{1 - \Phi(t)}$.

For the non-centered case, we have the following pointwise sharp moderate deviations for the kernel density estimator. Denote

$$ \hat{D}_n(x) = \frac{\sqrt{na_n^d}}{\|K\|_2 \sqrt{f(x)}} \left( f_n(x) - f(x) - \sum_{t=1}^s \frac{1}{t!} \int_{x \in \mathbb{R}^d} K(z)(z \cdot \nabla)^t f(x) dz a_n^t \right). $$

**Theorem 2.** Assume that conditions (A)–(C) are satisfied. Assume $f(x) > 0$ for some $x \in \mathbb{R}^d$. Then, it holds that

$$ \ln \frac{\mathbf{P}(\hat{D}_n(x) \ge t)}{1 - \Phi(t)} = O\left( \frac{1 + t^3}{\sqrt{na_n^d}} + t^2 a_n^{(s+\beta)\wedge d} + (1+t) \sqrt{na_n^{s+\beta+d/2}} \right) \quad (3) $$
uniformly for $0 \le t = o(\sqrt{na_n^d})$ as $n \to \infty$. Moreover, the same equality remains valid when $\ln \frac{\mathbf{P}(\hat{D}_n(x) \ge t)}{1 - \Phi(t)}$ is replaced by $\ln \frac{\mathbf{P}(\hat{D}_n(x) \le -t)}{1 - \Phi(t)}$.

**Remark 2.** Let us comment on Theorem 2.

1. In the expression of $D_n$, recall that (1) in Remark 1 entails that $\mathbf{E}f_n(x) - f(x) = O(a_n^{s+\beta})$.

2. This result makes it possible to provide a practitioner with precise confidence intervals that are easy to compute in the case of hypothesis testing. Explicit asymptotic p-values can thus be straightforwardly obtained. For instance, consider the following hypothesis testing:

$$H_0: f(x_0) = t_0 \quad \text{versus} \quad H_1: f(x_0) \neq t_0,$$

with $t_0 > 0$. Denote

$$z_0 = \frac{\sqrt{na_n^d}}{\|K\|_2 \sqrt{f(x_0)}} (f_n(x_0) - t_0).$$

Then, by Theorem 2, the p-value is asymptotically equal to $2(1 - \Phi(z_0))$, provided that $z_0$ satisfies

$$\frac{1 + z_0^3}{\sqrt{na_n^d}} + z_0^2 a_n^{(s+\beta)\wedge d} + (1 + z_0) \sqrt{na_n^{s+\beta+d/2}} \to 0.$$

as $n \to \infty$.

3. Cases of other non parametric estimators, such as the Nadaraya-Watson kernel regression estimator (cf. El Machkouri et al. [11] for instance), non-linear regression estimates or conditional expectations, for predictions issues or estimates of derivatives or even quantile regression estimators, see Rosenblatt [1], will be derived in further subsequent papers.

4. Even if a non-independent version of this result is accessible, we prefer to give a simple result in the current i.i.d. case.

By Theorem 2, we have the following Berry-Esseen bound for $\hat{D}_n(x)$, that is,

$$\sup_{t \in \mathbb{R}} |\mathbf{P}(\hat{D}_n(x) \le t) - \Phi(t)| = O\left(\frac{1}{\sqrt{na_n^d}} + a_n^{(s+\beta)\wedge d} + \sqrt{na_n^{s+\beta+d/2}}\right). \quad (4)$$

In particular, by taking $a_n = n^{-1/(s+\beta+d)}$, we obtain

$$\sup_{t \in \mathbb{R}} |\mathbf{P}(\hat{D}_n(x) \le t) - \Phi(t)| = O(n^{-(s+\beta)/(2s+2\beta+d)}).$$

Moreover, if $s = 0$ and $\beta = d = 1$, i.e., $f$ is 1-Hölder-continuous, then it holds that

$$\sup_{t \in \mathbb{R}} \left| \mathbf{P} \left( \frac{n^{\frac{1}{4}}}{\|K\|_2 \sqrt{f(x)}} (f_n(x) - f(x)) \le t \right) - \Phi(t) \right| = O(n^{-1/3}).$$

**Conclusions.** When $f \in C^1(\mathbb{R}^d)$ and $K(z)$ is symmetric with respect to 0, which implies that $\int_{z \in \mathbb{R}^d} z_i K^2(z) dz = 0$ for all $1 \le i \le d$, by taking $s = 1$ in Assumptions (C), then we have

$$\int_{x \in \mathbb{R}^d} K(z)z \cdot \nabla f(x) dz = 0,$$

which implies

$$D_n(x) = \frac{\sqrt{na_n^d}}{\|K\|_2 \sqrt{f(x)}} (f_n(x) - \mathbf{E}f_n(x)) \quad \text{and} \quad \hat{D}_n(x) = \frac{\sqrt{na_n^d}}{\|K\|_2 \sqrt{f(x)}} (f_n(x) - f(x)).$$
Then, Theorems 1 and 2 hold with $s = 1$. Theorems 1 and 2 provide moderate deviations for the expressions $D_n$ and $\hat{D}_n$, which are related through the expression of $f_n$'s bias; see Remark 2. Remarks 1 and 2 provide a detailed description of the calculation of the bias essential here.

**3. Proof of Theorem 1**

For $n \ge 1$, let $\{Y_i, 1 \le i \le n\}$ be i.i.d. and centered random variables. Denote $\sigma^2 = \mathbf{E}Y_1^2$ and $T_n = \sum_{i=1}^n Y_i$. Assume that $\sigma > 0$. Fan et al. [12] (see also Cramér [6]) established the following asymptotic expansion on the tail probabilities of moderate deviations for $T_n$.

**Lemma 1.** Assume that there exists a constant $\alpha_n$ such that for all $1 \le i \le n$,

$$ \mathbf{E}|Y_i|^k \le \frac{1}{2}k! \left(\frac{1}{\alpha_n}\right)^{k-2} \mathbf{E}Y_i^2, \quad k \ge 2. \quad (5) $$

Then,

$$ \ln \frac{\mathbf{P}(T_n \ge t\sigma\sqrt{n})}{1 - \Phi(t)} = O\left(\frac{1+t^3}{\sqrt{n}\alpha_n}\right) \quad \text{as } n \to \infty \quad (6) $$

holds uniformly for $0 \le t = o(\sqrt{n}\alpha_n)$.

**Proof.** Lemma 1 is a simple consequence of Fan et al. [12]. □

With the preliminary lemma above, we are in the position to begin the proof of Theorem 1. It is easy to see that

$$ \sqrt{n a_n^d} (f_n(x) - \mathbf{E}f_n(x)) = \frac{1}{\sqrt{n a_n^d}} \sum_{k=1}^{n} \left[ K\left(\frac{x - X_i}{a_n}\right) - \mathbf{E}K\left(\frac{x - X_i}{a_n}\right) \right]. \quad (7) $$

In the sequel, we give an estimate for the right-hand side of the last equality. Notice that

$$ \frac{1}{\sqrt{n a_n^d}} \sum_{k=1}^{n} \left[ K\left(\frac{x - X_i}{a_n}\right) - \mathbf{E}K\left(\frac{x - X_i}{a_n}\right) \right] = \frac{1}{\sqrt{n}} \sum_{k=1}^{n} \frac{1}{\sqrt{a_n^d}} \left[ K\left(\frac{x - X_i}{a_n}\right) - \mathbf{E}K\left(\frac{x - X_i}{a_n}\right) \right]. \quad (8) $$

Denote

$$ Y_i = \frac{1}{\sqrt{a_n^d}} \left[ K\left(\frac{x - X_i}{a_n}\right) - \mathbf{E}K\left(\frac{x - X_i}{a_n}\right) \right], \quad 1 \le i \le n. $$

We can prove that $Y_i$ satisfies the Bernstein condition Equation (5). Indeed, we can deduce that for all $k \ge 2$,

$$ \begin{aligned} \mathbf{E}|Y_i|^k &\le \left(\frac{1}{\sqrt{a_n^d}}\right)^k \mathbf{E}\left|K\left(\frac{x - X_i}{a_n}\right) - \mathbf{E}K\left(\frac{x - X_i}{a_n}\right)\right|^k \\ &\le \left(\frac{1}{\sqrt{a_n^d}}\right)^k \|K\|_{\infty}^{k-2} \mathbf{E}\left|K\left(\frac{x - X_i}{a_n}\right) - \mathbf{E}K\left(\frac{x - X_i}{a_n}\right)\right|^2 \\ &\le \left(\frac{\|K\|_{\infty}}{\sqrt{a_n^d}}\right)^{k-2} \mathbf{E}|Y_i|^2 \\ &\le \frac{1}{2} k! \left(\frac{\|K\|_{\infty}}{\sqrt{a_n^d}}\right)^{k-2} \mathbf{E}|Y_i|^2. \end{aligned} $$
For the variance of $Y_i$, we have the following estimation:

$$ 
\begin{aligned}
\mathrm{Var}(Y_i) &= \frac{1}{a_n^d} \mathrm{Var}\left(K\left(\frac{x-X_i}{a_n}\right)\right) \\
&= \frac{1}{a_n^d} \left( \mathrm{EK}^2\left(\frac{x-X_i}{a_n}\right) - \left[\mathrm{EK}\left(\frac{x-X_i}{a_n}\right)\right]^2 \right).
\end{aligned}
$$

It is easy to see that

$$ 
\begin{aligned}
\mathrm{EK}^2\left(\frac{x-X_i}{a_n}\right) &= a_n^d \left[ \int_{z \in \mathbb{R}^d} K^2(z) f(x - za_n) dz \right] \\
&= a_n^d \left[ \int_{z \in \mathbb{R}^d} K^2(z) f(x) dz + \int_{z \in \mathbb{R}^d} K^2(z) (f(x - za_n) - f(x)) dz \right].
\end{aligned}
$$

By Assumption (B), it is easy to see that

$$ 
\begin{aligned}
& \left| f(x - za_n) - f(x) - \sum_{t=1}^{s} \frac{1}{t!} (z \cdot \nabla)^t f(x) a_n^t \right| \\
&= \left| \frac{1}{s!} \left( (z \cdot \nabla)^s f(x + \theta za_n) - (z \cdot \nabla)^s f(x) \right) a_n^s \right| \\
&\le C_d A a_n^{s+\beta} \|z\|_2^{s+\beta},
\end{aligned}
\quad (9) $$

where $|\theta| \le 1$ and $A$ is given by Assumption (B). Again by Condition (C), we can deduce that

$$ 
\begin{aligned}
\mathrm{EK}^2\left(\frac{x-X_i}{a_n}\right) &= a_n^d \left[ \int_{z \in \mathbb{R}^d} K^2(z) f(x) dz + \int_{z \in \mathbb{R}^d} K^2(z) (f(x - za_n) - f(x)) dz \right] \\
&= a_n^d f(x) \int_{z \in \mathbb{R}^d} K^2(z) dz + \sum_{t=1}^s \frac{1}{t!} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz a_n^{d+t} \\
&\quad + O(1) a_n^{d+s+\beta} \int_{z \in \mathbb{R}^d} K^2(z) \|z\|_2^{s+\beta} dz \\
&= a_n^d f(x) \int_{z \in \mathbb{R}^d} K^2(z) dz + \sum_{t=1}^s a_n^{d+t} \frac{1}{t!} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz \\
&\quad + O(a_n^{d+s+\beta}).
\end{aligned}
\quad (10) $$

By Condition (B), it is easy to see that

$$ 
\begin{aligned}
\mathrm{EK}\left(\frac{x-X_i}{a_n}\right) &= a_n^d \left[ \int_{z \in \mathbb{R}^d} K(z) f(x) dz + \int_{z \in \mathbb{R}^d} K(z) [f(x - za_n) - f(x)] dz \right] \\
&= a_n^d f(x) \int_{z \in \mathbb{R}^d} K(z) dz + o(a_n^d) \\
&= a_n^d f(x) + o(a_n^d).
\end{aligned}
\quad (11) $$

From Equations (10) and (11), we have

$$ 
\begin{aligned}
\mathrm{Var}(Y_i) &= \frac{1}{a_n^d} \left( a_n^d f(x) \int_{z \in \mathbb{R}^d} K^2(z) dz + \sum_{t=1}^s a_n^{d+t} \frac{1}{t!} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz \right. \\
&\quad \left. + O(a_n^{d+s+\beta}) - \left(a_n^d f(x) + o(a_n^d)\right)^2 \right) \\
&= f(x) \int_{z \in \mathbb{R}^d} K^2(z) dz + \sum_{t=1}^s a_n^t \frac{1}{t!} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz + O(a_n^{(s+\beta)\wedge d}).
\end{aligned}
$$
When $f(x) > 0$, we obtain

$$ \gamma_n := \frac{\|K\|_{\infty} / \sqrt{a_n^d}}{\sqrt{n \mathrm{Var}(Y_1)}} = O\left(\frac{1}{\sqrt{na_n^d}}\right) $$

and

$$ \frac{\mathrm{Var}(Y_i)}{f(x) \|K\|_2^2 + \sum_{t=1}^s a_n^t \frac{1}{t!} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz} = 1 + O(a_n^{(s+\beta)^\wedge d}). \quad (12) $$

Therefore, by Lemma 1, we can deduce that for all $0 \le t = o(\sqrt{na_n^d})$

$$ \begin{aligned} \mathbf{P}\left(\sqrt{na_n^d}\left(f_n(x) - \mathbf{E}f_n(x)\right) \ge t \sqrt{\mathrm{Var}(Y_1)}\right) &= \mathbf{P}\left(\frac{1}{\sqrt{n\mathrm{Var}(Y_1)}} \sum_{k=1}^n Y_i \ge t\right) \\ &= (1 - \Phi(t)) \exp\left\{O(1) \frac{1+t^3}{\sqrt{na_n^d}}\right\}. \end{aligned} $$

Applying inequality Equation (12) to the last inequality, we deduce that for all $0 \le t = o(\sqrt{na_n^d})$

$$ \begin{aligned} & \mathbf{P}(D_n(x) \ge t) \\ &= \mathbf{P}\left(\sqrt{na_n^d}\left(f_n(x) - \mathbf{E}f_n(x)\right) \ge t \sqrt{f(x)\|K\|_2^2 + \sum_{t=1}^s a_n^t \frac{1}{t!} \int_{z \in \mathbb{R}^d} (z \cdot \nabla)^t f(x) K^2(z) dz}\right) \\ &= \mathbf{P}\left(\sqrt{na_n^d}\left(f_n(x) - \mathbf{E}f_n(x)\right) \ge t \sqrt{\mathrm{Var}(Y_1)} \sqrt{1 + O(a_n^{(s+\beta)^\wedge d})}\right) \\ &= \left(1 - \Phi(t(1 + O(a_n^{(s+\beta)^\wedge d})))\right) \exp\left\{O(1) \frac{1+t^3}{\sqrt{na_n^d}}\right\}. \end{aligned} $$

Because of

$$ \frac{1}{1+\lambda} e^{-\lambda^2/2} \le \sqrt{2\pi}(1-\Phi(\lambda)), \quad \lambda \ge 0, $$

it is easy to see that for all $0 \le \lambda \le x$,

$$ \begin{aligned} 1 \le \frac{\int_{\lambda}^{\infty} \exp\{-t^2/2\} dt}{\int_{x}^{\infty} \exp\{-t^2/2\} dt} &\le 1 + \frac{\int_{\lambda}^{x} \exp\{-t^2/2\} dt}{\int_{x}^{\infty} \exp\{-t^2/2\} dt} \\ &\le 1 + c_1 x (x - \lambda) \exp\{(x^2 - \lambda^2)/2\} \\ &\le \exp\{c_2 x |x - \lambda|\}. \end{aligned} $$

Hence, we obtain for any $\lambda, x \ge 0$,

$$ 1 - \Phi(\lambda) = (1 - \Phi(x)) \exp\left\{O(1)(x + \lambda)|x - \lambda|\right\}. $$

By the last equality, it follows that

$$ 1 - \Phi(x(1 + O(a_n^{(s+\beta)^\wedge d}))) = (1 - \Phi(x)) \exp\left\{O(1)x^2 a_n^{(s+\beta)^\wedge d}\right\}. $$
Therefore, we have, for all $0 \le t = o(\sqrt{na_n^d})$,

$$ \mathbf{P}(D_n(x) \ge t) = (1 - \Phi(t)) \exp \left\{ O(1) \left( \frac{1+t^3}{\sqrt{na_n^d}} + t^2 a_n^{(s+\beta)\wedge d} \right) \right\}. \quad (13) $$

This completes the proof of Theorem 1.

### 4. Proof of Theorem 2

It is easy to see that

$$ \begin{aligned} \mathbf{E}f_n(x) - f(x) &= \frac{1}{na_n^d} \sum_{k=1}^n \int_{x \in \mathbb{R}^d} K\left(\frac{x-t}{a_n}\right) f(t) dt - f(x) \\ &= \int_{x \in \mathbb{R}^d} K(z) f(x - a_n z) dz - f(x) \\ &= \int_{x \in \mathbb{R}^d} K(z) [f(x - a_n z) - f(x)] dz. \end{aligned} $$

By inequality Equation (9), we deduce that

$$ \begin{aligned} \mathbf{E}f_n(x) - f(x) &= \sum_{t=1}^{s} \frac{1}{t!} \int_{x \in \mathbb{R}^d} K(z)(z \cdot \nabla)^t f(x) dz a_n^t \\ &\quad + C_d A \int_{x \in \mathbb{R}^d} K(z) \|z\|_2^{s+\beta} dz a_n^{s+\beta} \\ &= \sum_{t=1}^{s} \frac{1}{t!} \int_{x \in \mathbb{R}^d} K(z)(z \cdot \nabla)^t f(x) dz a_n^t + O(a_n^{s+\beta}). \end{aligned} $$

Applying the last line to Equation (13), we obtain, for all $0 \le t = o(\sqrt{na_n^d})$,

$$ \begin{aligned} \mathbf{P}(\hat{D}_n(x) \ge t) &= \mathbf{P}\left(D_n(x) \ge t - \frac{\sqrt{na_n^d} O(a_n^{s+\beta})}{\|K\|_2 \sqrt{f(x)}}\right) \\ &= (1 - \Phi(t)) \exp \left\{ O(1) \left( \frac{1+t^3}{\sqrt{na_n^d}} + t^2 a_n^{(s+\beta)\wedge d} + (1+t) \sqrt{na_n^{s+\beta+d/2}} \right) \right\}. \end{aligned} $$

This completes the proof of Theorem 2.

**Author Contributions:** Writing—original draft preparation, X.F., P.D., S.L. and H.H.; supervision, X.F.; funding acquisition, S.L. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was also funded in the frame of the chair FIME: https://fime-lab.org/ and CY-AS ("Investissements d'Avenir" ANR-16-IDEX-0008), "EcoDep" PSI-AAP2020-0000000013.

**Data Availability Statement:** Data sharing is not applicable to this article as no new data were created or analyzed in this study.

**Acknowledgments:** The authors would like to thank the anonymous referees for their valuable comments and remarks.

**Conflicts of Interest:** The authors declare no conflicts of interest.

### References

1. Rosenblatt, R. Stochastic Curve Estimation; NSF-CBMS Regional Conference Series in Probability and Statistics; Institute of Mathematical Statistics: Waite Hill, OH, USA, 1991; Volume 3.

2. Ciret, T.; Damien, P.; Ciutat, A.; Durrieu, G.; Massabuau, J.-C. Estimation of potential and limits of bivalve closure response to detect contaminants: Application to cadmium. Environ. Toxicol. Chem. **2003**, 22, 914–920.

3. de la Peña, V.H.; Lai, T.L.; Shao Q.M. Self-Normalized Processes: Limit Theory and Statistical Applications (Probability and Its Applications); Springer: Berlin/Heidelberg, Germany, 2009.

4. Joutard, C. Sharp large deviations in nonparametric estimation. J. Nonparam. Stat. **2006**, 18, 293–306. [CrossRef]
5. Gao, F. Moderate deviations and large deviations for kernel density estimators. *J. Theoret. Probab.* **2003**, *16*, 401–418. [CrossRef]

6. Cramér, H. Sur un nouveau théorème-limite de la théorie des probabilités. *Actual. Sci. Indust.* **1938**, *736*, 5–23.

7. Petrov, V.V. *Sums of Independent Random Variables*; Springer: Berlin/Heidelberg, Germany, 1975.

8. Beknazaryan, A.; Sang, H.; Xiao, Y. Cramér type moderate deviations for random fields. *J. Appl. Probab.* **2019**, *56*, 223–245. [CrossRef]

9. Fan, X.; Hu, H.; Xu, L. Cramér-type moderate deviations for Euler-Maruyama scheme for SDE. *Sci. China Math.* **2024**, *67*, 1865–1880. [CrossRef]

10. Doukhan, P. *Stochastic Models for Time Series*; Series Mathématiques et Applications; Springer: Berlin/Heidelberg, Germany, 2018; Volume 80.

11. El Machkouri, M.; Fan, X.; Reding, L. On the Nadaraya-Watson kernel regression estimator for irregularly spaced spatial data. *J. Statist. Plann. Infer.* **2020**, *205*, 92–114. [CrossRef]

12. Fan, X.; Grama, I.; Liu, Q. Cramér large deviation expansions for martingales under Bernstein's condition. *Stoch. Process. Appl.* **2013**, *123*, 3919–3942. [CrossRef]

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.