Announcement

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

  • Stata unable to calculate 95%CI and p-value with weighed analysis

    Hello,

    We are currently analysing binge drinking consumption in a specific population (communaute==1) according to sex (v1). The unweighed analysis produces results (see below), however, the weighed chi2 test does not produce 95%CI nor a p-value (see second table).



    tab binge_drinking v1 if communaute==1, chi2 row

    +----------------+
    | Key |
    |----------------|
    | frequency |
    | row percentage |
    +----------------+

    Bingedrinking |
    | sexe
    | Boys Girls | Total
    ----------------------+----------------------+----------
    No binge drinking | 145 175 | 320
    | 45.31 54.69 | 100.00
    ----------------------+----------------------+----------
    Binge drinking | 30 11 | 41
    | 73.17 26.83 | 100.00
    ----------------------+----------------------+---------
    Total | 175 186 | 361
    | 48.48 51.52 | 100.00

    Pearson chi2(1) = 11.2927 Pr = 0.001


    ***Weighed anlysis

    svy, subpop (if communaute==1) : tab binge_drinking v1 , percent ci row
    (running tabulate on estimation sample)

    Number of strata = 1 Number of obs = 361
    Number of PSUs = 9 Population size = 2,270.4188
    Subpop. no. obs = 361
    Subpop. size = 2,270.4188
    Design df = 8

    -------------------------------------------------------
    Binge drinking
    |
    | sexe
    | Boys Girls Total
    ----------+--------------------------------------------
    no binge | 43.73 56.27 100
    | [43.73,43.73] [56.27,56.27]
    |
    Binge dr | 72.75 27.25 100
    | [72.75,72.75] [27.25,27.25]
    |
    Total | 46.6 53.4 100
    | [46.6,46.6] [53.4,53.4]
    -------------------------------------------------------
    Key: Row percentage
    [95% confidence interval for row percentage]

    Pearson:
    Uncorrected chi2(1) = 10.8840
    Design-based F(., .) = . P = .


    We've looked at the weights but they seem fine. We've tried to do this analysis for other variables with similar population numbers and weights and it works. Any ideas why we're having this issue only for one variable and how to resolve it ?
    Many thanks,
    Emma Holmberg
    Last edited by Emma holmberg; 28 Aug 2023, 08:10.

  • #2
    This may be useful, or not.
    HTML Code:
    https://www.stata.com/statalist/archive/2012-09/msg00785.html
    why not try

    tab binge_drinking v1 if communaute==1 [aw=surveyweight], chi2 row

    to see if that works.

    Comment


    • #3
      Thank you for your response. We tried the command but we get the following message: "chi2 not allowed with aweights". Any other suggestions ?

      Comment


      • #4
        only frequency weights are allowed with tab2 (which you are using). are these frequency weights? what's your svyset line?

        Comment

        Working...
        X