Density Level Sets: Asymptotics, Inference, and Visualization

Yen-Chi Chen, Christopher R. Genovese, Larry Wasserman

Introduction

Estimating the level sets of a probability density function has a wide range of applications, including anomaly detection (outlier detection) (Breunig et al., 2000; Hodge and Austin, 2004), two-sample comparison (Duong et al., 2009), binary classification (Mammen and Tsybakov, 1999), and clustering (Rinaldo and Wasserman, 2010; Rinaldo et al., 2012). In this paper, we study the problem of estimating the level set

where php_{h} is the expected kernel density estimator with bandwidth hh, a smoothed version of the underlying density pp. Using DhD_{h} (and thus php_{h}) has several advantages, which we discuss in detail in Section 2.2. Figures 5 and 10 illustrate the kind of confidence sets and visualizations we will develop in this paper.

A commonly used estimator of the density level-set is the plug-in estimator D^h={x:  p^h(x)=λ}\widehat{D}_{h}=\left\{{x:\;\widehat{p}_{h}(x)=\lambda}\right\}, where p^h\widehat{p}_{h} is the kernel density estimator or some other density estimator. There is a large literature for level sets (and upper level sets, which replace =λ=\lambda with ≥λ\geq\lambda) that focuses on the consistency, rates of convergence (Polonik, 1995; Tsybakov, 1997; Walther, 1997; Cadre, 2006; Cuevas et al., 2006) and minimaxity (Singh et al., 2009) of such estimators under various error loss functions.

Recent results on statistical inference for level sets include Jankowski and Stanberry (2012) and Mammen and Polonik (2013). Statistical inference is challenging in this setting because the estimand is a set and the estimator is a random set (Molchanov, 2005). Mason and Polonik (2009) establish asymptotic normality for upper level sets when the loss function is the measure of the set difference. However, it is unclear how to derive a confidence set from this result.

Another challenge of level set estimation is that we cannot directly visualize the level sets when the dimension of the data dd is larger than 3. One approach is to construct a level-set tree, which shows how the connected components for the upper level sets bifurcate when we gradually increase λ\lambda (Stuetzle, 2003; Klemelä, 2004, 2006, 2009; Stuetzle and Nugent, 2010; Kent et al., 2013). The level-set tree reveals topological information about the level sets but loses geometric information.

In this paper, we propose solutions to all of these problems. Our main contributions can be summarized as follows.

We derive the limiting distribution of Haus(D^h,Dh){\sf Haus}(\widehat{D}_{h},D_{h}) (Theorem 3).

We develop two bootstrap-based methods to construct confidence regions for DhD_{h} (Section 4).

We prove that both bootstrap methods are valid (Theorem 28 and 5).

We devise a visualization technique that preserves the geometric information for density level sets (Section 5).

Related Work. Early work on density level set focuses on proving the consistency or the rate of convergence under various metrics. See e.g. Polonik (1995); Tsybakov (1997); Walther (1997); Cuevas et al. (2006); Rinaldo and Wasserman (2010). However, none of these derives a limiting distribution for the density level sets. To our knowledge, the only paper that considers limiting distributions is Mason and Polonik (2009), proving asymptotic normality under a generalized integrated distance. However, this metric cannot be used to construct a confidence set for density level sets since the asymptotic distribution involves the true density, which is unknown. Estimating the level set is also related to support estimation, see e.g. Cuevas and Rodríguez-Casal (2004) and Cuevas (2009).

Jankowski and Stanberry (2012) and Mammen and Polonik (2013), both provide methods for constructing confidence sets for the density level sets using the variation of the density function. Our approach is similar to theirs but is based on Hausdorff distance. We will compare their methods to ours in Section 4.2.

Outline. We begin with a short introduction to density level sets along with some useful geometric concepts in Section 2. In Section 3, we derive the limiting distribution of the Hausdorff distance between the estimated and true level sets. In Section 4, we construct a valid confidence set for density level sets. In Section 5, we devise a visualization method for density level sets that is simple to interpret and efficient to compute. (We provide an R package that implements our visualization method.) We summarize our results and discuss related problems in Section 6.

Technical Background

Let X1,⋯ ,XnX_{1},\cdots,X_{n} be a random sample from an unknown, continuous density p(x)p(x). We define the density level set by

for some λ>0\lambda>0. Note that in the literature the term level sets is sometimes used for the set {x:  p(x)≥λ}\left\{{x:\;p(x)\geq\lambda}\right\}; we call the latter the upper level set to distinguish it from the level set in equation 2. Thus, the level sets (in our terminology) are the boundaries to the upper level sets, under mild smoothness assumptions (e.g., assumption G below).

We assume that λ\lambda is a fixed, positive value. A plug-in estimate for DD is

where p^h\widehat{p}_{h} is the kernel density estimator (KDE),

2 Smoothed Density Level Set

In this paper, we focus on inference for the level sets of a smoothed version of pp, specifically:

where Kh(x)=1hdK(∥x∥h)K_{h}(x)=\frac{1}{h^{d}}K\left(\frac{\|x\|}{h}\right) and ⋆\star denotes convolution. We denote the λ\lambda level set of php_{h} by

Note that although we focus on estimating DhD_{h}, we allow h=hn→0h=h_{n}\rightarrow 0 as n→∞n\rightarrow\infty.

