%~Mouliné par MaN_auto v.0.35.3 (13ef1c44) 2025-08-29 15:22:03
\documentclass[CRMATH,Unicode,XML,biblatex]{cedram}

\TopicFR{Statistiques}
\TopicEN{Statistics}

\addbibresource{CRMATH_Nkiet_20240667.bib}

\usepackage{mathrsfs}
\usepackage{dsfont}
\usepackage{mathtools}

\newcommand*{\dd}{\mathrm{d}}

%%%---------------------------------------------------------------------------

%%% ARROWS

%%% Implications
\newcommand*{\myimplies}{\ensuremath{\mathchoice{\Longrightarrow}{\ \Rightarrow \ }{\Rightarrow}{\Rightarrow}}}
%\newcommand*{\myequiv}{\ensuremath{\mathchoice{\Longleftrightarrow}{\ \Leftrightarrow \ }{\Leftrightarrow}{\Leftrightarrow}}}

%%%---------------------------------------------------------------------------

%%% DELIMITERS

%\usepackage{mathtools}
\DeclarePairedDelimiter{\parens}{\lparen}{\rparen}
\DeclarePairedDelimiter{\braces}{\{}{\}}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiter{\bracks}{[}{]}

%%%---------------------------------------------------------------------------

%%% VERTICAL BAR

