Announcement

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

  • How to obtain cumulative frequencies with the command "svy" ?

    Hello everyone,
    Does anyone knows how can I add the proportions up to the point they sum to 1 please, which obtained through the command:


    Code:
    svy,subpop(c'i'):prop k_uebertritt2
    Basically, I want to obtain cumulative frequencies in order to plot them afterwards in a twoway graph bar.
    Thanks in advance!

    Michael

  • #2
    The command to use would be -tab-, with the survey prefix there is also an option for confidence intervals. I am not at my computer and I can't quite recall if it will give cumulative frequencies/proportions or if you need to derive them with its output. Therefore, I suggest to give -help svy tab- a close read. Then again, these are usually less interesting than group-specific frequencies/proportions.

    Comment


    • #3
      If you'd rather convert percentages to proportions than calculate cumulative frequencies, and you aren't plotting confidence intervals or other measures of variance, you can get cumulative percentages using aweights like the final command below:
      Code:
      . webuse nhanes2
      
      . svyset
      
      Sampling weights: finalwgt
                   VCE: linearized
           Single unit: missing
              Strata 1: strata
       Sampling unit 1: psu
                 FPC 1: <zero>
      
      . svy: tab race
      (running tabulate on estimation sample)
      
      Number of strata = 31                            Number of obs   =      10,351
      Number of PSUs   = 62                            Population size = 117,157,513
                                                       Design df       =          31
      
      ----------------------
           Race | proportion
      ----------+-----------
          White |      .8792
          Black |      .0955
          Other |      .0253
                | 
          Total |          1
      ----------------------
      Key: proportion = Cell proportion
      
      . tab race [aweight=finalwgt]
      
             Race |      Freq.     Percent        Cum.
      ------------+-----------------------------------
            White |9,100.12772       87.92       87.92
            Black | 988.581772        9.55       97.47
            Other | 262.290507        2.53      100.00
      ------------+-----------------------------------
            Total |     10,351      100.00
      David Radwin
      Senior Researcher, California Competes
      californiacompetes.org
      Pronouns: He/Him

      Comment


      • #4
        Hello David,

        Thanks for the suggestion. Very interesting in fact.

        Michael

        Comment

        Working...
        X