Here, we argue that php_{h} (and hence DhD_{h}) is a better target for level-set estimation than pp (and hence DD). For simplicity, in this section we focus on the upper level sets Lh(λ)={x: ph(x)≥λ}L_{h}(\lambda)=\{x:\ p_{h}(x)\geq\lambda\} and L(λ)={x:ph(x)≥λ}L(\lambda)=\{x:p_{h}(x)\geq\lambda\}, but the gist of the argument remains the same in either case.

Our arguments are: (i) php_{h} always exists while pp may not even exist; (ii) p^h\widehat{p}_{h} can be naturally viewed as an estimator for php_{h}; (iii) php_{h} has all the salient structure of pp but is easier to estimate than pp; (iv) While the bias ph(x)−p(x)p_{h}(x)-p(x) may be analyzed theoretically, in practice, it cannot be accurately estimated. It is better to just be clear that we are really estimating php_{h}.

As long as h≥(log⁡n/n)1/dh\geq(\log n/n)^{1/d}, Pn(sup⁡x∣p^h(x)−ph(x)∣≥ϵ)→0P^{n}(\sup_{x}|\widehat{p}_{h}(x)-p_{h}(x)|\geq\epsilon)\to 0, and hence we can uniformly consistently estimate php_{h}, whether we keep hh fixed or let it tend to 0. The same is not true for pp. In fact, PP may not even have a density pp. The bias cannot be uniformly estimated in a distribution-free way.

Regarding (iii): The left plot in Figure 1 shows a density pp. The blue points at the bottom show the upper level set L={x: p≥0.05}L=\{x:\ p\geq 0.05\}. The right plot shows php_{h} for h=0.2h=0.2 and the blue points at the bottom show the upper level set Lh={x: ph≥0.05}L_{h}=\{x:\ p_{h}\geq 0.05\}. The smoothed out density php_{h} is biased and the upper level set LhL_{h} loses the small details of LL. But these small details are the least estimable, and LhL_{h} captures the principal structure of LL. In addition, when LL is smooth (having positive μ\mu-reach; Chazal and Lieutier 2005; Chazal et al. 2009) and hh is sufficiently small, LhL_{h} and LL will be topologically similar, in the sense that a small expansion of LhL_{h} is homotopic to LL (Chazal and Lieutier 2005; Chazal et al. 2009; Genovese et al. 2014). The μ\mu-reach and the concept of being nearly homotopic can be found in section 3.2 of Genovese et al. (2014) and section 4 of Chazal et al. (2009).

As a second example, let P=(1/3)ϕ(x;−5,1)+(1/3)δ0+(1/3)ϕ(x;5,1)P=(1/3)\phi(x;-5,1)+(1/3)\delta_{0}+(1/3)\phi(x;5,1) where ϕ\phi is a Normal density and δ0\delta_{0} is a point mass at 0. Of course, this distribution does not even have a density. The left plot in Figure (2) shows the density of the absolutely continuous part of PP with a vertical line to who the point mass. The right plot shows php_{h}, which is a smooth, well-defined density. Again the blue points show the level sets. As before php_{h} and LhL_{h} are slightly biased, but they are also well-defined. And p^h\widehat{p}_{h} and L^h\widehat{L}_{h} are accurate estimators of php_{h} and LhL_{h}, respectively. Moreover, LhL_{h} captures the most important qualitative information about LL, namely, that there are three connected components, one of which is small. These examples show that php_{h} — and hence DhD_{h} — is a sensible target of inference.

Lastly, we would like to point out that the idea of viewing php_{h} as the estimand is not new. The “scale space” approach to smoothing explicitly argues that we should view p^h\widehat{p}_{h} as an estimate of php_{h}, and php_{h} is then regarded as a view of pp at a particular resolution. This idea is discussed in detail in Chaudhuri et al. (2000); Chaudhuri and Marron (1999); Godtliebsen et al. (2002).

If one really wants to focus on making inference for DD, the level set of the original density, then we need to undersmoothUndersmoothing the density estimate to make statistical inferences is a common practice in nonparametric statistics; see e.g. page 89 of Wasserman (2006). so that the bias will not affect the limiting distribution. This leads to estimates of DD that are highly variable. We believe that an accurate confidence set for DhD_{h} is more useful than a poor confidence set for DD.

These arguments explain why we regard php_{h} rather than pp as the estimand. But these arguments do not tell us how to choose hh. Bandwidth selection is always a challenge and in this paper we mainly use Silverman’s rule of thumb (Silverman (1986)).

3 Geometric Concepts

Let πA(x)\pi_{A}(x) be the projection of a point xx onto a set AA. Note that πA(x)\pi_{A}(x) may not be unique. The distance induced by the projection is

where A⊕ϵ=⋃x∈AB(x,ϵ)A\oplus\epsilon=\bigcup_{x\in A}B(x,\epsilon) and B(x,ϵ)={y:  ∥x−y∥≤ϵ}B(x,\epsilon)=\{y:\;\|x-y\|\leq\epsilon\}. The Hausdorff distance is a generalized version of the L∞{\cal L}_{\infty} metric for sets.

The reach of a set MM (Federer 1959; Cuevas 2009, also known as condition number Niyogi et al. 2008 or minimal feature size Chazal and Lieutier 2005) is the largest distance from MM such that every point within this distance to MM has a unique projection onto MM. i.e.