%%% Conditional probability
\newcommand*{\cond}[1][]{\,#1\vert\,}

%%%---------------------------------------------------------------------------

\graphicspath{{./figures/}}

\newcommand*{\mk}{\mkern -1mu}
\newcommand*{\Mk}{\mkern -2mu}
\newcommand*{\mK}{\mkern 1mu}
\newcommand*{\MK}{\mkern 2mu}

\hypersetup{urlcolor=purple, linkcolor=blue, citecolor=red}

\newcommand*{\relabel}{\renewcommand{\labelenumi}{(\theenumi)}}
\newcommand*{\romanenumi}{\renewcommand*{\theenumi}{\roman{enumi}}\relabel}
\newcommand*{\Romanenumi}{\renewcommand*{\theenumi}{\Roman{enumi}}\relabel}
\newcommand*{\alphenumi}{\renewcommand*{\theenumi}{\alph{enumi}}\relabel}
\newcommand*{\Alphenumi}{\renewcommand*{\theenumi}{\Alph{enumi}}\relabel}
\let\oldhat\hat
\renewcommand*{\hat}[1]{\mathchoice{\widehat{#1}}{\widehat{#1}}{\oldhat{#1}}{\oldhat{#1}}}
\let\oldforall\forall
\renewcommand*{\forall}{\mathrel{\oldforall}}

%%%---------------------------------------------------------------------------

\makeatletter
\def\@setafterauthor{%
  \vglue3mm%
\begingroup\hsize=12cm\advance\hsize\abstractmarginL\raggedright
\noindent
   \leftskip\abstractmarginL
  \normalfont\Small
  \@afterauthor\par
\endgroup
\vskip2pt plus 3pt minus 1pt
}
\makeatother

%%%---------------------------------------------------------------------------

\title{Rates of strong uniform consistency for the $k$-nearest neighbors kernel estimators of density and regression function}
\alttitle{Vitesses de convergence uniforme presque s\^ure pour les estimateurs de la densit\'e et la fonction de r\'egression par la m\'ethode des $k$ plus proches voisins \`a noyau }

\author{\firstname{Luran} \lastname{Bengono Mintogo}}
\address{Laboratoire de Probabilit\'es, Statistique et Informatique, Unit\'e de Recherche en Math\'ematiques et Informatique, Universit\'e des Sciences et Techniques de Masuku, BP 813 Franceville, Gabon}
\email{luranbengono@gmail.com}

\author{\firstname{Emmanuel de Dieu} \lastname{Nkou}}
\address[1]{Laboratoire de Probabilit\'es, Statistique et Informatique, Unit\'e de Recherche en Math\'ematiques et Informatique, Universit\'e des Sciences et Techniques de Masuku, BP 813 Franceville, Gabon}
\email{emmanueldedieunkou@gmail.com}

\author{\firstname{Guy Martial} \lastname{Nkiet}}
\address[1]{Laboratoire de Probabilit\'es, Statistique et Informatique, Unit\'e de Recherche en Math\'ematiques et Informatique, Universit\'e des Sciences et Techniques de Masuku, BP 813 Franceville, Gabon}
\email{guymartial.nkiet@univ-masuku.org}

\subjclass{62G05, 62G07, 62G08}

\keywords{\kwd{$k$-nearest neighbors} \kwd{kernel estimators} \kwd{density} \kwd{regression function} \kwd{strong uniform consistency} \kwd{rates of convergence}}
\altkeywords{\kwd{$k$ plus proches voisins} \kwd{estimateurs \`a noyau} \kwd{densit\'e} \kwd{fonction de r\'egression} \kwd{convergence uniforme presque s\^ure} \kwd{vitesse de convergence}}

\begin{abstract}
We address the problem of consistency of the $k$-nearest neighbors kernel estimators of the density and the regression function in the multivariate case. We get the rates of strong uniform consistency on the whole space $\mathbb{R}^p$ for these estimators under specified assumptions.
\end{abstract}

\begin{altabstract}
Cet article aborde le probl\`eme de la convergence des estimateurs de la densit\'e et de la fonction de r\'egression par la m\'ethode des $k$ plus proches voisins, dans le cas multivari\'e. Nous d\'eterminons les vitesses de convergence uniforme presque s\^ure sur tout l'espace $\mathbb{R}^p$, sous des conditions sp\'ecifi\'ees.
\end{altabstract}

\begin{document}

\maketitle

\section{Introduction}

Estimation of the density and the regression function are important and classical issues in nonparametric statistics which have been intensively addressed since many years, so leading to an abundant literature. Without a doubt, the most popular estimators that have been tackled in this context are the kernel estimators, namely the Parzen--Rosenblatt estimator of the density and the Nadaraya--Watson estimator of the regression function. However, the practical choice of the bandwidth on which these estimators rely is not straightforward and still a challenging issue. This is why alternative estimators, which do not require to make such a choice, have been proposed. Among them, the $k$-nearest neighbors ($k$-NN) kernel estimators have attracted particular attention. They have the same form than the kernel estimators, but with bandwidth replaced by the Euclidean distance between the point to which the estimator is calculated and the $k$-th nearest neighbor of this point among the observations. Earlier works on this topic go back to~\cite{moore77} for density estimation and to~\cite{collomb80} for the case of regression function. These papers established the strong uniform consistency and the strong pointwise consistency, respectively, of the tackled estimators. After these works, some others studying various aspects related to the aforementioned estimators were introduced in the literature. For example, \cite{mack79} derived expressions describing the asymptotic behavior of the bias and variance of the $k$-NN density estimates, \cite{bhattacharya90} introduced an adaptative optimal choice of $k$ in multivariate $k$-NN density and regression estimation and~\cite{lu98} proved strong pointwise consistency for the $k$-NN estimators of the density and the regression function in the context of $\alpha$-mixing stationary sequences. The most recent works on the $k$-NN kernel estimators concern the case of functional data (e.g., \cite{attouch17,burba08,kudraszow13,lian11}), and that of spatial data (see~\cite{ahmed23}). In fact, these estimators belong to the family of variable bandwidth kernel estimators, where the bandwidth depends on the estimation point and the sample. The use of such adaptive bandwidths has been extensively explored in the literature, with numerous theoretical results, particularly concerning bias reduction (see, e.g., \cite{biau15}). In this vein, \cite{abramson82} considers the estimation of the density by proposing a kernel estimator of this function at $x=0$, where the bandwidth depends on the observations through a scalar function on $\mathbb{R}^{p}$ which is not explicitly assigned, and using the mean squared error (MSE) at $0$ as an optimality criterion. \cite{terrel92} proposed a density estimation methodology based on kernels with variable bandwidth, emphasizing the importance of local adaptation to improve estimator accuracy. \cite{jones90} distinguished two types of variable-bandwidth kernel estimators: those where the bandwidth varies for each data point and those where the bandwidth depends only on the estimation point. The estimators that we tackle combine several key ideas of previous works: local adaptation of the bandwidth as in~\cite{abramson82}, the distinction between different forms of bandwidth variation as in~\cite{jones90}.

Curiously, there is almost no work devoted to determining the convergence rates of the aforementioned $k$-NN kernel estimators in both the univariate and the multivariate cases. However, \cite{zhang90} derived rates of strong uniform convergence, on any compact subset of $\mathbb{R}$, of the $k$-NN kernel density estimator, but only in the univariate case. To the best of our knowledge, there is no work dealing with derivation of such rates for the $k$-NN kernel estimator of the regression function either in the univariate case or in the multivariate case.

In this paper, we address the problem of determining rates of strong uniform consistency for the $k$-NN kernel estimators of multivariate density and regression function. In Section~\ref{knnest}, we define the estimators that will be tackled. For the density, it is the usual $k$-NN kernel estimator but for the regression function, we slightly modify the classical one as it was done in~\cite{zhu96}. Section~\ref{results} presents the used assumptions and gives the main results. The proofs of the theorems are postponed in Section~\ref{preuves}.

\section{The \texorpdfstring{$k$}{k}-NN kernel estimators}\label{knnest}

For $n\in\mathbb{N}^\ast$, let $\braces[\big]{(X_i,Y_i)}_{1\leqslant i\leqslant n}$ be an i.i.d.\ sample of a pair $(X,Y)$ of random variables valued into $\mathbb{R}^p\times\mathbb{R}$, with $p\geqslant 1$. We denote by $f$ the density of $X$ and, assuming that $\mathbb{E}\parens[\big]{\abs{ Y}}<+\infty$, we consider the regression function $r$ defined as
\[
r(x)=\mathbb{E}\parens[\big]{Y \cond[\big] X=x}, \quad x\in\mathbb{R}^p.
\]
For estimating $f$, the $k$-NN kernel density estimator $\widehat{f}_n$ was introduced (see, e.g., \cite{moore77}); it is defined as
\[
\widehat{f}_{n}(x)=\frac{1}{n\parens[\big]{R_{n}(x)}^{p}}\sum_{i=1}^{n}K\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}, \quad x\in \mathbb{R}^{p},
\]
where $K \colon \mathbb{R}^p\to\mathbb{R}$ is a multivariate kernel, and
\[
R_{n}(x)=\min\braces[\bigg]{h\in\mathbb{R}_{+}^{*} \, \bigg{/} \, \sum_{i=1}^{n}\mathds{1}_{\mathcal{B}(x,h)}(X_{i})=k_{n}}
\]
with $\mathcal{B}(x,h)=\braces[\big]{t\in\mathbb{R}^p\,\big{/}\,\norm{ t-x}<h}$, $\norm{\,\cdot\,}$ denoting the Euclidean norm of $\mathbb{R}^p$. In what precedes, $(k_n)_{n\in\mathbb{N}^\ast}$ is a sequence of integers such that $k_n\to +\infty$ as $n\to +\infty$. Note that the main difference between this estimator and the usual Parzen--Rosenblatt kernel density estimator is that the bandwidth $R_n(x)$ is random and depends on the $X_i$'s. This estimator is also used for determining an estimator of the regression function $r$. Indeed, assuming that $f(x)>0$, one can easily see that
\begin{equation}\label{r}
r(x)=\frac{g(x)}{f(x)},
\end{equation}
where
\[
g(x)=\int_\mathbb{R} yf_{(X,Y)}(x,y) \, \dd y,
\]
the function $f_{(X,Y)}$ being the density of $(X,Y)$. Considering the $k$-NN kernel estimator $\widehat{g}_n$ of $g$ defined as
\begin{equation}\label{gn}
\widehat{g}_{n}(x)=\frac{1}{n\parens[\big]{R_{n}(x)}^{p}}\sum_{i=1}^{n}Y_iK\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}, \quad x\in \mathbb{R}^{p},
\end{equation}
it is seen that by replacing in~\eqref{r} $g$ and $f$ by $\widehat{g}_{n}$ and $\widehat{f}_{n}$ respectively, we obtain an estimator of $r$ which just is the one introduced in~\cite{collomb80}. We will modify this estimator as done in~\cite{zhu96}, and repeated in~\cite{nkou19}. Specifically, considering a sequence $(b_n)_{n\in\mathbb{N}^\ast}$ of positive real numbers converging to $0$ as $n\to +\infty$, we define
\[
\widehat{f}_{b_n}(x)=\max\parens[\big]{\widehat{f}_n(x),b_n},
\]
and consider the estimator $\widehat{r}_n$ of $r$ given by:
\[
\widehat{r}_{n}(x)=\frac{\widehat{g}_n(x)}{\widehat{f}_{b_n}(x)}.
\]

\section{Rates of uniform consistency}\label{results}

In this section, we present our assumptions, then we give the main results that establish rates of strong uniform consistency for the estimators of the density and the regression function.

\subsection{Assumptions}

\begin{enonce}[remark]{Assumption}\label{dens}
The density $f$ of $X$ is bounded and bounded from below: there exists $c_0>0$ such that $\inf_{x\in\mathbb{R}^p}f(x)\geqslant c_0$.
\end{enonce}

\begin{enonce}[remark]{Assumption}\label{lip}
For a given $r\in\mathbb{N}^\ast$, the density $f$ belongs to the class $\mathscr{C}(c,r)$ of functions \mbox{$\phi \colon \mathbb{R}^p\to\mathbb{R}$} that are $r$ times differentiable and have $r$-th derivatives $\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}}$, with $(i_1,\dotsc,i_r)\in \{1,\dotsc,p\}^r$, satisfying the following Lipschitz condition:
\[
\abs[\Bigg]{\frac{\partial^r\phi}{\partial x_{i_1} \dotsm \partial x_{i_r}}(x)-\frac{\partial^r\phi}{\partial x_{i_1} \dotsm \partial x_{i_r}}(y)}\leqslant c\Vert x-y\Vert,
\]
where $\norm{\,\cdot\,}$ denotes the Euclidean norm of $\mathbb{R}^p$.
\end{enonce}

\begin{enonce}[remark]{Assumption}\label{reg}
The functions $g_1$ and $g_2$ defined as $g_1(x)=\mathbb{E}\parens[\big]{Y \mathds{1}_{\{ Y \geqslant 0 \}} \cond[\big] X = x } f(x)$ and $g_2(x)=\mathbb{E}\parens[\big]{- Y \mathds{1}_{\{ Y< 0 \}} \cond[\big] X = x } f(x)$ are bounded and belong to the class $\mathscr{C}(c,r)$ previously defined.
\end{enonce}

\begin{enonce}[remark]{Assumption}\label{kernel}
The kernel $K \colon \mathbb{R}^p\to\mathbb{R}$ satisfies the following properties.
\begin{enumerate}\romanenumi
\item \label{kernel_i} $K$ is bounded, that is $G=\sup_{x\in\mathbb{R}^p}\abs[\big]{K(x)}<+\infty$.
\item $K$ is symmetric with respect to 0, that is $K(x)=K(-x)$, $\forall x\in\mathbb{R}^{p}$.
\item $\int_{\mathbb{R}^p}K(x) \, \dd x_1 \dotsm \dd x_p=1$.
\item \label{kernel_iv} $K$ is of order $r$, that is
\[
\int_{\mathbb{R}^p}x_{i_1} \dotsm x_{i_\ell}K(x) \, \dd x_1 \dotsm \dd x_p=0
\]
for any $\ell\in\{1,\dotsc,r\}$ and $(i_1,\dotsc,i_\ell)\in \{1,\dotsc,p\}^\ell$.
\item \label{kernel_v}
\[
\int_{\mathbb{R}^{p}}\norm{x}^{r+1}\abs[\big]{K(x)} \, \dd x_1 \dotsm \dd x_p<+\infty.
\]
\item \label{kernel_vi} $\forall x\in\mathbb{R}^{p}$, $\forall a\in[0,1]$, $K(ax)\geqslant K(x)$.
\end{enumerate}
\end{enonce}

\begin{enonce}[remark]{Assumption}\label{kn}
The number $k_{n}$ of neighbors is a sequence of positive integers such that: $k_{n}\sim\lfloor n^{c_{1}}\rfloor$, where $c_{1}\in\mathopen{\big]}\frac{1}{2},1\mathclose{\big[}$ and $\lfloor a\rfloor$ denotes the integer part of $a$.
\end{enonce}

\begin{enonce}[remark]{Assumption}\label{bn}
The sequence $(b_n)_{n\in\mathbb{N}^\ast}$ satisfies $b_{n}\sim n^{-c_{2}}$ with $c_{2}\in\mathopen{\big]}0,\frac{1}{10}\mathclose{\big[}$.
\end{enonce}

\begin{enonce}[remark]{Assumption}\label{mn}
There exists a sequence $M_{n}$ of strictly positive numbers such that $M_{n}\sim\sqrt{\log(n)}$ and $\max_{1\leqslant i\leqslant n}\abs{ Y_{i}}\leq M_{n}$.
\end{enonce}

Assumption~\ref{dens} has been made several times in the nonparametric statistics literature. For example, it was made in~\cite{zhu07}. Assumptions~\ref{lip} and~\ref{reg} are classical ones; one can find them in~\cite{zhu96,zhu07,nkou19} for the univariate case. Assumption~\ref{kernel}\eqref{kernel_iv} just is the translation to the multivariate case of the fact that the kernel $K$ is of order $r \in\mathbb{N}^\ast$. It is useful in Taylor's expansion used for deriving the consistency rates. Assumption~\ref{kernel}\eqref{kernel_vi} was made in several works on $k$-NN kernel estimators (e.g., \cite{collomb80,ahmed23}); it is satisfied, for instance, by the Gaussian kernel. Assumption~\ref{mn} is weaker than boundness assumption; for instance, it has been considered in~\cite{nkou23}.

\subsection{Main results}

Now, we give the main results of the paper, that is rates of strong uniform consistency of the estimators introduced in Section~\ref{knnest}. First, for the $k$-NN kernel density estimator, we have the following.

\begin{theo}\label{theo_dens}
Under Assumptions~\ref{dens}, \ref{lip}, \ref{kernel} and~\ref{kn}, we have:
\[
\sup_{x \in \mathbb{R}^p}\abs[\big]{\widehat{f}_{n}(x)-f(x)} = O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)}{k_{n}^{2}}}}.
\]
\end{theo}

\begin{remark}
Rates of strong uniform consistency for this estimator were already obtained in~\cite{zhang90}, but it was in the univariate case and on any compact subset of $\mathbb{R}$, which is a more restricted framework than ours. In addition, the strong assumption that the kernel has bounded variation on $\mathbb{R}$ was required. The obtained rate involves the term $\log\parens[\big]{\log (n)}$, whereas the rate we obtain just involves $\log (n)$. This difference is due to the different approaches used for obtaining these rates and, therefore, it is due to distinct assumptions. Lemma~1 of~\cite{zhang90}, which gives the aforementioned rate, relies on a result from~\cite{chung49}, which in turn is derived from Kolmogorov's methods. In the opposite, our Theorem~\ref{theo_dens} relies on an exponential inequality of Talagrand type, which highlights $\log (n)$ instead of $\log\parens[\big]{\log (n)}$.
\end{remark}

In order to get the rate for the $k$-NN kernel estimator of the regression function, we first need to deal with the case of the estimator $\widehat{g}_n$ given in~\eqref{gn}. We have the following.

\begin{theo}\label{reg1}
Under Assumptions~\ref{dens}, \ref{reg}, \ref{kernel}, \ref{kn} and~\ref{mn}, we have:
\[
\sup_{x \in \mathbb{R}^p}\abs[\big]{\widehat{g}_{n}(x)-g(x)} =O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)M_{n}^{2}}{k_{n}^{2}}}}.
\]
\end{theo}

From this result, we obtain as a consequence the following theorem which gives the rate of strong uniform consistency of the $k$-NN kernel estimator of the regression function.

\begin{theo}\label{reg2}
Under Assumptions~\ref{dens} to~\ref{mn}, we have:
\[
\sup_{x \in \mathbb{R}^p}\abs[\big]{\widehat{r}_{n}(x)-r(x)} =O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)M_{n}^{2}}{k_{n}^{2}}}+b_n}.
\]
\end{theo}

\begin{remark}
The term $b_n$ that appears in the above rate is not always negligible compared to the other terms when considering the sequence $(k_n)_n$ that optimizes the rate. Indeed, if  $k_n^\star$ denotes the optimal choice of $k_n$, that is the value $k_n$ that minimizes the rate, it follows from straightforward calculations that
\[
k_n^\star=\parens[\Bigg]{\parens[\Bigg]{\frac{p}{r+1}}n^{\frac{r+1}{p}+\frac{1}{2}}(\log n)^{\frac{1}{2}}M_{n}}^{\frac{1}{\frac{r+1}{p}+1}}.
\]
The term $b_{n}$ is negligible compared to other terms if $b_{n}=o(T_{1,n})$ and $ b_{n}=o(T_{2,n})$, where
\[
T_{1,n}=n^{-\frac{r+1}{p}}(k_n^\star)^{\frac{r+1}{p}} =\parens[\Bigg]{\frac{p}{r+1}}^{\frac{r+1}{r+1+p}}n^{-\frac{r+1}{2(r+1+p)}}\parens[\big]{(\log n)^{\frac{1}{2}}M_{n}}^{\frac{r+1}{r+1+p}}
\]
and
\[
T_{2,n}=n^{\frac{1}{2}}(k_n^\star)^{-1}(\log n)^{\frac{1}{2}}M_{n}=\parens[\Bigg]{\frac{p}{r+1}}^{-\frac{p}{r+1+p}}n^{-\frac{r+1}{2(r+1+p)}}(\log n)^{\frac{r+1}{2(r+1+p)}}M_{n}^{\frac{r+1}{r+1+p}}.
\]
Since $b_{n}\sim n^{-c_{2}}$, it follows that we must have $n^{-c_{2}}=o(T_{1,n})$ and $n^{-c_{2}}=o(T_{2,n})$, that is
\begin{equation}\label{cond1}
n^{-c_{2}}=o\parens[\big]{n^{-\frac{r+1}{2(r+p+1)}}\parens{\log n^{\frac{p}{r+1}}}^{\frac{r+1}{r+1+p}}}
\end{equation}
and
\begin{equation}\label{cond2}
n^{-c_{2}}=o\parens[\Bigg]{\parens[\Bigg]{\frac{p}{r+1}}^{-\frac{p}{r+1+p}}n^{-\frac{r+1}{2(r+1+p)}}(\log n)^{\frac{r+1}{r+1+p}}}.
\end{equation}
Conditions~\eqref{cond1} and~\eqref{cond2} are satisfied if, and only if, $4r<p-4$. For instance, if the dimension $p$ is in $\{1,\dotsc,7\}$, then the latter condition cannot be satisfied and, therefore, $b_n$ is not negligible compared to the other terms.
\end{remark}

\section{Proofs of the theorems}\label{preuves}

In this section, we give the proofs of the main results of the paper. First, a result useful for proving the main theorems is established in Lemma~\ref{tech}. Then, the proofs of Theorems~\ref{theo_dens}, \ref{reg1} and~\ref{reg2} are given.

\subsection{A preliminary result}

Let $h \colon \mathbb{R}\to \mathbb{R}$ be a measurable function for which there exists a sequence $(\eta_n)_{n\in \mathbb{N}^\ast}$ such that $\abs{y}\leqslant M_n \myimplies \abs[\big]{h(y)}\leqslant \eta_n $, and $1\leqslant\eta_n\leqslant M_n$ for $n$ large enough. We put
\[
\widehat{\varphi}_n(x)=\frac{1}{n\mathscr{D}_{1,n}^{p}}\sum_{i=1}^{n}h(Y_{i})K\parens[\Bigg]{\frac{X_i-x}{\mathscr{D}_{2,n}}},
\]
where $(\mathscr{D}_{1,n})_{n\in \mathbb{N}^\ast}$ and $(\mathscr{D}_{2,n})_{n\in \mathbb{N}^\ast}$ are sequences satisfying
\begin{equation}\label{propdn}
\mathscr{D}_{1,n}^p\geqslant C_1n^{-1}k_n, \qquad \mathscr{D}_{2,n}^p\leqslant C_2n^{-1}k_n,
\end{equation}
for $n$ large enough and some $C_1>0$ and $C_2>0$, and
\begin{equation}\label{propdn2}
\abs*{\frac{\mathscr{D}_{2,n}^p}{\mathscr{D}_{1,n}^p}-1}\sim n^{-\frac{r+1}{p}}.
\end{equation}
Considering
\[
\varphi(x)=\int_\mathbb{R}h(y)f_{(X,Y)}(x,y) \, \dd y,
\]
where $f_{(X,Y)}$ is the density of the pair $(X,Y)$, we have the following.

\begin{lemm}\label{tech}
Under the conditions~\eqref{kernel_i} to~\eqref{kernel_v} of Assumption~\ref{kernel}, if $\varphi$ is bounded and belongs to the class $\mathscr{C}(c,r)$ defined in Assumption~\ref{dens}, we have:
\[
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{\varphi}_{n}(x)-\varphi(x)}=O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)\eta_n^2}{k_{n}^{2}}}}.
\]
\end{lemm}

\begin{proof}
It suffices to prove the two following properties:
\begin{equation}\label{alea}
\sup_{x\in \mathbb{R}^p}\abs[\Big]{\widehat{\varphi}_{n}(x)-\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x) }} =O_{a.s.}\parens*{\sqrt{\frac{n\log(n)\eta_n^2}{k_{n}^{2}}}}
\end{equation}
and
\begin{equation}\label{biais}
\sup_{x\in \mathbb{R}^p}\abs[\Big]{\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}-\varphi(x)}=O_{a.s.}\parens[\Bigg]{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}}.
\end{equation}

\begin{proof}[Proof of~\eqref{alea}]
From the class of functions
\[
\mathcal{G}_{n}=\braces[\Bigg]{\psi_{x} \colon (t,y)\in\mathbb{R}^p\times [-M_n,M_n]\mapsto\psi_{x}(t,y)=\frac{h(y)}{n\mathcal{D}_{1,n}^p}K\parens[\Bigg]{\frac{t-x}{\mathcal{D}_{2,n}}}, \ x\in \mathbb{R}^p},
\]
we use a similar reasoning than in the proof of~\cite[Theorem~3.1, p.~1299]{nkou19}. Since for any $\psi_x\in\mathcal{G}_{n}$, and for $n$ large enough,
\[
\abs[\big]{\psi_{x}(t,y)} \leqslant\frac{G\,\abs[\big]{h(y)}}{n\mathcal{D}_{1,n}^p}\leqslant \frac{G \eta_n}{C_1k_{n}},
\]
it follows
\[
\mathbb{E}\bracks[\Big]{\abs[\big]{\psi_{x}(X_{j},Y_j)}} \leqslant\frac{G \eta_n}{C_1k_{n}}\eqqcolon U_{n}, \qquad
\mathbb{E}\bracks[\big]{\psi_{x}^{2}(X_{j},Y_j)} \leqslant\frac{G ^2\eta_n^2}{C_1^2k_{n}^2}\eqqcolon \sigma_{n}^{2}.
\]
We can apply Talagrand's inequality (see~\cite{talagrand94} and~\cite[Proposition~2.2]{gine01}): there exist $A>0$, $K_{1}>0$ and $K_{2}>0$, such that for all $t$ satisfying
\[
t \geqslant K_{1}\bracks*{U_{n}\log\frac{AU_{n}}{\sigma_{n}}+\sqrt{n}\sigma_{n}\sqrt{\log\frac{AU_{n}}{\sigma_{n}}}}=K_{1}U_{n}\bracks[\Big]{\log(A)+\sqrt{n}\sqrt{\log(A)}},
\]
one has
\begin{multline*}
P\braces[\Bigg]{\sup_{\psi_{x}\in\mathcal{G}_{n}}\abs[\Bigg]{\sum_{i=1}^{n}\braces[\Big]{\psi_{x}(X_{i},Y_i)-\mathbb{E}\parens[\big]{\psi_{x}(X,Y)}}}> t}\\
\leqslant K_{2}\exp\braces[\Bigg]{-\frac{1}{K_{2}}\frac{t}{U_{n}}\log\parens[\Bigg]{1+\frac{tU_{n}}{K_{2}\parens[\Big]{\sqrt{n}\sigma_{n}+U_{n}\sqrt{\log\frac{AU_{n}}{\sigma_{n}}}}^{2}}}},
\end{multline*}
that is
\begin{equation}\label{tal}
\begin{split}
P\braces[\Bigg]{\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{\varphi}_{n}(x)-\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}}> t}
	& \leqslant K_{2}\exp\braces[\Bigg]{-\frac{1}{K_{2}}\frac{t}{U_{n}}\log\parens[\Bigg]{1+\frac{tU_{n}}{K_{2}\parens[\Big]{\sqrt{n}\sigma_{n}+U_{n}\sqrt{\log\frac{AU_{n}}{\sigma_{n}}}}^{2}}}}
\\	& = K_{2}\exp\braces[\Bigg]{-\frac{1}{K_{2}}\frac{C_1tk_{n}}{G\eta_n}\log\parens[\Bigg]{1+\frac{C_1tk_{n}}{nK_{2}G\eta_n\parens[\big]{1+\sqrt{\log(A)}}^2}}}.
\end{split}
\end{equation}
Let us put $t_{n}=C_3 n^{1/2}k_{n}^{-1} \log^{1/2}(n)\,\eta_n$ and $L=\frac{K_1G}{C_1}\sqrt{\log(A)}$, where
\begin{equation}\label{c1}
C_{3}> \frac{K_{2}G\parens[\big]{1+\sqrt{\log(A)}}}{C_1}.
\end{equation}
We have, for $n$ large enough,
\[
C_{3}\log^{1/2}(n)\geqslant 2L\geqslant L(1+1)\geqslant L\parens[\Bigg]{1+\sqrt{\frac{\log(A)}{n}}} = L\parens[\Bigg]{\frac{\sqrt{n}+\sqrt{\log(A)}}{\sqrt{n}}},
\]
which implies
\[
C_{3}\frac{n^{1/2}\log^{1/2}(n)\eta_n}{k_{n}}\geqslant\frac{K_{1}Gn^{1/2}\eta_n}{C_1k_{n}}\sqrt{\log(A)}\bracks*{\frac{\sqrt{n}+\sqrt{\log(A)}}{\sqrt{n}}},
\]
that is
\[
t_{n}\geqslant K_{1}U_{n}\bracks[\bigg]{\log(A)+\sqrt{n}\sqrt{\log(A)}}= K_{1}\bracks*{U_{n}\log\frac{AU_{n}}{\sigma_{n}}+\sqrt{n}\sigma_{n}\sqrt{\log\frac{AU_{n}}{\sigma_{n}}}}.
\]
Then, \eqref{tal} can be applied to $t_n$ so as to yield $P\braces[\big]{\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{\varphi}_{n}(x)-\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}}> t_n} \leqslant u_n$, where
\[
u_n=K_{2}\exp\braces[\Bigg]{-\frac{1}{K_{2}}\frac{C_1t_nk_{n}}{G\eta_n}\log\parens[\Bigg]{1+\frac{C_1t_nk_{n}}{nK_{2}G\eta_n\parens[\big]{1+\sqrt{\log(A)}}^2}}}.
\]
Since $t_nk_n/(n\eta_n)=C_3n^{-1/2}\log^{1/2}(n)\to 0$ as $n\to+\infty$, it follows that $u_n\sim v_n$, where
\[
\begin{split}
v_n&=K_{2}\exp\braces[\Bigg]{-\frac{C_1t_{n}k_{n}}{K_{2}G\eta_n}\times\frac{C_1t_{n}k_{n}}{nK_{2}G\eta_n\parens[\big]{1+\sqrt{\log(A)}}^{2}}}\\
&= K_{2}\exp\braces[\Bigg]{-\parens[\Bigg]{\frac{C_1t_{n}k_{n}n^{-1/2}}{K_{2}G\eta_n\parens[\big]{1+\sqrt{\log(A)}}}}^{2}}\\
&= K_{2}\exp\braces[\Bigg]{-\parens[\Bigg]{\frac{C_{1}C_3}{K_{2}G\parens[\big]{1+\sqrt{\log(A)}}}}^{2}\log(n)}\\
&=\frac{K_{2}}{n^\alpha},
\end{split}
\]
with $\alpha=\parens[\Big]{\frac{C_{1}C_3}{K_{2}G\parens[\big]{1+\sqrt{\log(A)}}}}^{2}.$ From~\eqref{c1} we have $\alpha>1$, thus $\sum_{n=0}^{+\infty}v_n<+\infty$ and $\sum_{n=0}^{+\infty}u_n<+\infty$. Consequently,
\[
\sum_{n\geqslant 0}P\braces[\Bigg]{\sup_{x\in
\mathbb{R}^p}\abs[\Big]{\widehat{\varphi}_{n}(x)-\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}}>C_{3}\frac{n^{1/2}\log^{1/2}(n)\,\eta_n}{k_{n}}}<+\infty,
\]
and by Borel--Cantelli lemma we deduce~\eqref{alea}.
\let\qed\relax
\end{proof}

\begin{proof}[Proof of~\eqref{biais}]
\[
\begin{split}
\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}&=\frac{1}{\mathscr{D}_{1,n}^{p}}\mathbb{E}\parens[\Bigg]{h(Y_1)K\parens[\Bigg]{\frac{X_1-x}{\mathscr{D}_{2,n}}}}\\
&=\frac{1}{\mathscr{D}_{1,n}^{p}}\int_{\mathbb{R}^{p+1}} h(y)K\parens[\Bigg]{\frac{t-x}{\mathscr{D}_{2,n}}}f_{(X,Y)}(t,y) \, \dd t_1 \dotsm \dd t_p \, \dd y\\
&=\frac{1}{\mathscr{D}_{1,n}^{p}}\int_{\mathbb{R}^{p}}K\parens[\Bigg]{\frac{t-x}{\mathscr{D}_{2,n}}}\parens*{\int_\mathbb{R}h(y)f_{(X,Y)}(t,y) \, \dd y }  \, \dd t_1 \dotsm \dd t_p\\
&=\frac{1}{\mathscr{D}_{1,n}^{p}}\int_{\mathbb{R}^{p}}K\parens[\Bigg]{\frac{t-x}{\mathscr{D}_{2,n}}}\varphi(t) \, \dd t_1 \dotsm \dd t_p\\
&=\gamma_n\int_{\mathbb{R}^{p}}K(u)\varphi(x+\mathscr{D}_{2,n}u) \, \dd u_1 \dotsm \dd u_p,
\end{split}
\]
where $\gamma_n=\frac{\mathscr{D}_{2,n}^p}{\mathscr{D}_{1,n}^p}$. From Taylor's theorem, there exists $\theta\in\mathopen{]}0,1\mathclose{[}$ such that
\begin{multline*}
\varphi(x+\mathscr{D}_{2,n}u) = \varphi(x)+\sum_{k=1}^{r-1}\frac{1}{k!}\sum_{1\leqslant i_1,\dotsc,i_k\leqslant p}\frac{\partial^k\varphi}{\partial x_{i_1} \dotsm \partial x_{i_k}} (x)\,\mathscr{D}_{2,n}^ku_{i_1} \dotsm u_{i_k} \\
+\frac{1}{r!}\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p}\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x+\theta\mathscr{D}_{2,n}u)\,\mathscr{D}_{2,n}^ru_{i_1} \dotsm u_{i_r}.
\end{multline*}
Hence
\[
\begin{split}
	& \mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}
\\	& \quad = \gamma_n\varphi(x)\int_{\mathbb{R}^{p}}K(u) \, \dd u_1 \dotsm \dd u_p
\\	& \qquad + \gamma_n\sum_{k=1}^{r-1}\frac{1}{k!}\sum_{1\leqslant i_1,\dotsc,i_k\leqslant p}\frac{\partial^k\varphi}{\partial x_{i_1} \dotsm \partial x_{i_k}} (x)\,\mathscr{D}_{2,n}^k\int_{\mathbb{R}^{p}}u_{i_1} \dotsm u_{i_k} K(u) \, \dd u_1 \dotsm \dd u_p
\\	& \qquad + \gamma_n\frac{1}{r!}\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p}\mathscr{D}_{2,n}^r\int_{\mathbb{R}^{p}}\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x+\theta\mathscr{D}_{2,n}u)\,u_{i_1} \dotsm u_{i_r}\,K(u) \, \dd u_1 \dotsm \dd u_p
\\	& \quad = \gamma_n\,\varphi(x)+\gamma_n\frac{1}{r!}\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p}\mathscr{D}_{2,n}^r\int_{\mathbb{R}^{p}}\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x+\theta\mathscr{D}_{2,n}u)\,u_{i_1} \dotsm u_{i_r}\,K(u) \, \dd u_1 \dotsm \dd u_p
\\	& \quad = \gamma_n\,\varphi(x)+\gamma_n\frac{1}{r!}\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p}\mathscr{D}_{2,n}^r\int_{\mathbb{R}^{p}}\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x+\theta\mathscr{D}_{2,n}u)\,u_{i_1} \dotsm u_{i_r}\,K(u) \, \dd u_1 \dotsm \dd u_p
\\	& \qquad - \gamma_n\frac{1}{r!}\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x)\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p}\mathscr{D}_{2,n}^r\int_{\mathbb{R}^{p}}\,u_{i_1} \dotsm u_{i_r}\,K(u) \, \dd u_1 \dotsm \dd u_p
\\	& \quad = \gamma_n\,\varphi(x)
\\	& \qquad + \frac{\gamma_n}{r!}\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p} \!\!\! \mathscr{D}_{2,n}^r \! \int_{\mathbb{R}^{p}} \!\! \parens[\Bigg]{\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x+\theta\mathscr{D}_{2,n}u)-\frac{\partial^r\varphi}{\partial x_{i_1} \dotsm \partial x_{i_r}} (x)} u_{i_1} \dotsm u_{i_r}\,K(u) \, \dd u_1 \dotsm \dd u_p.
\end{split}
\]
Since $\varphi$ belongs to $\mathscr{C}(c,r)$, it follows
\[
\begin{split}
\abs[\big]{\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}-\varphi(x)} &\leqslant\abs{ \gamma_n-1} \, \abs[\big]{\varphi(x)} +c\frac{\gamma_n}{r!}\sum_{1\leqslant i_1,\dotsc,i_r\leqslant p}\mathscr{D}_{2,n}^{r+1}\theta\int_{\mathbb{R}^{p}}\Vert u\Vert\,\abs{u_{i_1}} \dotsm \abs{u_{i_r}}\,\abs[\big]{K(u)} \, \dd u_1 \dotsm \dd u_p\\
&\leqslant\abs{ \gamma_n-1} \, \norm{\varphi}_\infty +c\frac{\gamma_n}{r!}p^r\mathscr{D}_{2,n}^{r+1}\int_{\mathbb{R}^{p}}\Vert u\Vert^{r+1}\, \abs[\big]{K(u)} \, \dd u_1 \dotsm \dd u_p.
\end{split}
\]
Since $\gamma_{n}\to1$ as $n\to+\infty$, we have for $n$ large enough $\gamma_n\leqslant 3/2$ and, therefore, $\gamma_n\mathscr{D}_{2,n}^{r+1}\leqslant \frac{3}{2}C_2n^{-\frac{r+1}{p}}k_n^{ \frac{r+1}{p}} $. Thus,
\[
\abs[\big]{\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}-\varphi(x)}
\leqslant\abs{ \gamma_n-1} \, \norm{\varphi}_\infty +C_4\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}
\]
for some $C_4>0$. Since $\abs{ \gamma_n-1}\sim n^{-\frac{r+1}{p}}$ it follows that, for $n$ large enough, $\abs[\big]{\mathbb{E}\parens[\big]{\widehat{\varphi}_{n}(x)}-\varphi(x)}
\leqslant C_5\parens[\big]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}$ for some $C_5>0$, which implies~\eqref{biais}.
\end{proof}
\let\qed\relax
\end{proof}

\subsection{Proof of Theorem~\ref{theo_dens}}

Considering a sequence $(\beta_n)_{n\in\mathbb{N}^\ast}$ in $\mathopen{]}0,1\mathclose{[}$ such that $1-\beta_n\sim n^{-\frac{r+1}{p}}$, we put
\[
D_{n}^{-}(x)=\bracks[\Bigg]{\frac{k_{n}}{nf(x)}}^{1/p}\beta_{n}^{1/2p}, \qquad D_{n}^{+}(x)=\bracks[\Bigg]{\frac{k_{n}}{nf(x)}}^{1/p}\beta_{n}^{-1/2p}.
\]
Then, for $n$ large enough we have almost surely: $D_{n}^{-}(x)\leqslant R_n(x)\leqslant D_{n}^{+}(x)$ (see, e.g., \cite{collomb80}). According to Assumption~\ref{kernel}\eqref{kernel_v} we have
\begin{align*}
& K\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}=K\parens[\Bigg]{\frac{D_{n}^{-}(x)}{R_{n}(x)}\frac{X_{i}-x}{D_{n}^{-}(x)}}\geqslant K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{-}(x)}}
\\ \text{and} \qquad & K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{+}(x)}}=K\parens[\Bigg]{\frac{R_{n}(x)}{D_{n}^{+}(x)}\frac{X_{i}-x}{R_{n}(x)}}\geqslant K\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}.
\end{align*}
Thus
\begin{equation}\label{ineg}
K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{-}(x)}}\leqslant K\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}\leqslant K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{+}(x)}}
\end{equation}
and, therefore, $\widehat{f}_{1,n}(x)\leqslant\widehat{f}_{n}(x)\leqslant\widehat{f}_{2,n}(x)$, where
\[
\widehat{f}_{1,n}(x)=\frac{1}{n\parens[\big]{D_{n}^{+}(x)}^{p}}\sum_{i=1}^{n}K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{-}(x)}} \qquad \text{and} \qquad \widehat{f}_{2,n}(x)=\frac{1}{n\parens[\big]{D_{n}^{-}(x)}^{p}}\sum_{i=1}^{n}K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{+}(x)}}.
\]
Hence
\[
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{n}(x)-f(x)}\leqslant\max\braces[\Bigg]{\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{1,n}(x)-f(x)}, \: \sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{2,n}(x)-f(x)} },
\]
and it remains to prove that
\begin{equation}\label{f1}
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{1,n}(x)-f(x)} = O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)}{k_{n}^{2}}}}
\end{equation}
and
\begin{equation}\label{f2}
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{2,n}(x)-f(x)} = O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)}{k_{n}^{2}}}}.
\end{equation}
For proving~\eqref{f1} we apply Lemma~\ref{tech} with $h\equiv 1$, $\eta_n\equiv 1$, $\mathscr{D}_{1,n}=D_n^+(x)$ and $\mathscr{D}_{2,n}=D_n^-(x)$. In this case, the properties~\eqref{propdn} and~\eqref{propdn2} are satisfied. Indeed, since $\beta_{n}\to1$ as $n\to+\infty$, we have for $n$ large enough $1/2\leqslant\beta_n\leqslant 3/2$ and, therefore,
\begin{equation}\label{appl1}
\parens*{D_n^+(x)}^p\geqslant\sqrt{\frac{2}{3}}\frac{1}{\Vert f\Vert_\infty}n^{-1}k_n, \qquad \parens[\big]{D_n^-(x)}^p\leqslant\sqrt{\frac{3}{2}}\frac{1}{c_0}n^{-1}k_n,
\end{equation}
and also
\begin{equation}\label{appl12}
\abs*{ \frac{\parens[\big]{D_n^-(x)}^p}{\parens[\big]{D_n^+(x)}^p}-1}=1-\frac{\parens[\big]{D_n^-(x)}^p}{\parens[\big]{D_n^+(x)}^p}=1-\beta_n\sim n^{-\frac{r+1}{p}}.
\end{equation}
On the other hand, $\widehat{\varphi}_n(x)=\widehat{f}_{1,n}(x)$ and
\[
\varphi(x)=\int_\mathbb{R}f_{(X,Y)}(x,y) \, \dd y=f(x).
\]
Then, applying Lemma~\ref{tech} yields~\eqref{f1}. Similarly, applying Lemma~\ref{tech} to the case where $h\equiv 1$, $\eta_n\equiv 1$, $\mathscr{D}_{1,n}=D_n^-(x)$ and $\mathscr{D}_{2,n}=D_n^+(x)$ leads to~\eqref{f2} since
\begin{equation}\label{appl2}
\parens[\big]{D_n^-(x)}^p\geqslant\frac{1}{\sqrt{2}\Vert f\Vert_\infty}n^{-1}k_n, \qquad \parens[\big]{D_n^+(x)}^p\leqslant\frac{\sqrt{2}}{c_0}n^{-1}k_n,
\end{equation}
and
\begin{equation}\label{appl22}
\abs*{\frac{\parens[\big]{D_n^+(x)}^p}{\parens[\big]{D_n^-(x)}^p}-1}=\frac{\parens[\big]{D_n^+(x)}^p}{\parens[\big]{D_n^-(x)}^p}-1=\frac{1-\beta_n}{\beta_n}\sim n^{-\frac{r+1}{p}}.
\end{equation}

\subsection{Proof of Theorem~\ref{reg1}}

Clearly, $\widehat{g}_n(x)=\widehat{g}_{1,n}(x)-\widehat{g}_{2,n}(x)$, where
\begin{align*}
& \widehat{g}_{1,n}(x)=\frac{1}{n\parens[\big]{R_{n}(x)}^{p}}\sum_{i=1}^{n}Y_{i}\mathds{1}_{\{Y_{i}\geqslant 0\}}K\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}
\\ \text{and} \qquad &\widehat{g}_{2,n}(x)=\frac{1}{n\parens[\big]{R_{n}(x)}^{p}}\sum_{i=1}^{n}(-Y_{i})\mathds{1}_{\{Y_{i}<0\}}K\parens[\Bigg]{\frac{X_{i}-x}{R_{n}(x)}}.
\end{align*}
From~\eqref{ineg} we get $
\widehat{g}_{1,n}^{-}(x)\leqslant\widehat{g}_{1,n}(x)\leqslant \widehat{g}_{1,n}^{+}(x) $ and $
\widehat{g}_{2,n}^{+}(x)\leqslant\widehat{g}_{2,n}(x)\leqslant \widehat{g}_{2,n}^{-}(x)$, where
\begin{align*}
	& \widehat{g}_{1,n}^{-}(x)=\frac{1}{n\parens[\big]{D_{n}^{+}(x)}^{p}}\sum_{i=1}^{n}Y_{i}\mathds{1}_{\{Y_{i}\geqslant 0\}}K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{-}(x)}},
\\	& \widehat{g}_{1,n}^{+}(x)=\frac{1}{n\parens[\big]{D_{n}^{-}(x)}^{p}}\sum_{i=1}^{n}Y_{i}\mathds{1}_{\{Y_{i}\geqslant 0\}}K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{+}(x)}},
\\	& \widehat{g}_{2,n}^{-}(x)=\frac{1}{n\parens[\big]{D_{n}^{-}(x)}^{p}}\sum_{i=1}^{n}(-Y_{i})\mathds{1}_{\{Y_{i}<0\}}K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{+}(x)}}
\\ \text{and} \qquad & \widehat{g}_{2,n}^{+}(x)=\frac{1}{n\parens[\big]{D_{n}^{+}(x)}^{p}}\sum_{i=1}^{n}(-Y_{i})\mathds{1}_{\{Y_{i}<0\}}K\parens[\Bigg]{\frac{X_{i}-x}{D_{n}^{-}(x)}}.
\end{align*}
Then, since $\widehat{g}_n(x)-g(x)=\parens[\big]{\widehat{g}_{1,n}(x)-g_1(x)}-\parens[\big]{\widehat{g}_{2,n}(x)-g_2(x) }$, it follows
\begin{multline*}
\sup_{x\in \mathbb{R}^p}\abs[\big]{ \widehat{g}_n(x)-g(x)} \leqslant 2\max\braces[\Bigg]{\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{g}_{1,n}^{+}(x)-g_1(x)}+\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{g}_{2,n}^{-}(x)-g_2(x)},
\\	\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{g}_{1,n}^{-}(x)-g_1(x)}+\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{g}_{2,n}^{+}(x)-g_2(x)}},
\end{multline*}
and it suffices to show that
\begin{equation}\label{glplus}
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{g}_{\ell,n}^{+}(x)-g_\ell(x)}=O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)M_{n}^{2}}{k_{n}^{2}}}}
\end{equation}
and
\begin{equation}\label{glmoins}
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{g}_{\ell,n}^{-}(x)-g_\ell(x)}=O_{a.s.}\parens*{\parens[\Bigg]{\frac{k_{n}}{n}}^{\frac{r+1}{p}}+\sqrt{\frac{n\log(n)M_{n}^{2}}{k_{n}^{2}}}}
\end{equation}
for $\ell\in\{1,2\}$. For proving~\eqref{glplus} with $\ell=1$, we apply Lemma~\ref{tech} with $h(y)=y\mathds{1}_{\mathbb{R}_+}(y)$, $\eta_n= M_n$, $\mathscr{D}_{1,n}=D_n^-(x)$ and $\mathscr{D}_{2,n}=D_n^+(x)$. In this case, the properties~\eqref{propdn} and~\eqref{propdn2} are satisfied in~\eqref{appl2} and~\eqref{appl22} respectively, and we have $\widehat{\varphi}_n(x)=\widehat{g}_{1,n}^{+}(x)$ and
\[
\varphi(x)=\int_\mathbb{R}y\mathds{1}_{\mathbb{R}_+}(y)f_{(X,Y)}(x,y) \, \dd y=f(x)\int_\mathbb{R}y\mathds{1}_{\mathbb{R}_+}(y)f_{Y \cond[\big] X=x}(y) \, \dd y=g_1(x).
\]
Similarly, applying Lemma~\ref{tech} to the case where $h(y)=-y\mathds{1}_{\mathopen{]}-\infty,0\mathclose{[}}(y)$, $\eta_n= M_n$, $\mathscr{D}_{1,n}=D_n^+(x)$ and $\mathscr{D}_{2,n}=D_n^-(x)$ leads to~\eqref{glplus} with $\ell=2$ since the properties~\eqref{propdn} and~\eqref{propdn2} are satisfied in~\eqref{appl1} and~\eqref{appl12} respectively, and we have $\widehat{\varphi}_n(x)=\widehat{g}_{2,n}^{+}(x)$ and
\[
\varphi(x)=-\int_\mathbb{R}y\mathds{1}_{\mathopen{]}-\infty,0\mathclose{[}}(y)f_{(X,Y)}(x,y) \, \dd y=-f(x)\int_\mathbb{R}y\mathds{1}_{\mathopen{]}-\infty,0\mathclose{[}}(y)f_{Y \cond[\big] X=x}(y) \, \dd y=g_2(x).
\]
Equation~\eqref{glmoins} is obtained from a similar reasoning.

\subsection{Proof of Theorem~\ref{reg2}}

Clearly,
\[
\begin{split}
\abs[\big]{\widehat{r}_{n}(x)-r(x)}&=\abs[\Bigg]{\frac{\widehat{g}_{n}(x)}{\widehat{f}_{b_{n}}(x)}-\frac{g(x)}{f(x)}}
\\	& =\frac{\abs[\big]{\widehat{g}_{n}(x)f(x)-\widehat{f}_{b_{n}}(x)g(x)}}{\widehat{f}_{b_{n}}(x)f(x)}\\
&\leqslant c_{_{0}}^{-1}\frac{\abs[\Big]{\parens[\big]{\widehat{g}_{n}(x)-g(x)}f(x)+g(x)\parens[\big]{f(x)-\widehat{f}_{b_{n}}(x)}}}{\widehat{f}_{b_{n}}(x)}\\
&\leqslant c_{_{0}}^{-1}\frac{\norm{f}_{\infty} \abs[\big]{\widehat{g}_{n}(x)-g(x)}+\norm{g}_{\infty}\abs[\big]{\widehat{f}_{b_n}(x)-f(x)}}{\widehat{f}_{b_{n}}(x)}.
\end{split}
\]
Since $\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{n}(x)-f(x)}\to 0$, a.s., as $n\to +\infty$, we have for $n$ large enough, $\abs[\big]{\widehat{f}_{n}(x)-f(x)}\leqslant c_0/2$ and, therefore,
\[
c_0\leqslant f(x)\leqslant \abs[\big]{\widehat{f}_{n}(x)-f(x)}+\widehat{f}_{n}(x)\leqslant \frac{c_0}{2}+\widehat{f}_{n}(x).
\]
Hence, $\widehat{f}_{n}(x)\geqslant c_0/2$ and, since $\widehat{f}_{b_n}(x)\geqslant \widehat{f}_{n}(x)$ it follows that $\widehat{f}_{b_n}(x)\geqslant c_0/2$. Thus
\[
\abs[\big]{\widehat{r}_{n}(x)-r(x)} \leqslant 2 c_{_{0}}^{-2} \bigg(\norm{f}_{\infty} \abs[\big]{\widehat{g}_{n}(x)-g(x)}+\norm{g}_{\infty}\abs[\big]{\widehat{f}_{b_n}(x)-f(x)}\bigg).
\]
On the other hand, since $\widehat{f}_{n}(x)\leqslant\widehat{f}_{b_n}(x)\leqslant \widehat{f}_{n}(x)+b_n$, it follows that $\abs[\big]{\widehat{f}_{b_n}(x)- \widehat{f}_{n}(x)}\leqslant b_n$ and, therefore,
\[
\abs[\big]{\widehat{f}_{b_n}(x)-f(x)}\leqslant\abs[\big]{\widehat{f}_{b_n}(x)- \widehat{f}_{n}(x)}+\abs[\big]{\widehat{f}_{n}(x)-f(x)}\leqslant b_n+\abs[\big]{\widehat{f}_{n}(x)-f(x)}.
\]
Consequently,
\[
\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{r}_{n}(x)-r(x)} \leqslant2 c_{_{0}}^{-2} \parens[\Bigg]{\norm{f}_{\infty}\sup_{x\in \mathbb{R}^p} \abs[\big]{\widehat{g}_{n}(x)-g(x)}+\norm{g}_{\infty}b_n+\norm{g}_{\infty}\sup_{x\in \mathbb{R}^p}\abs[\big]{\widehat{f}_{n}(x)-f(x)}},
\]
and the proof is completed by using Theorems~\ref{theo_dens} and~\ref{reg1}.

\section*{Declaration of interests}

The authors do not work for, advise, own shares in, or receive funds from any organization that could benefit from this article, and have declared no affiliations other than their research organizations.

\printbibliography

\end{document}