Adding function for chi-squared test