Note that πA(x)\pi_{A}(x) is unique if 0<d(x,A)≤reach⁡(A)0<d(x,A)\leq\operatorname{{\sf reach}}(A). Another way to understand the reach is as the largest radius of a ball that can freely move along MM; see Figure 3 for an example. In some cases, the reach is the same as the smallest radius of curvature on MM. The reach plays a key role in relating the Hausdorff distance to the empirical process. Note that the reach is closely related to ‘rolling properties’ and ‘α\alpha-convexity’; see Cuevas (2009), Cuevas et al. (2012) and appendix A of Pateiro-López (2008).

Finally, two smooth sets AA and BB are called normal compatible (Chazal et al., 2007) if the projection between AA and BB are one to one and onto; see Figure 4 for an example. When AA and BB are normal compatible, the Hausdorff distance has the simpler form

Asymptotic Theory

In this section, we derive the asymptotic theory for Haus(D^h,Dh){\sf Haus}(\widehat{D}_{h},D_{h}). Note first that for two sets AA and BB, the Hausdorff distance satisfies the inclusion property

From this, it follows that when we have a set estimator A^n\widehat{A}_{n} and a parameter of interest AA, then for any α>0\alpha>0, the set

is a 1−α1-\alpha confidence set for AA, where Quantile⁡(X,α)\operatorname{{\sf Quantile}}(X,\alpha) is the α\alpha-quantile of random variable XX. Thus, whenever we can approximate the distribution of Haus(A^n,A){\sf Haus}(\widehat{A}_{n},A), we can construct a confidence set for AA. Note that Chen et al. (2014b) and Chen et al. (2014a) have used this property to construct confidence sets, but neither paper used this property to full effect.

We define the sup norm using derivatives up to rr-th order by:

Let α=(α1,⋯ ,αd)\alpha=(\alpha_{1},\cdots,\alpha_{d}) be an multi-index such that each αj\alpha_{j} is a non-negative integer and ∣α∣=α1+⋯+αd|\alpha|=\alpha_{1}+\cdots+\alpha_{d}. We define

We now state are main assumptions, for an arbitrary density qq. When we use the assumptions in what follows, we will take qq to be php_{h}.

The kernel function K∈BC3K\in\mathbf{BC}^{3} and is symmetric, non-negative, and

for all multi-indices α\alpha satisfying ∣α∣≤3|\alpha|\leq 3.

The kernel function KK and its partial derivative satisfies condition K1K_{1} in Giné and Guillou (2002). Specifically, let

Assumption (G) appears in Molchanov (1991); Tsybakov (1997); Walther (1997); Molchanov (1998); Cadre (2006); Mammen and Polonik (2013); Laloe and Servien (2013). For a smooth density qq, (G) holds whenever the specified level λ\lambda does not coincide with the density value for a critical point.

Assumption (K1) is to guarantee that the variance of the KDE is bounded and to ensure that ph∈BC3p_{h}\in\mathbf{BC}^{3}. This assumption is very common in statistical literature, see e.g. Wasserman (2006). Assumption (K2) is to regularize the complexity of the kernel function so that the supremum norm for kernel functions and their derivatives can be bounded in probability. Similar assumption appears in Einmahl and Mason (2005) and Genovese et al. (2014). The Gaussian kernel and many compactly supported kernels satisfy both assumptions.

An immediate result from assumption (G) is the smoothness of the density level set. This smoothness property will be used to understand the distribution of Haus(D^h,Dh){\sf Haus}(\widehat{D}_{h},D_{h}).

Assume a density ph∈BC2p_{h}\in\mathbf{BC}^{2} satisfies condition (G) and let DhD_{h} denote the level set for php_{h} at λ\lambda. Then

Moreover, let q∈BC3q\in\mathbf{BC}^{3} be another density function and define D(q)D(q) as the level set for qq at level λ\lambda. When ∥ph−q∥2,max⁡∗\|p_{h}-q\|^{*}_{2,\max} is sufficiently small,

reach⁡(D(q))=min⁡{δ02,g0∥ph∥2,max⁡∗}+O(∥ph−q∥2,max⁡∗)\operatorname{{\sf reach}}(D(q))=\min\left\{\frac{\delta_{0}}{2},\frac{g_{0}}{\|p_{h}\|^{*}_{2,\max}}\right\}+O(\|p_{h}-q\|^{*}_{2,\max}).

DhD_{h} and D(q)D(q) are normal compatible.

The proof is given in the supplementary materials. Lemma 1 is very similar to Theorem 1 and 2 in Walther (1997). Essentially, this lemma shows that the level set DD is smooth and that whenever two smooth densities are sufficiently close, their level sets will both be smooth, be close to each other, and have one-to-one and onto normal projections between them.

Assume (K1–K2) and (G) hold for php_{h}. Let DhD_{h} and D^h\widehat{D}_{h} be the density level sets with level λ\lambda for php_{h} and p^h\widehat{p}_{h}. Define the function

with x∈Dhx\in D_{h}. If log⁡nnhd+2→0, h→0\frac{\log n}{nh^{d+2}}\rightarrow 0,\,h\rightarrow 0, then

A key element for the proof of Lemma 19 is the smoothness of DhD_{h} and D^h\widehat{D}_{h}, which relies on Lemma 1. This smoothness allows us to approximate the local difference by an empirical process.

