Announcement

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

  • Difference in mean with Survey data

    I am fairly new to Stata so some of my questions may be pretty basic, but I appreciate any help I can get. An example of my data is below
    wage survey weights constant sex
    32 14 .56 1
    56 45 .96 1
    77 88 .25 0
    I have survey data and I am trying to bootstrap the difference in mean wages for women ONLY. I want to find out the difference in mean outcome with [survey weights] and with [survey weights * constant] that is

    Manual calculation:

    Code:
    mean x [pw=hhwt] if sex==1
    mat x1=e(b)
    mean x [pw=wt*constant] if sex==1
    mat x2=e(b)
    mat dd=x1-x2
    
    **my outcome of interest is the point estimate and bootstrapped SE of DD
    I have written the following program, but I am not getting the results I want. In particular, my SE column turns up blank and my point estimates for the means and the difference in means do not match with what I get with manual calculation.

    Code:
    program define meandiff, eclass properties (svyb)
    args vars
    
    means 'vars'
    mat x1=e(b)
    mean `vars' [pw=constant]
    
    mat dd=x1-x2
    
    ereturn scalar diff=el(dd,1,1)
    
    end
    
    local vars wage
    
    svy bootstrap e(diff), subpop(sex): mean `vars'
    I have already svyset my data using bootstrap weights. My questions are as follows:
    1. When I type svy: mean 'vars' the program seems to start running bootstrap replications, and when I type svy bootstrap: means `vars' also the program seems to start replications. What is the difference between the two commands?
    2. When I do mean x with regular survey weights do I need to do [pw=wt] or will svy command automatically apply the survey weights?
    3. If I do have to write [pw=wt] in the first mean then do I need to create a variable called, say,gen wtxcons = wt * constant to do [pw=wtxcons] when I calculate the second mean?
    4. How do I calculate the bootstrap SE and point estimates for my outcome of interest, which is the difference in means. Why are my point estimates not matching my manual calculation?
    Also posted on http://stackoverflow.com/questions/3...th-survey-data
    Last edited by Fatima Alvi; 19 Sep 2015, 17:57.

  • #2
    Previously posted on Stack Overflow at http://stackoverflow.com/questions/3...th-survey-data.
    Last edited by William Lisowski; 19 Sep 2015, 18:33.

    Comment


    • #3
      I just wanted to revive this thread. Hoping someone has some comments on what I am trying to do. I really appreciate any feedback on this.

      Comment


      • #4
        See http://statistics.ats.ucla.edu/stat/...q/svyttest.htm .
        David Radwin
        Senior Researcher, California Competes
        californiacompetes.org
        Pronouns: He/Him

        Comment

        Working...
        X