# Probability Density Estimation through Nonparametric Adaptive Partitioning and Stitching
## 4 Conclusions  
The NAPS algorithm has been demonstrated to be an effective divide and conquer approach to density estimation across a diverse set of fourteen distributions, ranging in difficulty from easy to very challenging. The challenging distributions include discontinuities or singularities, many examples of heavy tails and a mixture model that combines a Beta distribution having two singularities with a Cauchy distribution. We considered sample sizes ranging from \(2^{9}\) to \(2^{27}\). A key aspect of NAPS is the development of a novel statistical measure, denoted by \(R\), that quantifies the density variation within a given subsample of data, referred to as a block. Specifically, \(R\) is the ratio of the greatest spacing in data points to the lowest spacing within a block. We found that \(R\) scales as a power law for all distributions we checked. This general \(R\) statistic has proven to be a useful scale invariant decision trigger for effective data partitioning in terms of relative density variation within a block. To our knowledge this useful \(R\) statistical measure has not been previously investigated in the statistics literature. The NAPS method can use different density estimation methods for estimating density within blocks of data that define partitioned subsamples. A data-driven stitching method is defined to develop a smooth overall continuous PDF estimate. Accuracy was quantified in two ways: through percent error between the estimated density and the ground truth PDF, and through the scaled quantile residual (SQR). We find that the estimates using NAPS(NMEM) produced a SQR that looked almost indistinguishable from that of sampled uniform random data (SURD) as it should. Although NAPS(KDE) has many advantages over KDE, such as adaptive bandwidth and handling boundaries better, it was noted that its SQR deviated from the expected characteristics of SURD. It is found that employing NMEM as the base method applied to all blocks is the most effective in both accuracy and speed. The NAPS(NMEM) approach extends the capabilities of NMEM to a larger class of distribution types and improves the ability to accurately estimate the underlying data with no a priori knowledge from the user. Furthermore, the estimates from NAPS are visibly smoother and calculated much more efficiently than NMEM. By focusing on partitioning a sample into more manageable subsamples using NMEM-workers in parallel computing, NAPS can efficiently handle large samples with over one hundred million units. In conclusion, the NAPS algorithm represents a novel approach to obtain accurate density estimation, serving as an appropriate tool for fully automated high throughput applications. Future improvements are being developed in regards to treating the left and right blocks differently within the framework of NMEM to include semi-parametric modeling of heavy tails. Ongoing work also involves incorporating NAPS demonstrated here using MATLAB into our C++ code, and integrate this technical advance into multiple existing software as updates in C++, R, MATLAB, and to provide a Python version as well. The following are available at [[https://www.mdpi.com/article/10.3390/a16070310/s1](https://www.mdpi.com/article/10.3390/a16070310/s1)]([https://www.mdpi.com/article/10.3390/a16070310/s1](https://www.mdpi.com/article/10.3390/a16070310/s1)): MATLAB scripts for data generation and post processing. Conceptualization, D.J.J. and Z.D.M. ; methodology, J.F., [PERSON] and D.J.J. ; software, Z.D.M. ; validation, [PERSON] and J.F. ; formal analysis, [PERSON]; investigation, [PERSON] and [PERSON]; resources, [PERSON]; data curation, [PERSON]; writing--original draft preparation, [PERSON]; writing--review and editing, [PERSON] and [PERSON]; visualization, [PERSON] and [PERSON]; supervision, [PERSON]; project administration, [PERSON]. All authors have read and agreed to the published version of the manuscript. This research received no external funding.