Lemma 19 shows that the projected distance to the level sets can be approximated by a stochastic process (the empirical process) defined on a smooth manifold. Specifically, Lemma 19 shows that the projection distance can be approximated by an empirical process on certain functions fxf_{x}, where x∈Dhx\in D_{h}. The level sets DhD_{h} now acts as an index set. Thus, we define the function space

Assume (K1–K2) and (G) holds for php_{h}. Let DhD_{h} and D^h\widehat{D}_{h} be the density level sets with level λ\lambda for php_{h} and p^h\widehat{p}_{h}. Then when log⁡nnhd+2→0, h→0\frac{\log n}{nh^{d+2}}\rightarrow 0,\,h\rightarrow 0, the Hausdorff distance satisfies

The proof of Theorem 3 depends on two geometric observations. First, the empirical approximation in Lemma 19, shows that the local difference is approximately the same as an empirical process, and hence the maximum local difference is approximated by the maximum of the empirical process. Second, the normal compatibility between D^h\widehat{D}_{h} and DhD_{h} guaranteed by Lemma 1, which implies that maximal of local difference is the same as the Hausdorff distance.

Theorem 3 shows that the Hausdorff distance Haus(D^h,Dh){\sf Haus}(\widehat{D}_{h},D_{h}) can be approximated by a maximum over a certain Gaussian process. Note that we cannot directly use this theorem to construct a confidence set for DhD_{h} since the Gaussian process is defined on DhD_{h}, which is unknown. Later we will use the bootstrap to approximate this limiting distribution and construct a confidence set.

Statistical Inference

We now show that we can construct valid confidence sets for DhD_{h} with the bootstrap. A set Sn,1−αS_{n,1-\alpha} is called an asymptotically valid confidence set for DhD_{h} if

where rn→0r_{n}\rightarrow 0 as n→∞n\rightarrow\infty. We propose two methods for constructing a confidence set, and we will show that they are both asymptotically valid.

The first approach is to use the Hausdorff distance between the level sets. Let Wn=Haus(D^h,Dh)W_{n}={\sf Haus}(\widehat{D}_{h},D_{h}) and define

where FAF_{A} denotes the cdf for a random variable AA. Then, it is easy to see that

We use the bootstrap to estimate w1−αw_{1-\alpha}.

Let X1∗,⋯ ,Xn∗X^{*}_{1},\cdots,X^{*}_{n} be a bootstrap sample from the empirical measure. Let p^h∗\widehat{p}_{h}^{*} denote the KDE using the bootstrap sample, and D^n∗\widehat{D}^{*}_{n} the corresponding level set. We define Wn∗=Haus(D^n∗,D^h)W^{*}_{n}={\sf Haus}(\widehat{D}^{*}_{n},\widehat{D}_{h}) and

Then the bootstrap confidence set is D^h⊕w^1−α\widehat{D}_{h}\oplus\widehat{w}_{1-\alpha}.

Assume (K1–K2) and (G) holds for php_{h} and log⁡nnhd+2→0, h→0\frac{\log n}{nh^{d+2}}\rightarrow 0,\,h\rightarrow 0. Let DhD_{h} and D^h\widehat{D}_{h} and D^n∗\widehat{D}^{*}_{n} be the density level set with level λ\lambda for php_{h} and p^h\widehat{p}_{h} and p^h∗\widehat{p}_{h}^{*}. Then there exist Xn\mathcal{X}_{n} such that

An intuitive explanation for Theorem 28 is that as nn goes to infinity, the bootstrap process converges to the same Gaussian process as the empirical process – thus, they share the same Berry-Esseen bound.

2 Method 2: Supremum Loss

The second approach is to use the supremum norm of the KDE and impose an upper and lower bound around the density level.

Assume (K1–K2) and (G) holds for php_{h} and log⁡nnhd+2→0, h→0\frac{\log n}{nh^{d+2}}\rightarrow 0,\,h\rightarrow 0. Let DhD_{h} and D^h\widehat{D}_{h} and D^n∗\widehat{D}^{*}_{n} be the density level sets with level λ\lambda for php_{h} and p^h\widehat{p}_{h} and p^h∗\widehat{p}_{h}^{*}. Then

The proof of this Theorem is similar to the proof of Theorem 28, so we omit the details. The basic idea is as follows. By equation (30), the quantile of M^n\widehat{M}_{n} can be used to construct confidence sets. We then show that nhdMn\sqrt{nh^{d}}{M}_{n} is approximated by the maximum of a Gaussian process (similar to Theorem 3 and made explicit in Chernozhukov et al. 2014a). Finally, we show that the bootstrap nhdMn∗\sqrt{nh^{d}}M^{*}_{n} converges to nhdMn\sqrt{nh^{d}}{M}_{n} as in Theorem 28.

This method embodied in Theorem 5 is very similar to the methods in Jankowski and Stanberry (2012) and Mammen and Polonik (2013). Jankowski and Stanberry (2012) proposes to construct a confidence set of the form

where A△B={x:x∈A,x∉B}∪{x:x∈B,x∉A}A\triangle B=\{x:x\in A,x\notin B\}\cup\{x:x\in B,x\notin A\} is the symmetric difference between sets. Then they use the upper quantile of RnR_{n} to construct a confidence set of a similar form to (29) and apply the bootstrap to estimate the quantile. Their bootstrap consistency relies on Neumann’s method (Proposition 3.1 in Neumann (1998)) and they assume that hh converges fast enough so that one can ignore the bias for estimating the original density pp. Actually, under their assumptions, our proposed bootstrap confidence sets (from both methods 1 and 2) are also consistent for the original level set DD since the bias converges faster than the stochastic variation. The method in Mammen and Polonik (2013) should have higher power than our method 2 since they consider taking the supremum over a smaller region.

