Announcement

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

  • svy: how to get mean and standard deviation

    Hey all

    I am trying to get the mean and the standard deviation from a variable. I know how to do it without svy:
    Code:
    sum lnhourly    if    immigrant==1
    
    Variable        Obs    Mean    Std. Dev.    Min    Max
                            
    lnhourlyw        42,245    3.654568    .4636835    2.620039    5.012237
    But i am not getting it, if I want to use svy (pweight) command. I can only get the mean, but not the standard deviation:

    Code:
     svy: mean lnhourly if immigrant==1
    (running mean on estimation sample)
    
    Survey: Mean estimation
    
    Number of strata =       1        Number of obs   =     42,245
    Number of PSUs   =  42,245        Population size =  3,184,865
                                      Design df       =     42,244
    
    --------------------------------------------------------------
                 |             Linearized
                 |       Mean   Std. Err.     [95% Conf. Interval]
    -------------+------------------------------------------------
       lnhourlyw |   3.610175   .0025817      3.605115    3.615235

  • #2
    Try running

    Code:
    estat sd
    after the svy: mean command.

    For more, see the postestimation commands for svy.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thank you very much, Sir!

      Comment


      • #4
        Hi everybody, after svy: logit, I write mfx. How STATA compute the mean of the varlist un the output of margins after svy:logit?. Exactly how could I get the means of each one of the variables of the margins output if I want to get the means by myself with pencil and calculador?
        Last edited by david pinchao; 13 Oct 2019, 16:35.

        Comment


        • #5
          David, welcome to Statalist.

          Unless you have a horribly antiquated version of Stata, you should NOT use mfx. Use margins instead. See

          https://www3.nd.edu/~rwilliam/xsoc73994/Margins01.pdf

          It sounds like you want to use the atmeans option of margins. I don't recommend it, but you can do it. Use code like

          Code:
          webuse nhanes2f, clear
          svy: logit diabetes height weight i.black
          margins black, atmeans
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://www3.nd.edu/~rwilliam

          Comment


          • #6
            Good afternoon,
            I type this svy,subpop(Urbano):logistic T_Cuenta i.EscoMS i.EscoS i.Ingreso i.Celular i.RegistroIyG
            and the output show:" Note: 51 strata omitted because they contain no subpopulation members."
            I would like to get the margins with: margins Ingreso, vce(unconditional) or maybe with margins, vce(unconditional)
            but I have this answer : missing predicted values encountered within the estimation sample
            How could I get the margins in this situation if Iam working with svy,subpop(Urbano):logistic T_Cuenta i.EscoMS i.EscoS i.Ingreso i.Celular i.RegistroIyG ?


            Comment


            • #7
              Dear all,

              I have a very similar question to Anshul Anand, so I thought it makes most sense to post my question in this group. I am trying to calculate standard deviations using svy (pweight). As suggested in this group I should use "estat sd" after running the "svy: mean command". Here is my code:

              Code:
               svy, subpop(if numparticipants>0 & internetuser==1): mean divopinions
              Code:
               estat sd
              After running estat sd I get the error message: "estat sd is not allowed with poststratification r(322)". Looking through the stata menu I could not find what command I should use for postratifaction weights. Is it simply not possible to calculate standard deviations for poststratification weights?



              Comment

              Working...
              X