Announcement

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

  • Washington group on disability syntax

    Dear All,

    I would like to understand if the example code is inefficient, or I am missing some subtle point.
    Consider the following fragment of code shown in the "Analytic Guidelines: Creating Disability Identifiers Using the Washington Group Short Set on Functioning (WG-SS) Stata Syntax".

    Code:
    gen Hearing=HEAR_SS if inlist(HEAR_SS, 1, 2, 3, 4)
    replace Hearing=. if inlist(HEAR_SS, 7, 8, 9)
    tabulate Hearing
    Variable HEAR_SS is defined to have response categories: 1,2,3,4,7,8, and 9. (The same pattern is applied by the author(s) to other variables throughout the document, so it is probably intended to be done this way).

    When I look at this example, the second line (highlighted) appears redundant. By definition of how the generate command works we expect that for any value of variable HEAR_SS other than 1,2,3, and 4 we should get a dot (missing value) in the values of the generated variable Hearing. What is the rationale for including this into the guidelines?

    - is it a legacy from some earlier version of Stata that behaved differently?
    - is it somehow accounting for other values which may end up in the raw data files? (unlikely, I don't see how and I don't see why not write !inlist(1,2,3,4) there).
    - anything else?
    - or is it redundant and can be removed without any consequences?


    I'd opt for
    Code:
    gen byte Hearing=HEAR_SS if inlist(HEAR_SS, 1, 2, 3, 4)
    tabulate Hearing
    or for extra caution:
    Code:
    assert inlist(HEAR_SS,1,2,3,4,7,8,9)
    gen byte Hearing=HEAR_SS if inlist(HEAR_SS, 1, 2, 3, 4)
    tabulate Hearing


    Thank you,
    Sergiy Radyakin

  • #2
    A few pages below in the same document there is another fragment of the code that also appears inefficient to me:
    Code:
    gen SumPoints=0
    foreach v of var Vision Hearing Mobility Cognition Self_Care Communication {
      replace SumPoints=SumPoints + inlist(`v',2,3,4)
    }
    replace SumPoints=. if missing(Vision) & missing(Hearing) & ///
        missing(Mobility) & missing(Cognition) & missing(Self_Care) & missing(Communication)
    
    gen SUM_234=. if SumPoints==.
    replace SUM_234=1 if SumPoints==1
    replace SUM_234=2 if SumPoints==2
    replace SUM_234=3 if SumPoints==3
    replace SUM_234=4 if SumPoints==4
    replace SUM_234=5 if SumPoints==5
    replace SUM_234=6 if SumPoints==6
    replace SUM_234=0 if SumPoints==0
    
    tabulate SUM_234
    why not simply
    Code:
    ...
    gen SUM_234=SumPoints
    tabulate SUM_234
    I am also not sure about the logic here. Why if all six variables have missing values the result has to be missing, but if five out of six are missing, their missingness is ignored and they are imputed as zeros??

    Thank you, Sergiy Radyakin

    Comment


    • #3
      There is a further contradiction of the code to the description of the indicator in the text of the document:

      Possible range 0: no difficulties in any domain, to 6: all six domains coded SOME DIFFICULTY (2) or A LOT OF DIFFICULTY (3) or CANNOT DO AT ALL (4).

      MISSING (9) are those who have coded 7, 8 or 9 on all six domains.
      The code does not yield any '9' value in this case, though it does result in a missing value.

      Comment


      • #4
        I notice that the purported output of the tabulate command presented in the reference document does not look like the output of the tabulate

        Click image for larger version

Name:	example.png
Views:	1
Size:	205.5 KB
ID:	1678792

        Comment


        • #5
          William Lisowski , true, this looks more like the output of the -fre- command by Ben Jann.

          Elsewhere in the document they write "*Weighted estimate provided – but is not part of the Stata syntax" so I think the tables shown are not output of Stata shown verbatim.

          Comment


          • #6
            One could argue that

            Code:
            gen Hearing=HEAR_SS if inlist(HEAR_SS, 1, 2, 3, 4)
            replace Hearing=. if inlist(HEAR_SS, 7, 8, 9)
            is more explicit and perhaps easier to understand, i.e., requires slightly less familiarity with Stata than

            Code:
            gen Hearing=HEAR_SS if inlist(HEAR_SS, 1, 2, 3, 4)
            More likely: the people who wrote the code are not exactly experts in Stata and have not given much thought to efficient syntax beyond certifying correct results.

            Comment


            • #7
              I'm thinking the suggested code should be taken as illustrative pseudo-Stata code rather than definitive Stata code to be copied and pasted.

              Comment


              • #8
                Originally posted by daniel klein View Post

                is more explicit and perhaps easier to understand...
                ...the people who wrote the code are not exactly experts in Stata and have not given much thought to efficient syntax ...
                Dear Daniel, thank you very much for sharing your thoughts. This is the conclusion I was gravitating to, but wanted to confirm that there is no obscure case (combination of inputs) that is accounted for by this code and escapes a simpler version.

                By going through the other docs on the same site, I see pretty same picture throughout, as in
                "Creating Disability Severity Indicators Using the WG Short Set on Functioning (WG-SS) (Stata)"
                the following code looks like some clumsy way to simulate Stata's rowmax() function in egen:
                Code:
                gen SSHD=0
                replace SSHD = . if VIS_SS==. & HEAR_SS ==. & MOB_SS ==. & COM_SS==. & UB_SS==. & COG_SS==.
                replace SSHD = 2 if VIS_SS==2 | HEAR_SS ==2 | MOB_SS ==2 | COM_SS==2 | UB_SS==2 | COG_SS==2
                replace SSHD = 3 if VIS_SS==3 | HEAR_SS ==3 | MOB_SS ==3 | COM_SS==3 | UB_SS==3 | COG_SS==3
                replace SSHD = 4 if VIS_SS==4 | HEAR_SS ==4 | MOB_SS ==4 | COM_SS==4 | UB_SS==4 | COG_SS==4
                replace SSHD = 1 if SSHD ==0
                Best, Sergiy Radyakin

                Comment


                • #9
                  They also provide SPSS syntax (https://www.washingtongroup-disabili...-ES__SPSS_.pdf). I guess you rarely find people who are proficient in more than one major statistical package and are interested in designing survey questionnaires to measure disability.

                  Comment


                  • #10
                    True, and they also provide equivalent documents for SAS and CSPro users, which makes an overlap practically zero. But why not hire 4 different professionals, one in each statistical package and let them port the same abstract idea to their respective package? It doesn't have to be one person mastering all of these languages.

                    Comment


                    • #11
                      But why not hire 4 different professionals, one in each statistical package and let them port the same abstract idea to their respective package? It doesn't have to be one person mastering all of these languages.
                      Perhaps because hiring four professionals costs money, and the Washington Group is a small organization, which does not suggest a dedicated source of ample funding in the way that those of us who work, or have worked, in larger governmental and non-governmental organizations are used to, and consequently the code was not written by a professional programmer.

                      Or perhaps because the sample code was not anticipated as part of the planning process, but was added in response to an external reviewer's insistence, with no budgeted funds available for four professional programmers.

                      Or perhaps because that's the way things are always done: I can't count the number of instruction documents I have read that were written in something other than English and translated to English without the benefit of review by a native speaker of English. And I'm certain that's equally true of documents written in English and translated to other languages by someone who had two years of instruction in the language in high school.

                      Remember that the objective of the Washington Group was to create and disseminate standardized questionnaires.

                      Comment

                      Working...
                      X