improve chi2_test so it will run on histograms of any dimensionality