Announcement

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

  • How to obtain standard error of mean from SVY: MEAN

    Hello,

    The question: Is it true that calculating the square root of the variance-covariance matrix after using (i) svy: mean, and (ii) matrix V= e(V) provides the standard error of the mean (SEM) not the standard deviation? I think my question has to do just as much with the statistics of if the square root of the variance-covariance matrix=SEM, I also wanted to know from you all if STATA's matrix V = e(V) in fact provides the square of the SEM or something else. I appreciate your time and help! Thank you so much

    For context:

    The dataset: I'm using two sample clustered (non-longitudinal) survey data.


    Code:
     foreach v of varlist married school_v2 electricity fridge {
            svy: mean `v', over(source) 
            matrix means =  e(b)
            matrix list means
            svmat means
            rename means* `v'_means*
            
            replace `v'_means1 = (`v'_means1)*100
            replace `v'_means2 = (`v'_means2)*100
            replace `v'_means3 = (`v'_means3)*100
            replace `v'_means4 = (`v'_means4)*100
            replace `v'_means5 = (`v'_means5)*100
            replace `v'_means6 = (`v'_means6)*100
            
            matrix V = e(V)           // <- gets the variance-covariance matrix
            matrix Var = vecdiag(V)     // <- gets the diagonal elements
            svmat Var
            rename Var* `v'_SE*
            replace `v'_SE1 = (sqrt(`v'_SE1))*100 .  // <- the Standard error of means 
            replace `v'_SE2 = (sqrt(`v'_SE2))*100
            replace `v'_SE3 = (sqrt(`v'_SE3))*100
            replace `v'_SE4 = (sqrt(`v'_SE4))*100
            replace `v'_SE5 = (sqrt(`v'_SE5))*100
            replace `v'_SE6 = (sqrt(`v'_SE6))*100    
            
            matrix N = e(N)
    Here are some results to compare. Is the SEMs from the SVY means if source==1 step so different from the tabstat if source==1 step
    simply because I wasn't actually accounting for survey correlations when I used tabstat or something else?

    Click image for larger version

Name:	Screen Shot 2018-08-22 at 6.31.31 PM.png
Views:	1
Size:	102.1 KB
ID:	1459318
    Click image for larger version

Name:	Screen Shot 2018-08-22 at 6.31.56 PM.png
Views:	1
Size:	182.3 KB
ID:	1459320
    Click image for larger version

Name:	Screen Shot 2018-08-22 at 6.31.40 PM.png
Views:	1
Size:	34.8 KB
ID:	1459319

  • #2
    To put it precisely, after using -svy: mean-, the square roots of the diagonal elements of e(V) are, indeed, the standard errors of the estimated means.

    More generally, after Stata regression commands, e(V) contains the estimated sampling covariance matrix of the estimates produced. The square roots of the diagonal elements will be the standard errors of the estimates in e(b). This is, in fact, the definition of standard error.

    This is very different from what you are seeing in the -tabstat- commands. With -tabstat- you are not accounting for the survey design. If you ran -mean- without the -svy- prefix, you would see that the results for mean and semean are the same as you get from -tabstat-.
    Last edited by Clyde Schechter; 23 Aug 2018, 10:22.

    Comment


    • #3
      That answers my question! Thank you so much, Clyde

      Comment

      Working...
      X