arXiv:1410.6758v2 [stat.ME] 18 Jun 2015 Keywords: Bivariate distribution; Nonparametric test; Statistical independence; Mutual information; Two-sample test. Abstract. A popular approach for testing if two univariate random variables are statis- tically independent consists of partitioning the sample space into bins, and evaluating a test statistic on the binned data. The partition size matters, and the optimal partition size is data dependent. While for detecting simple relationships coarse partitions may be best, for detecting complex relationships a great gain in power can be achieved by considering finer partitions. We suggest novel consistent distribution-free tests that are based on summation or maximization aggregation of scores over all partitions of a fixed size. We show that our test statistics based on summation can serve as good estimators of the mutual information. Moreover, we suggest regularized tests that aggregate over all partition sizes, and prove those are consistent too. We provide polynomial-time algo- rithms, which are critical for computing the suggested test statistics efficiently. We show that the power of the regularized tests is excellent compared to existing tests, and almost as powerful as the tests based on the optimal (yet unknown in practice) partition size, in simulations as well as on a real data example. Consistent distribution-free K -sample and independence tests for univariate random variables $^{1}$Address for correspondence: Department of Statistics and Operations Research, Tel-Aviv uni- versity, Tel-Aviv, Israel. E-mail: ruheller@post.tau.ac.il. The work of Ruth Heller and Barak Brill was supported by grant no. 2012896 from the Israel Science Foundation (ISF), and the work of Shachar Kaufman was supported by a fellowship from the Edmond J. Safra Center for Bioinformatics at Tel-Aviv university. Ruth Heller, Yair Heller, Shachar Kaufman, Barak Brill and Malka Gorfine 1