We may use a variance stabilizing transform to obtain an adaptive confidence set using similar idea to Chernozhukov et al. (2012). The variance of p^h(x)\widehat{p}_{h}(x) is proportional to p(x)p(x). Thus, we may use

and set v^1−α×p^h(x)\widehat{v}_{1-\alpha}\times\sqrt{\widehat{p}_{h}(x)} as an adaptive threshold for constructing the confidence set. Namely, the adaptive confidence set is given by

Using the same approach as in the proof to Theorem 5, we can show that C^n,1−α∗\widehat{C}^{*}_{n,1-\alpha} has asymptotically 1−α1-\alpha coverage.

The rate O((log⁡7nnhd)1/8)O\left(\left(\frac{\log^{7}n}{nh^{d}}\right)^{1/8}\right) may not be optimal. In Chernozukov et al. (2014), they apply a induction technique that gives a rate of order n−1/6n^{-1/6} for the Gaussian approximation. Despite not being mentioned explicitly in that paper, we believe that similar technique applies to the empirical process. If this is true, the rate in Theorem 3, 28 and 5 can be further refined to O((log⁡7nnhd)1/6)O\left(\left(\frac{\log^{7}n}{nh^{d}}\right)^{1/6}\right).

3 Comparing Methods 1 and 2

Despite the fact that method 2 yields a much larger confidence sets, it has some nice properties. First, method 2 is very simple: all we need is to compute the bootstrap distribution of supremum loss. Second, method 2 is connected to the methods proposed in Mammen and Polonik (2013) and Jankowski and Stanberry (2012). Third, the confidence sets produced in method 2 are related to level sets with level λ±m^1−α\lambda\pm\widehat{m}_{1-\alpha}. The last property makes it easy to visualize the confidence sets; see Section 5.3.

Here, we consider two simulated datasets to compare the coverage for confidence sets constructed using Hausdorff loss (method 1), L∞L_{\infty} loss (supremum loss; method 2), and scaled L∞L_{\infty} loss (remark 3).

The first dataset is a three-Gaussian mixture. The data is generated from the following distribution:

where ϕ2(x;μ,Σ)\phi_{2}(x;\mu,\Sigma) is the density to bivariate Gaussian with mean vector μ\mu and Covariance matrix Σ\Sigma. I2\mathbf{I}_{2} is the 2×22\times 2 identity matrix and μ1=(0,0)T\mu_{1}=(0,0)^{T}, μ2=(1,0)T\mu_{2}=(1,0)^{T}, and μ3=(1.5,0.5)T\mu_{3}=(1.5,0.5)^{T}. We use density level λ=0.3\lambda=0.3 and smoothing parameter h=0.2h=0.2. The corresponding level set DhD_{h} is the red curve in the left panel of Figure 7. We consider three different sample sizes, N=500,1000,2500N=500,1000,2500 and compare the coverage of confidence sets using the three methods. The corresponding coverages are given in Table 1. As can be seen from Table 1, all the three methods have the desire nominal coverage.

The second dataset is a four-mixture dataset from Cadre et al. (2009). The data is generated from the following distribution:

with π1=π2=π3=π4=1/5\pi_{1}=\pi_{2}=\pi_{3}=\pi_{4}=1/5 and π5=π6=1/10\pi_{5}=\pi_{6}=1/10, and μ1=(−0.3,−0.3)T,μ2=(3.0,3.0)T,μ3=μ4=(0,3)T,μ5=μ6=(3,0)\mu_{1}=(-0.3,-0.3)^{T},\mu_{2}=(3.0,3.0)^{T},\mu_{3}=\mu_{4}=(0,3)^{T},\mu_{5}=\mu_{6}=(3,0), and

We use density level λ=0.05\lambda=0.05 and smoothing parameter h=0.2h=0.2. The corresponding level set DhD_{h} is the red curves in the right panel of Figure 7. Again, we consider three different sample sizes N=500,1000,2500N=500,1000,2500 and compare the coverage of confidence sets using the three methods. The corresponding coverages are given in Table 2. It is clear that all the three methods have the desire nominal coverage. Moreover, it can be seen from both Table 1 and 2 that the supremum loss method over covers.

4 Pointwise Hypothesis Tests for Level Sets

The confidence sets developed in the previous section are related to two types of local hypothesis tests. For fixed density level λ\lambda and an arbitrary point xx, consider the tests of whether p(x)p(x) is greater or less than λ\lambda:

When we only want to test just a few points, we can do local tests for each point and control the family-wise error rate to control the type 1 error rate. Usually, however, we are interested conducting the local test at many or even an infinite number of points (like a region), making it difficult to control type 1 error simultaneously.

Inverting the confidence sets of the previous subsection gives a solution to this problem. Let S^n,1−α\widehat{S}_{n,1-\alpha} be a confidence set for DhD_{h} and let LhL_{h} and VhV_{h} be, respectively, the upper and lower lambda level sets. Then the decision rules

