# Re: st: Chi square test unavailable when subpop is used in svy analyisis

 From Steven Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: Chi square test unavailable when subpop is used in svy analyisis Date Mon, 18 Aug 2008 10:25:00 -0400

```Sorry--my solution does NOT work (it solves another -subpop- issue
that I was looking at).  I hope someone from StataCorp will answer this.

-Steve

Ángel:

Use parentheses in the -subpop- option. This is a peculiar feature of
the -subpop- syntax.

-Steve

subpop(if (p108_n<10))

On Aug 18, 2008, at 6:20 AM, Ángel Rodríguez Laso wrote:

> Dear Statalisters,
>
> I'm working with Stata 9.2.
>
> I'm interested in obtaining the corrected chi square test for a
> distribution of two variables from a survey ('p108_n' and 'sexo'), but
> limiting the analysis to a selected group of values  of p108_n (1 to
> 5). I've used the subpop command with the following result:
>
>
>  svy, subpop(if p108_n<10):tab p108_n sexo , count nolabel format(%
> 11.1f)
> (running tabulate on estimation sample)
>
> Number of strata   =        11                  Number of obs
> =     12190
> Number of PSUs     =      1266                  Population size
> = 12189,962
>                                                 Subpop. no. of obs
> =     11733
>                                                 Subpop. size
> = 11834,102
>                                                 Design df
> =      1255
>
> ----------------------------------
>           |          sexo
>    p108_n |      1       2   Total
> ----------+-----------------------
>         1 |  638,8   708,1  1346,9
>         2 |  581,3   726,2  1307,5
>         3 | 1968,3  2144,6  4112,9
>         4 | 2215,6  1926,3  4141,9
>         5 |  404,2   520,7   924,9
>        10 |    0,0     0,0     0,0
>           |
>     Total | 5808,2  6025,9  11834,1
> ----------------------------------
>   Key:  weighted counts
>
>   Table contains a zero in the marginals.
>   Statistics cannot be computed.
>
>
> Is there any way to get the chi square test I need without deleting
> the p108_n==10 individuals, I mean, keeping them for the calculation
> of the standard errors?
>
> Many thanks.
>
> Ángel Rodríguez Laso
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```