added chisquare method