In addition, inverting the regions where we cannot reject Hin,0(x)H_{\sf in,0}(x) and Hout,0(x)H_{\sf out,0}(x) in (52) yields confidence sets for LhL_{h} and VhV_{h}. In Figure 6, a 90%90\% confidence regions for the upper level set LhL_{h} is the union of yellow and blue regions (Tout,n(x)=0T_{\sf out,n}(x)=0). And a 90%90\% confidence regions for VhV_{h}, the lower level set, is the union of green and blue regions (Tin,n(x)=0T_{\sf in,n}(x)=0). Thus, with 90%90\% confidence, all yellow regions are above λ\lambda and the true high density regions should be contained by the yellow and blue regions.

The two local tests described in (50) and (51) are relevant to the problems of level-set clustering (Hartigan, 1975; Polonik, 1995; Rinaldo and Wasserman, 2010; Rinaldo et al., 2012) and anomaly detection (Desforges et al., 1998; Breunig et al., 2000; He et al., 2003; Chandola et al., 2009). Rejecting Hin,0(x)H_{\sf in,0}(x) can be viewed as evidence that xx belongs to a level-set cluster. And a point xx where Hout,0(x)H_{\sf out,0}(x) is rejected can be viewed as anomalous.

Note that one can modify the local testing procedure to control the False Discovery Rate (Benjamini and Hochberg, 1995) rather than familywise error.

Visualization for Multivariate Level Sets

Level-set estimators can reveal useful information about a distribution, but beyond three dimensions, we cannot directly visualize the level sets, making the results difficult to use.

In this section, we propose a novel visualization technique density upper level sets in multidimensions. Any visualization entails some loss of information, but our goals are to preserve important geometric information about the sets, make the overall visualization easy to interpret, and give a method that is efficient to compute. Our method exploits the relationship between level-set clustering and mode clustering (see Figure 9).

A current and commonly used visualization method for level sets is the density tree (Stuetzle, 2003; Klemelä, 2004, 2006; Kent et al., 2013; Balakrishnan et al., 2013). This method considers several density levels, λ1<⋯<λK\lambda_{1}<\cdots<\lambda_{K}, and computes the number of connected components for the upper density level set at each level. As we increase the density level, some connected components may vanish and others may split into additional components. In the typical case when the underlying density function is a Morse function (i.e., Hessian at critical points is non-degenerate) (Morse, 1925, 1930; Milnor, 1963), the connected component disappears when the density level is above the maximum density value over the component and splits only if the density level passes the density value of some saddle points within the component (Klemelä, 2009). The vanishing and splitting of components as the level changes produces a tree structure. The density tree uses this tree structure as a visualization of the level sets. We refer to Klemelä (2009) for more details.

Density trees display primarily topological information about the underlying density function (Stuetzle, 2003; Kent et al., 2013) but need not preserve or impart other features that may be of interest. Extensions have been proposed that would endow the tree with additional information about the distribution (Klemelä, 2004, 2006, 2009), but this is difficult to do with multiple features and can make the visualization difficult to interpret. See Figure 8 for an example.

In this section, we propose a novel technique that visualizes several density (upper) level sets that preserve some geometric information and that are very easy to understand. Our method is based on the relationship between level set clustering and mode clustering (see Figure 9). Note that in this section, we will focus on density upper level sets.

Our method complements existing tree-based methods. It combine two clustering techniques – level-set and mode clustering – to produce a simple and intuitive visualization.

That is, πx(t)\pi_{x}(t) starts at xx and moves along the gradient of pp. We define the destination for πx(t)\pi_{x}(t) as dest(x)=lim⁡t→∞πx(t){\sf dest}(x)=\lim_{t\rightarrow\infty}\pi_{x}(t). Let M{\cal M} be the collection of all local modes of pp. It can be shown that dest(x)∈M{\sf dest}(x)\in{\cal M} except for a set of xx’s in a set B{\cal B} with Lebesgue measure (this set corresponds to the boundaries of clusters). For each mode mj∈Mm_{j}\in{\cal M}, we define its basin of attraction as

The regions A1,⋯ ,Ak{\cal A}_{1},\cdots,{\cal A}_{k} are the clusters generated by mode clustering.

Now we recall three facts about an upper density level set L={x: p(x)≥λ}L=\{x:\ p(x)\geq\lambda\} (c.f. Figure 9 left and middle panels):

Thus, the upper level sets are covered by the basins of attraction of the local modes (the uncovered regions have Lebesgue measure so we ignore them for visualization).

2 Visualization Algorithm

Given several density levels, λ1<⋯<λK\lambda_{1}<\cdots<\lambda_{K}, we can overlay the visualization from the previous paragraph from λ1\lambda_{1} to λK\lambda_{K} to create a “tomographic” visualization of the clusters. This gives a visualization for the density level sets. Figure 10 shows an example for visualizing level sets for a 66-dimensional and a 1010-dimensional simulation datasets at different density levels. This dataset is from Chen et al. (2014c).

3 Visualizing Level Sets with Confidence

A modified version of our algorithm allows us to visualize multivariate confidence sets for an upper level set at a given level λ\lambda. In particular, we visualize the confidence set for the level sets produced by Method 2 (supremum loss, see Section 4.2) . The advantage of Method 2 here is that this confidence set under different α\alpha’s is just the density level set at different λ\lambda’s. This makes it easy to visualize KK distinct confidence sets for pre-specified levels α1<⋯<αK\alpha_{1}<\cdots<\alpha_{K}.

and use the visualization algorithm to create a tomographic visualization. Figure 11 provides an example for visualizing confidence sets for upper level set using the 6 dimensional simulation data in Figure 10.

