Goodness of Fit and Test for Independence using Chi-Squared for Categorical Variables