Announcement

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

  • Can’t get a p-value with SVY

    Hello,

    I’m running some Chi2 test with weighted ACS data but when I run the pearson test I don’t get a p-value. Anyone else having this problem? Am I doing something wrong?

    Output

    . svy: tab employed female if disability==1, col pearson
    (running tabulate on estimation sample)

    Number of obs = 4,027
    Population size = 421,744
    Replications = 80

    -------------------------------
    RECODE of | RECODE of sex (SEX)
    esr (ESR) | 0 1 Total
    ----------+--------------------
    0 | .6829 .6695 .6761
    1 | .3171 .3305 .3239
    |
    Total | 1 1 1
    -------------------------------
    Key: column proportion

    Pearson:
    Uncorrected chi2(1) = 0.8295

    .
    end of do-file
    Last edited by Jen Brooks; 30 Jul 2022, 10:18.

  • #2
    Jen:
    welcome to this forum.
    Actually, Stata seems to give back the p-value for the Design-based Pearson test only:
    Code:
    use https://www.stata-press.com/data/r17/nhanes2.dta
    . svy: tab houssiz sex if race ==1, col pearson
    (running tabulate on estimation sample)
    
    Number of strata = 31                            Number of obs   =       9,065
    Number of PSUs   = 62                            Population size = 102,999,549
                                                     Design df       =          31
    
    -------------------------------------
    Number of |
    people in |            Sex           
    household |    Male   Female    Total
    ----------+--------------------------
            1 |   .1285    .1584    .1441
            2 |   .2961    .2982    .2972
            3 |   .1893    .1862    .1877
            4 |   .2032    .1804    .1914
            5 |   .1029    .1017    .1023
            6 |   .0472    .0432    .0452
            7 |   .0227     .019    .0208
            8 |    .005    .0069     .006
            9 |   .0039    .0029    .0034
           10 | 4.4e-04    .0013  8.8e-04
           11 | 4.4e-04  1.9e-04  3.1e-04
           12 |       0    .0011  5.5e-04
           13 | 5.8e-05  3.6e-04  2.2e-04
           14 | 2.0e-04        0  9.8e-05
              | 
        Total |       1        1        1
    -------------------------------------
    Key: Column proportion
    
      Pearson:
        Uncorrected   chi2(13)        =   33.6073
        Design-based  F(8.34, 258.44) =    2.2233     P = 0.0243
    
    . ereturn list
    
    scalars:
                   e(df_r) =  31
          e(N_strata_omit) =  0
              e(singleton) =  0
                 e(census) =  0
                 e(stages) =  1
               e(cun_Penl) =  33.60733785429137
                 e(F_Penl) =  2.148822234417541
               e(df1_Penl) =  8.775157075049131
               e(df2_Penl) =  272.0298693265231
                 e(p_Penl) =  .0270691984810268
               e(cun_Pear) =  33.60733785429137
                 e(F_Pear) =  2.223277741548805
               e(df1_Pear) =  8.336802397765183
               e(df2_Pear) =  258.4408743307207
                      e(N) =  9065
               e(N_strata) =  31
                  e(N_psu) =  62
                  e(N_pop) =  102999549
                   e(rank) =  25
                e(cvgdeff) =  .6938695576311746
                 e(mgdeff) =  1.203068263879086
                  e(total) =  102999549
                      e(c) =  2
                      e(r) =  14
                e(pun_LLW) =  .
                e(Fun_LLW) =  .
                  e(p_LLW) =  .
                  e(F_LLW) =  .
                e(cun_LLW) =  .
                   e(p_LR) =  .
                 e(df2_LR) =  258.4408743307207
                 e(df1_LR) =  8.336802397765183
                   e(F_LR) =  .
                 e(cun_LR) =  .
                 e(p_LRnl) =  .
               e(df2_LRnl) =  272.0298693265231
               e(df1_LRnl) =  8.775157075049131
                 e(F_LRnl) =  .
               e(cun_LRnl) =  .
                 e(p_Pear) =  .0243278991288622
    That said:
    1) -ereturn- is an useful command to retrieve Stata results that are not displayed in the outcome tables;
    2) whenever Stata does not allow researchers to do a given statistical procedure/return a given result, there are sound methodological reasons for that.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Thanks for your help. I followed your suggestion but Stata will not produce a Design-based Pearson test. Any thoughts on why? I’ll do some more research myself.


      .
      . svy: tab lfp disability, col pearson
      (running tabulate on estimation sample)

      Number of obs = 47,182
      Population size = 5,527,953
      Replications = 80

      -------------------------------
      RECODE of | RECODE of disall
      esr (ESR) | 0 1 Total
      ----------+--------------------
      0 | .2178 .6307 .2493
      1 | .7822 .3693 .7507
      |
      Total | 1 1 1
      -------------------------------
      Key: column proportion

      Pearson:
      Uncorrected chi2(1) = 3028.8469

      . ereturn list

      scalars:
      e(N_strata_omit) = 0
      e(singleton) = 0
      e(census) = 0
      e(stages) = 1
      e(N_reps) = 80
      e(N_misreps) = 0
      e(k_exp) = 0
      e(k_eexp) = 4
      e(k_extra) = 0
      e(cun_Penl) = 3028.846891525951
      e(cun_Pear) = 3028.846891525951
      e(cun_LRnl) = 2566.433340678475
      e(cun_LR) = 2566.433340678475
      e(cun_LLW) = 1793.301345060757
      e(N) = 47182
      e(N_strata) = .
      e(N_pop) = 5527953
      e(rank) = 4
      e(cvgdeff) = 0
      e(mgdeff) = 2.567150308285274
      e(total) = 5527953
      e(c) = 2
      e(r) = 2
      e(N_psu) = .

      Comment


      • #4
        Jen:
        in your case -ereturn- does not report degrees of freedom, hence p-value cannot be calculated (why this happens I do not know).
        In addition, I was wrong, because -ereturn- (in my example, though) does report the p-value for the Uncorrected Pearson's test:
        :
        Code:
         e(p_Penl) =  .0270691984810268
        Sorry that I cannot be more helpful.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Can you use method #3 of https://stats.oarc.ucla.edu/stata/fa...th-survey-data instead of a chi-square test?
          David Radwin
          Senior Researcher, California Competes
          californiacompetes.org
          Pronouns: He/Him

          Comment

          Working...
          X