Announcement

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

  • #16
    Originally posted by Siluleko Mkhize View Post
    Or rather compare the three proportions within the male category and then the female category
    Maybe I didn't communicate my objective clearly. I wish to do a within-group comparison of food security, such that I can generate a P-value comparing food security within males and another P-value within females.

    Comment


    • #17
      For a bivariate analysis here, I would prefer -somersd-, available at SSC, as it respects the ordered and categorical character of your outcome, and is asymmetric, distinguishing outcomes from predictors. Its syntax presumes that the first variable listed is the outcome, unlike some other Stata commands.
      Code:
      somersd Sex Hunger_cat if (AGE_VQ_P >=20)

      Comment


      • #18
        Originally posted by Siluleko Mkhize View Post
        I wish to do a within-group comparison of food security, such that I can generate a P-value comparing food security within males and another P-value within females.
        Following up on Carlo's suggestion in #5, perhaps you can use the following to construct two omnibus tests, one for men and another for women. Each two-degree-of-freedom test would be across all three categories at once within a given sex.

        .ÿ
        .ÿversionÿ16.0

        .ÿ
        .ÿclearÿ*

        .ÿ
        .ÿinputÿbyteÿsexÿint(count0ÿcount1ÿcount2)

        ÿÿÿÿÿÿÿÿÿÿsexÿÿÿÿcount0ÿÿÿÿcount1ÿÿÿÿcount2
        ÿÿ1.ÿ0ÿ1930ÿ1457ÿ2682
        ÿÿ2.ÿ1ÿ1119ÿÿ960ÿ1840
        ÿÿ3.ÿend

        .ÿ
        .ÿquietlyÿreshapeÿlongÿcount,ÿi(sex)ÿj(grp)

        .ÿ
        .ÿmlogitÿgrpÿi.sexÿ[fweight=count],ÿnolog

        MultinomialÿlogisticÿregressionÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿ9,988
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿLRÿchi2(2)ÿÿÿÿÿÿÿÿ=ÿÿÿÿÿÿ12.52
        ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿProbÿ>ÿchi2ÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0019
        Logÿlikelihoodÿ=ÿ-10624.342ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿPseudoÿR2ÿÿÿÿÿÿÿÿÿ=ÿÿÿÿÿ0.0006

        ------------------------------------------------------------------------------
        ÿÿÿÿÿÿÿÿÿgrpÿ|ÿÿÿÿÿÿCoef.ÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
        -------------+----------------------------------------------------------------
        0ÿÿÿÿÿÿÿÿÿÿÿÿ|
        ÿÿÿÿÿÿÿ1.sexÿ|ÿÿ-.1682874ÿÿÿ.0482506ÿÿÿÿ-3.49ÿÿÿ0.000ÿÿÿÿ-.2628569ÿÿÿ-.0737178
        ÿÿÿÿÿÿÿ_consÿ|ÿÿ-.3290428ÿÿÿ.0298495ÿÿÿ-11.02ÿÿÿ0.000ÿÿÿÿ-.3875467ÿÿÿ-.2705389
        -------------+----------------------------------------------------------------
        1ÿÿÿÿÿÿÿÿÿÿÿÿ|
        ÿÿÿÿÿÿÿ1.sexÿ|ÿÿ-.0404043ÿÿÿ.0514232ÿÿÿÿ-0.79ÿÿÿ0.432ÿÿÿÿ-.1411919ÿÿÿÿ.0603833
        ÿÿÿÿÿÿÿ_consÿ|ÿÿ-.6101833ÿÿÿ.0325453ÿÿÿ-18.75ÿÿÿ0.000ÿÿÿÿ-.6739709ÿÿÿ-.5463956
        -------------+----------------------------------------------------------------
        2ÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿ(baseÿoutcome)
        ------------------------------------------------------------------------------

        .ÿ
        .ÿmarginsÿsex,ÿpost

        AdjustedÿpredictionsÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿÿÿÿÿ=ÿÿÿÿÿÿ9,988
        ModelÿVCEÿÿÿÿ:ÿOIM

        1._predictÿÿÿ:ÿPr(grp==0),ÿpredict(prÿoutcome(0))
        2._predictÿÿÿ:ÿPr(grp==1),ÿpredict(prÿoutcome(1))
        3._predictÿÿÿ:ÿPr(grp==2),ÿpredict(prÿoutcome(2))

        ------------------------------------------------------------------------------
        ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿDelta-method
        ÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿMarginÿÿÿStd.ÿErr.ÿÿÿÿÿÿzÿÿÿÿP>|z|ÿÿÿÿÿ[95%ÿConf.ÿInterval]
        -------------+----------------------------------------------------------------
        _predict#sexÿ|
        ÿÿÿÿÿÿÿÿ1ÿ0ÿÿ|ÿÿÿ.3180096ÿÿÿ.0059779ÿÿÿÿ53.20ÿÿÿ0.000ÿÿÿÿÿÿ.306293ÿÿÿÿ.3297261
        ÿÿÿÿÿÿÿÿ1ÿ1ÿÿ|ÿÿÿÿ.285532ÿÿÿ.0072149ÿÿÿÿ39.58ÿÿÿ0.000ÿÿÿÿÿ.2713911ÿÿÿÿÿ.299673
        ÿÿÿÿÿÿÿÿ2ÿ0ÿÿ|ÿÿÿ.2400725ÿÿÿ.0054828ÿÿÿÿ43.79ÿÿÿ0.000ÿÿÿÿÿ.2293265ÿÿÿÿ.2508185
        ÿÿÿÿÿÿÿÿ2ÿ1ÿÿ|ÿÿÿ.2449604ÿÿÿ.0068698ÿÿÿÿ35.66ÿÿÿ0.000ÿÿÿÿÿ.2314959ÿÿÿÿÿ.258425
        ÿÿÿÿÿÿÿÿ3ÿ0ÿÿ|ÿÿÿ.4419179ÿÿÿ.0063747ÿÿÿÿ69.32ÿÿÿ0.000ÿÿÿÿÿ.4294237ÿÿÿÿ.4544122
        ÿÿÿÿÿÿÿÿ3ÿ1ÿÿ|ÿÿÿ.4695075ÿÿÿ.0079721ÿÿÿÿ58.89ÿÿÿ0.000ÿÿÿÿÿ.4538825ÿÿÿÿ.4851326
        ------------------------------------------------------------------------------

        .ÿ
        .ÿ//ÿWomen
        .ÿtestÿ1._predict#0.sexÿ=ÿ2._predict#0.sex,ÿnotest

        ÿ(ÿ1)ÿÿ1bn._predict#0bn.sexÿ-ÿ2._predict#0bn.sexÿ=ÿ0

        .ÿtestÿ1._predict#0.sexÿ=ÿ3._predict#0.sex,ÿaccumulate

        ÿ(ÿ1)ÿÿ1bn._predict#0bn.sexÿ-ÿ2._predict#0bn.sexÿ=ÿ0
        ÿ(ÿ2)ÿÿ1bn._predict#0bn.sexÿ-ÿ3._predict#0bn.sexÿ=ÿ0

        ÿÿÿÿÿÿÿÿÿÿÿchi2(ÿÿ2)ÿ=ÿÿ386.28
        ÿÿÿÿÿÿÿÿÿProbÿ>ÿchi2ÿ=ÿÿÿÿ0.0000

        .ÿ
        .ÿ//ÿMen
        .ÿtestÿ1._predict#1.sexÿ=ÿ2._predict#1.sex,ÿnotest

        ÿ(ÿ1)ÿÿ1bn._predict#1.sexÿ-ÿ2._predict#1.sexÿ=ÿ0

        .ÿtestÿ1._predict#1.sexÿ=ÿ3._predict#1.sex,ÿaccumulate

        ÿ(ÿ1)ÿÿ1bn._predict#1.sexÿ-ÿ2._predict#1.sexÿ=ÿ0
        ÿ(ÿ2)ÿÿ1bn._predict#1.sexÿ-ÿ3._predict#1.sexÿ=ÿ0

        ÿÿÿÿÿÿÿÿÿÿÿchi2(ÿÿ2)ÿ=ÿÿ311.09
        ÿÿÿÿÿÿÿÿÿProbÿ>ÿchi2ÿ=ÿÿÿÿ0.0000

        .ÿ
        .ÿexit

        endÿofÿdo-file


        .

        Comment


        • #19
          Originally posted by Siluleko Mkhize View Post
          Or rather compare the three proportions within the male category and then the female category
          Maybe I didn't communicate my objective clearly. I wish to do a within-group comparison of food security, such that I can generate a P-value comparing food security within males and another P-value within females.

          Comment


          • #20
            Siluleko:
            you may want something along the following lines:
            Code:
            g Food_security=0 in 1/47
            replace Food_security=1 in 48/72
            replace Food_security=2 in 73/100
            replace Food_security=0 in 101/144
            replace Food_security=1 in 145/168
            replace Food_security=2 in 169/200
            label define Food_security 0 "Food secure" 1 "At risk of hunger" 2 "Starvation"
            label val Food_security Food_security
            mlogit Food_security i.Gender
            Iteration 0:   log likelihood = -212.81539 
            Iteration 1:   log likelihood = -212.62236 
            Iteration 2:   log likelihood = -212.62229 
            Iteration 3:   log likelihood = -212.62229 
            
            Multinomial logistic regression                 Number of obs     =        200
                                                            LR chi2(2)        =       0.39
                                                            Prob > chi2       =     0.8244
            Log likelihood = -212.62229                     Pseudo R2         =     0.0009
            
            -----------------------------------------------------------------------------------
                Food_security |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
            ------------------+----------------------------------------------------------------
            Food_secure       |  (base outcome)
            ------------------+----------------------------------------------------------------
            At_risk_of_hunger |
                       Gender |
                      Female  |    .025136   .3545004     0.07   0.943     -.669672     .719944
                        _cons |  -.6312718   .2475411    -2.55   0.011    -1.116443   -.1461001
            ------------------+----------------------------------------------------------------
            
            *Between strata comparison - Female*
            . test [Starvation]1.Gender=[At_risk_of_hunger]1.Gender=[Food_secure]1.Gender
            
             ( 1)  - [At_risk_of_hunger]1.Gender + [Starvation]1.Gender = 0
             ( 2)  - [Food_secure]1o.Gender + [Starvation]1.Gender = 0
            
                       chi2(  2) =    0.39
                     Prob > chi2 =    0.8247
            
             *Between strata comparison - Male*
            . test [Starvation]_cons=[At_risk_of_hunger]_cons=[Food_secure]0.Gender
            
             ( 1)  - [At_risk_of_hunger]_cons + [Starvation]_cons = 0
             ( 2)  - [Food_secure]0b.Gender + [Starvation]_cons = 0
            
                       chi2(  2) =    8.30
                     Prob > chi2 =    0.0157
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment

            Working...
            X