Degree of freedom in chi square test