The effect of stratification and clustering on the asymptotic distributions of standard Pearson chi-squared test statistics for goodness of fit (simple hypothesis) and independence in a two-way contingency table, denoted as X2 and XI2, respectively, is investigated. It is shown that both X2 and XI2 are asymptotically distributed as weighted sums of independent χ12 random variables. The weights are then related to the familiar design effects (deffs) used by survey samplers. A simple correction to X2, which requires only the knowledge of variance estimates (or deffs) for individual cells in the goodness-of-fit problem, is proposed and empirical results on the performance of corrected X2 provided. Empirical work on XI2 indicated that the distortion of nominal significance level is substantially smaller with XI2 than with X2. Some results under simple models for clustering are also given.