now has chi2() function