Greeting Stata Users,
I am using svy, subpop ( ): tab a b, pearson to generate chi-square statistic for a bivariate table. Variable 'a' has 3 categories and I wanted to drop one of the categories with n < 30. I created 0/1 variable, such that keepvalues=1 if inlist(a,1,2), 0 otherwise.
I used svy, subpop(keepvalues): tab a b, pearson to generate a chi-square statistic. However, instead of excluding the category the svy, supop (keepvalues) command populated the excluded category with zeros and failed to calculate the chi-squared.
Please advise.
The output after the run:
b
1 2
a 1 n11 n12
2 n21 n22
3 0 0
Table contains a zero in the marginals.
Statistics cannot be computed.
Pearson:
Uncorrected chi2(2) = .
Design-based F(., .) = . P = .
I am using svy, subpop ( ): tab a b, pearson to generate chi-square statistic for a bivariate table. Variable 'a' has 3 categories and I wanted to drop one of the categories with n < 30. I created 0/1 variable, such that keepvalues=1 if inlist(a,1,2), 0 otherwise.
I used svy, subpop(keepvalues): tab a b, pearson to generate a chi-square statistic. However, instead of excluding the category the svy, supop (keepvalues) command populated the excluded category with zeros and failed to calculate the chi-squared.
Please advise.
The output after the run:
b
1 2
a 1 n11 n12
2 n21 n22
3 0 0
Table contains a zero in the marginals.
Statistics cannot be computed.
Pearson:
Uncorrected chi2(2) = .
Design-based F(., .) = . P = .
Comment