Announcement

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

  • prtest + svy

    Hello,

    I am having some trouble weighting prtest, it seems it is incompatible with svy. Basically, I am trying to obtain a confidence interval for the difference proportions of an indicator across highest and lowest wealth quantiles which prtest can do quite well if only I could find a way to add in the weight. Any suggestions on how to use prtest with weights, or another method through which to find this CI.

    Thank you!

  • #2
    Welcome to Statalist, Anushka! Please note the strong preference for full real names (FAQ 6 http://www.statalist.org/forums/help). With survey data, tests and standard errors depend on the entire survey design: weights, strata (if any), and primarily on variation between "primary sampling units". Please svyset your data, then post again and show us the prtest statement that you'd like to emulate (FAQ 12).
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment


    • #3
      Hello Steve,

      Thank you for your speedy response. I am very new to the forums so forgive me, I'm still learning the rules.

      I am using Stata 13.1 and I am trying to run this code

      prtest anc4 if (NEIIq!=2 & NEIIq!=3 & NEIIq!=4 & NEIIq!=.) , by(NEIIq)

      however, with weights. I have svyset my data and I have tried

      svy: prtest anc4 if (NEIIq!=2 & NEIIq!=3 & NEIIq!=4 & NEIIq!=.) , by(NEIIq)

      however, it does not seem to work.

      Please let me know if you need further information.

      Thank you!

      Comment


      • #4
        Perhaps you can use the proportion command instead. See example 1 of http://www.stata.com/manuals13/rprop...postestimation
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          Thank yo for re-registering with your full name, Anushka. To see the commands that are compatible with a svy: prefix, type "help svy estimation". Because you are ignoring NEllq categories 2, 3, and 4, I'll assume that you want to compare categories 1 and 5. If not, modify the commands below appropriately. Then the commands which will do this are svy: proportion, as Richard suggested, followed by lincom:
          Code:
          svy, subpop(if inlist(NEllq,1,5): prop anc4, over(NEllq) nolabel
          lincom _b[_prop_2:5] -_b[_prop_2:1]
          You may choose, instead, this lincom, which will give the same value of the difference, but with the opposite sign.
          Code:
          lincom _b[_prop_1:5] -_b[_prop_1:1]
          It is the nolabel option in svy: prop which allows you to refer to _prop_2 or _prop_1 in the lincom statement. Note the inlist() function, which saves a lot of typing. The subpop() option is explained in the Survey Data Manual chapter on "subpopulation estimation. For future posts, FAQ section 12 will tell you how to format commands and results with CODE, as I've done: http://www.statalist.org/forums/help
          Steve Samuels
          Statistical Consulting
          [email protected]

          Stata 14.2

          Comment


          • #6
            Thank you both for your help, it worked. Much appreciated!

            Comment


            • #7
              Hello,
              I am new to the list as well so forgive me if there is any misunderstandings etc.

              I was trying to search what is the code - and especially the sections prop_2:5 and prop_2:1 - referring to in SteveĀ“s answer above:
              Code:
              lincom _b[_prop_2:5] - _b[_prop_2:1)
              What are prop_2:5 and prop_2:1 referring to? I am currently working with the same kind of problem so any help would be greatly appreciated! I hope my question was explicit.

              Thank you!

              Comment


              • #8
                When in doubt, I like to use the coeflegend option to see the names of parameters, e.g.

                Code:
                webuse nhanes2f, clear
                svy: prop health, over(female)
                svy: prop health, over(female) coefl
                You can then use those names in lincom or test commands.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                Stata Version: 17.0 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment

                Working...
                X