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

  • Calculating unadjusted and adjusted risk differences using svy


    I am using Stata 12.1.
    I am analyzing DHS data using the svy command. I would like to calculate unadjusted and adjusted risk differences (rather than ORs or RRs). I've seen this done with the "binreg" command or using regress and then looking at the coefficients (

    However, these commands, as far as I am aware, as not possible using svy for survey data. Is there another way to perform these calculations and get these effect measures?

    Thank you in advance for any help you can provide me.


  • #2
    See the paper by Norton et al, in Stata Journal Vol 13 #3 and the adjrr package described there. It computes risk ratios and differences and accepts the svy prefix.
    Richard T. Campbell
    Emeritus Professor of Biostatistics and Sociology
    University of Illinois at Chicago


    • #3
      Also, you can emulate -binreg- by using -glm- with family(binomial) link(id), (In fact, -binreg- is a wrapper for -glm-.) And -svy:- does support -glm-.


      • #4
        Thanks so much for your response Richard and Clyde!!


        • #5
          Hi Clyde,

          I tried your approach and I think I'm doing something wrong or misinterpreting the data that I am getting.

          Here's my code and output for the general proportions of the groups I want to compare:

          svy, subpop(if women<5 & currentage<18): tab women newgenitalulc, row ci


          The medium size of these tables was excessively small so i made this large size - sorry they are so big here. As you can see the prevalence of genitalulcer is 1.26 is 1women group and 0.00048 in 0women group. A risk difference (in my head) of 1.259 or so.

          The reason I want to use risk difference in this case is that it seems more prudent -- an OR or RR in this case would be 20-30 but really the attributable risk is low, although significant.
          So then I did code using binomial and family to get the risk difference.

          HTML Code:
          svy, subpop(if women<5 & currentage<18): glm women newgenitalulc, family(binomial) link(identity) eform

          Click image for larger version

Name:	pic1.png
Views:	1
Size:	11.7 KB
ID:	1337594

          In this case the exp(b) does not equal the risk difference between the groups (1.96 here instead of ~1.25). If I remove eform it does not help either. Clearly I am missing somethinghere.

          I also tried Richard's method using the code:

          HTML Code:
          svy, subpop(if women<5 & currentage<18): logit women newgenitalulc
          . adjrr newgenitalulc

          but received this error: "missing predicted values encountered within the estimation sample"

          Do you possibly know what the problem is?



          • #6
            Your -glm- syntax is backwards. You are modeling the probability of being a woman conditional on genital ulcer. And, if you want risk difference, you do not want -eform-.

            So try:
            svy, subpop(if women<5 & currentage<18): glm newgenitalulc women, family(binomial) link(identity)
            Added: For several reasons, attaching pictures of Stata output is not very helpful (poor readability, the photo view obscures the post, can't copy/paste). The best way to show Stata output is to copy from Stata's Results window or your log file to your computer's clipboard and then paste into a code block in the Forum editor. If you don't know how to set up a code block, see FAQ #12 7th paragraph.
            Last edited by Clyde Schechter; 26 Apr 2016, 09:44.


            • #7
              Wow! That's silly! Works perfect now -- Thanks Clyde!