Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Re: svy, subpop ( ): tab a b, obs Pearson failed to calculate Chi-square statistic

    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 = .


  • #2
    -tab- is not one of the "estimation" commands allowed with -svy-; see
    Code:
    help svy_estimation
    for what is allowed

    maybe if you tell us more, a positive response can be provided

    Comment


    • #3
      Thank you, Rich. But, tab is allowed with svy. Here is link: https://www.stata.com/manuals14/svys...latetwoway.pdf.
      If I use "svy: tab a b if a < 3, pearson" it works, but the SE is not the same with using subpop() according to the link stata.com/support/faqs/statistics/subpopulation-estimation/
      Looking forward your response.

      Comment

      Working...
      X