At the cost of additional computation, we can also use Method 1 (Hausdorff loss) instead of Method 2, combining it with the basins of attractions to visualize the confidence sets. We use method 1 to construct the inner/outer confidence sets and then we find the connected components and partition it by the basins of attraction for local modes and use multidimensional scaling to visualize it in low dimensions.

Discussion

In this paper, we derived the limiting distribution for smoothed density level sets under Hausdorff loss. This result immediately allows us to construct confidence sets for the smoothed level set. We developed two bootstrapping methods to construct the confidence sets, and we showed that both methods are consistent. These confidence sets can be inverted to construct multiple local tests of whether a point’s density value is above or below a given level, which has application to related problems such as anomaly detection. Finally, we developed a new visualization method that is informative and interpretable, even in multidimensions.

Although we focused on density level sets in this paper, our methods, including confidence sets and visualization, can be applied to a more general class of problems such as kernel classifier, two-sample tests, and generalized level sets (See Mammen and Polonik 2013 for more details.).

References

Proofs

Assume (K1–2), then for each t>0t>0 there exists some n0n_{0} such that whenever n>n0n>n_{0}, we have

Proof for Lemma 1. We first prove the lower bound for reach⁡(Dh)\operatorname{{\sf reach}}(D_{h}) and then we will prove the additional assertions.

Part 1: Lower bound on reach. We prove this by contradiction. Take xx near DhD_{h} such that

We assume that xx has two projections onto DhD_{h}, denoted as bb and cc.

Since b,c∈Dhb,c\in D_{h}, ph(b)−λ=ph(c)−λ=0p_{h}(b)-\lambda=p_{h}(c)-\lambda=0 so that ph(b)−ph(c)=0p_{h}(b)-p_{h}(c)=0. Now by Taylor’s theorem

Since both bb and cc are projection points from xx onto DhD_{h},

Recall that d(x,Dh)≤g0∥ph∥2,max⁡d(x,D_{h})\leq\frac{g_{0}}{\|p_{h}\|_{2,\max}} and by Taylor’s theorem,

so that ∣tb∣∥ph∥2,max⁡<1|t_{b}|\|p_{h}\|_{2,\max}<1. Note that the lower bound g0g_{0} in the last inequality is because d(x,Dh)<δ02d(x,D_{h})<\frac{\delta_{0}}{2} so it follows from assumption (G). Plugging in this result into the last equality of (60), we conclude that ∥b−c∥=0\|b-c\|=0. This shows b=cb=c so that we have a unique projection. Thus, whenever d(x,Dh)<(δ02,g0∥ph∥2,max⁡∗)d(x,D_{h})<\left(\frac{\delta_{0}}{2},\frac{g_{0}}{\|p_{h}\|^{*}_{2,\max}}\right), we have a unique projection onto DhD_{h} and thus we have proved the lower bound on reach.

Part 2: The three assertions. The first assertion is trivially true when ∥ph−q∥2,max⁡∗\|p_{h}-q\|^{*}_{2,\max} is sufficiently small since assumption (G) only involves gradients (first derivatives).

The second assertion follows from the lower bound on reach. By assertion 1, (G) holds for qq. And the lower bound on reach is bounded by gradient and second derivatives so that we have the prescribed bound.

The third assertion follows from Theorem 1 in Chazal et al. (2007) which states that if two d−1d-1 dimensional smooth manifolds M1M_{1} and M2M_{2} have Hausdorff distance being less than (2−2)min⁡{reach⁡(M1),reach⁡(M2)}(2-\sqrt{2})\min\{\operatorname{{\sf reach}}(M_{1}),\operatorname{{\sf reach}}(M_{2})\}, then M1M_{1} and M2M_{2} are normal compatible to each other. Now by Theorem 8, the Hausdorff distance between DhD_{h} and D(q)D(q) is at rate O(∥ph−q∥1,max⁡)O(\|p_{h}-q\|_{1,\max}) so that this assertion is true when ∥ph−q∥2,max⁡\|p_{h}-q\|_{2,\max} is sufficiently small. □\square

Proof of Lemma 2. Let x∈Dhx\in D_{h}. We define Π(x)∈Dh\Pi(x)\in D_{h} to be the projected point onto D^h\widehat{D}_{h}. By Lemma 1 and Theorem 8, when ∥p^h−ph∥2,max⁡∗→0\|\widehat{p}_{h}-p_{h}\|^{*}_{2,\max}\rightarrow 0, Haus(Dh,D^h)→P0{\sf Haus}(D_{h},\widehat{D}_{h})\overset{P}{\rightarrow}0 so that Π(x)\Pi(x) is unique. Thus, we assume Π(x)\Pi(x) is unique.

Now since Π(x)∈D^h\Pi(x)\in\widehat{D}_{h} and x∈Dhx\in D_{h}, p^h(Π(x))−ph(x)=0\widehat{p}_{h}(\Pi(x))-p_{h}(x)=0. Thus, by Taylor’s theorem

Note that x−Π(x)x-\Pi(x) is normal to D^h\widehat{D}_{h} at Π(x)\Pi(x) so that it points toward the same direction as ∇p^h(Π(x))\nabla\widehat{p}_{h}(\Pi(x)). Thus, (62) can be rewritten as

