# Probability Density Estimation through Nonparametric Adaptive Partitioning and Stitching
## 3 Results and Discussions
### Mean Percent Error Comparison between NAPS and NMEM  
For each of the test distributions, we generated 100 independent data samples for sample sizes in increasing powers of two from \(N=2^{9}\) to \(2^{22}\). PDF estimates, \(PDF_{Est}(x)\),  
Figure 7: Tail estimates: Complementary CDF estimates for 100 samples of size \(2^{20}\) are shown for NAPS and NMEM for two rapidly decaying and two heavy tailed distributions. (**a**) normal(5, 1); (**b**) trimodal normal; (**c**) generalize-Pareto(2, 1, 0), and (**d**) stable(0.5, 0.05, 1, 4). The black line defines ground truth. Only the right side of the distributions is considered by focusing on \(x>0\), which allows \(\log 10(x)\) to be plotted. were obtained for each data sample using NAPS and NMEM and compared to the ground truth, \(PDF_{ref}\) using mean percent error (MPE). The percent error (PE) for a given estimate at the value of \(x\) is defined as:  
\[PE(x)=100\times\frac{\mid PDF_{est}(x)-PDF_{ref}(x)\mid}{\max[PDF_{ref}(x),0.01/N] }\;. \tag{6}\]  
The empirical mean of PE over the entire range of the PDF for one sample is based on all units (sample points, \(N\)), given as:  
\[MPE=\frac{1}{N}\sum_{k=1}^{N}PE(x_{k})\;. \tag{7}\]  
Instead of using mean squared error (MSE), we calculated the MPE to compare the estimated and ground truth PDFs, which overcomes problems associated with disparate scales. In cases where the ground truth distribution has a singularity, it is possible for a small PE in regions where the density is extremely large be associated with an absolute error much larger than the absolute error within low-density regions with a large PE. As such, MSE is intrinsically biased toward high-density regions and cannot reflect how good an estimate is in low-density regions. Calculating PE across the entire PDF provides a reasonably fair comparison of error relative to the ground truth distributions. To avoid problems when the ground truth PDF is zero, the PE formula of Equation (6) has a minimum value for the denominator of \(0.01/N\). This minimum level decreases as the sample size increases to reflect statistical resolution. Using MPE to quantitatively evaluate accuracy has the added advantage of providing a good sense of error across disparate types of distributions. Figure 8 presents box and whisker plots of MPE as a function of sample size across 100 tests for eight distributions. For the normal and uniform distributions shown in Figure 8a,b, respectively, the MPE values are comparable between the two estimators. However, NMEM does slightly better than NAPS for the normal distribution, which can be modeled exactly with only three Lagrange multipliers. This result is not surprising and is perhaps to be expected due to the similarity with performing a parametric fit. Although uniform can be exactly modeled with only one Lagrange multiplier, NAPS can still accurately estimate the distribution by splitting it into small blocks, each being relatively easy to identify as having uniform density. Unlike the normal distribution, which has distinct regions with disparate density (e.g., peak region versus half width and tails), NAPS applied to the uniform distribution must perform extra work to reconstruct the \"obvious\". Thus, the normal and uniform are two special examples (requiring a specific low number of Lagrange multipliers) where decomposing a problem into many parts using divide and conquer increases overall difficulty in obtaining a smooth and accurate estimate.