Announcement

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

  • comparing prevalence bwteen quartiles

    Dear all,
    I have a continuous variable X that i categorized into 4 quartiles (1,2,3 and 4). i also have a binary variable Y (1=obese, 0=normal-weight). i can see from the tab command that obesity prevalence is lower in quartile 4 as compared to quartile 1 (table below). How do i go to test the prevalence of obesity between the quartiles or at least between Q1 and Q4.

    Thanks in advance

    Stat 15.1 Mac
    Attached Files
    Last edited by abdelilah arredouani; 03 Mar 2020, 07:31.

  • #2
    Abdelilah:
    see Example 5 under -qreg- entry in Stata .pdf manual.
    Kind regards,
    Carlo
    (StataNow 19.0)

    Comment


    • #3
      I just want to compare proportions between quartiles. i can't figure it out from the manual Carlo suggested. or maybe i am on the wrong track
      Last edited by abdelilah arredouani; 03 Mar 2020, 07:58.

      Comment


      • #4
        Abdelilah:
        if you use your original (ie, continuous) X variable, you can do something along the following lines:
        Code:
        use https://www.stata-press.com/data/r16/auto, clear
        . sqreg price foreign, q(.25 .5 .75) reps(100)
        (fitting base model)
        
        Bootstrap replications (100)
        ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
        ..................................................    50
        ..................................................   100
        
        Simultaneous quantile regression                    Number of obs =         74
          bootstrap(100) SEs                                .25 Pseudo R2 =     0.0063
                                                            .50 Pseudo R2 =     0.0219
                                                            .75 Pseudo R2 =     0.0118
        
        ------------------------------------------------------------------------------
                     |              Bootstrap
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        q25          |
             foreign |        312   423.0919     0.74   0.463    -531.4184    1155.418
               _cons |       4187   135.4454    30.91   0.000     3916.995    4457.005
        -------------+----------------------------------------------------------------
        q50          |
             foreign |        983   611.1209     1.61   0.112    -235.2473    2201.247
               _cons |       4816   230.1752    20.92   0.000     4357.154    5274.846
        -------------+----------------------------------------------------------------
        q75          |
             foreign |        975    1673.69     0.58   0.562    -2361.439    4311.439
               _cons |       6165   993.2648     6.21   0.000     4184.963    8145.037
        ------------------------------------------------------------------------------
        
        . test [q25]foreign = [q75]foreign
        
         ( 1)  [q25]foreign - [q75]foreign = 0
        
               F(  1,    72) =    0.16
                    Prob > F =    0.6920
        
        . lincom [q25]foreign - [q75]foreign
        
         ( 1)  [q25]foreign - [q75]foreign = 0
        
        ------------------------------------------------------------------------------
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 (1) |       -663   1666.858    -0.40   0.692     -3985.82     2659.82
        ------------------------------------------------------------------------------
        
        .
        Kind regards,
        Carlo
        (StataNow 19.0)

        Comment


        • #5
          that is complicated. What about prtest. it only works with 2 categories. is it possible to select Q1 and Q4 in prtest?

          Comment


          • #6
            Arguably a chi-square test ignores the ordering of your predictor's bins, but it surely qualifies as simple: Other tests respect the ordering.


            Code:
            . tabi 17 51 \ 21 38 \ 23 51 \ 42 24
            
                       |          col
                   row |         1          2 |     Total
            -----------+----------------------+----------
                     1 |        17         51 |        68 
                     2 |        21         38 |        59 
                     3 |        23         51 |        74 
                     4 |        42         24 |        66 
            -----------+----------------------+----------
                 Total |       103        164 |       267 
            
                      Pearson chi2(3) =  24.7579   Pr = 0.000
            
            . ret li
            
            scalars:
                              r(p) =  .0000173486835944
                           r(chi2) =  24.75792545374551
                              r(c) =  2
                              r(r) =  4
                              r(N) =  267

            Comment

            Working...
            X