By Taylor’s theorem, ∇p^h(Π(x))\nabla\widehat{p}_{h}(\Pi(x)) is close to ∇ph(x)\nabla p_{h}(x) in the sense that

In addition, O(∥x−Π(x)∥))O(\|x-\Pi(x)\|)) is bounded by O(Haus(D^h,Dh))O({\sf Haus}(\widehat{D}_{h},D_{h})) which is at rate O(∥p^h−ph∥1,max⁡∗)O(\|\widehat{p}_{h}-p_{h}\|^{*}_{1,\max}) due to Theorem 8. Putting this together with (63), we conclude

Note that the left hand side can be written as

This holds uniformly for all x∈Dhx\in D_{h} and note that the definition of F{\cal F} is

Proof for Theorem 3. The proof for Theorem 3 follows the same procedure as the proof of Theorem 6 in Chen et al. (2014b). The proof contains two parts: Gaussian approximation and anti-concentration.

Part 1: Gaussian approximation. Basically, we will show that

First, when ∥p^h−ph∥\|\widehat{p}_{h}-p_{h}\| is sufficiently small, D^h\widehat{D}_{h} and DhD_{h} are normal compatible to each other by Lemma 1. Then by the property of normal compatible,

Note that this result basically follows from the same derivation of Proposition 3.1 in Chernozhukov et al. (2014c) with the fact that g≡1g\equiv 1 in their definition.

Combining equations (70) and (71) and pick t=1/nhd+2t=1/\sqrt{nh^{d+2}}, we have that for nn is sufficiently large and γ∈(0,1)\gamma\in(0,1),

Part 2: Anti-concentration. To obtain the desired Berry-Esseen bound, we apply the anti-concentration inequality in Chernozhukov et al. (2014c) and Chernozhukov et al. (2014a).

From Lemma 10 and equation (72), there exists some constant A6A_{6} such that

Now pick γ=(log⁡7nnhd)1/8\gamma=\left(\frac{\log^{7}n}{nh^{d}}\right)^{1/8} and use the fact that 1nhd+2\frac{1}{\sqrt{nh^{d+2}}} and 2e−nhd+2A22e^{-\sqrt{nh^{d+2}}A_{2}} converges faster than the other terms; we obtain the desired rate. □\square

Proof for Theorem 4. This proof follows the same strategy for the proof of Theorem 7 in Chen et al. (2014b). We prove the Berry-Esseen type bound first and then show that the coverage is consistent. We prove the Berry-Esseen bound in two simple steps: Gaussian approximation and support approximation.

Thus, if we sample from p^h\widehat{p}_{h} and consider estimating p^h\widehat{p}_{h} by p^h∗\widehat{p}^{*}_{h}, we are doing exactly the same procedure of estimating php_{h} by p^h\widehat{p}_{h}. Therefore, Lemma 2 and Theorem 3 hold for approximating Haus(D^h∗,D^h){\sf Haus}(\widehat{D}^{*}_{h},\widehat{D}_{h}) by a maxima for a Gaussian process. The difference is that the Gaussian process is defined on

since the “parameter (level sets)” being estimated is D^h\widehat{D}_{h} (the estimator is D^h∗\widehat{D}^{*}_{h}). Note that Fn{\cal F}_{n} is very similar to F{\cal F} except the denominator is slightly different and the support D^h\widehat{D}_{h} is also different from DhD_{h}. That is, we have

Step 2: Support approximation. In this step, we will show that

The first approximation can be shown by using the Gaussian comparison lemma (Theorem 2 in Chernozhukov et al. (2014b); also see Lemma 17 in Chen et al. (2014b)). We do the same thing as Step 3 in the proof of Theorem 8 in Chen et al. (2014b) so we omit the details. Essentially, given any ϵ>0\epsilon>0, we can construct a pair of balanced ϵ\epsilon-nets for both F{\cal F} and Fn{\cal F}_{n}, denoted as {g1,⋯ ,gK}\{g_{1},\cdots,g_{K}\} and {g1n,⋯ ,gKn}\{g^{n}_{1},\cdots,g^{n}_{K}\} so that max⁡j∥gj−gjn∥max⁡∗=O(∥p^h−ph∥1,max⁡∗)\max_{j}\|g_{j}-g^{n}_{j}\|^{*}_{\max}=O(\|\widehat{p}_{h}-p_{h}\|^{*}_{1,\max}). Then this ϵ\epsilon-net leads to

Now comparing the above result to Theorem 3 and using the fact that the first big-O term dominates the second term (the first is of rate −1/8-1/8 for nn but the second term is at rate −1/6-1/6 by Theorem 9), we conclude the result for first assertion.

For the coverage, let Wn=Haus(D^h,Dh)W_{n}={\sf Haus}(\widehat{D}_{h},D_{h}) and wn,1−α=FWn−1(1−α)w_{n,1-\alpha}=F^{-1}_{W_{n}}(1-\alpha). Since Dh⊂D^h⊕Haus(D^h,Dh)D_{h}\subset\widehat{D}_{h}\oplus{\sf Haus}(\widehat{D}_{h},D_{h}), we have

Now by the first assertion, the difference for wn,1−αw_{n,1-\alpha} and the bootstrap estimate wn,1−α∗w^{*}_{n,1-\alpha} differs at rate O((log⁡7nnhd)1/8)O\left(\left(\frac{\log^{7}n}{nh^{d}}\right)^{1/8}\right), which completes the proof.