Announcement

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

  • Weighted mean with confidence interval

    Hello!

    I have calculated different proportion estimates with 95% confidence intervals. Now i want to calculate a mean of these different proportions with 95% confidence intervals. Also, when doing so, i want to weight the three different proportions according to my own liking.

    How do i do this?

    I have searched google, as well as through stata's search command. I found the CI command, but can't see how i can use this to my purpose. I am new to Stata and to statistics in general, and i know this question might be very basic to many on this forum. I hope however that someone would be willing to help me or point me in the right direction.

    Regards Adam

  • #2
    How you would go about this depends on the weights that you wish to apply, specifically what kind they are. The -ci- command supports both aweights and fweights. (Read the manual section on weights if you don't know what those are.) If your weights do not meet those descriptions, then you will not be able to use the -ci- command for your weighted mean of the means, but there is another way.

    So what kind of weights do you want to use?

    Comment


    • #3
      First of all, thank you very much for taking the time to reply.

      I don't think neither fweights nor aweights is the way to go. I am making a global prevalence estimate. I have calculated three proportion estimates and now I want to weight them according to the population sizes they represent.

      Maybe iweights is the way to go?
      Last edited by Adam Cohen; 23 Sep 2016, 09:31.

      Comment


      • #4
        I have calculated three proportion estimates and now I want to weight them according to the population sizes they represent.
        That is exactly what aweights are for.

        Comment


        • #5
          I reread the aweight description. However, I still can't seem to figure out how to feed the ci command my three estimates. I would think the SE of the three estimates should be fed to the command somehow, so that they are incorporated in the new calculation of the CI of the mean?

          Comment


          • #6
            I think we are not on the same wavelength here. Please post an example of your data and a more complete description of what you have done (including commands used and Stata's responses) and what you are trying to do.

            Comment


            • #7
              I have no doubt that it's me who hit the wrong wave. I installed and used the metaprop command. I am performing a meta analysis estimating global prevalence. I want to perform a random effects analysis stratified on three groups of studies and then weight them calculating a global estimate. I arranged all countries of the world and their respective population sizes in three different groups predefined. I registered studies, the number of tested, the number of positives as well as each study country group. I then ran: metaprop numerator denominator, random by(country-group) cinemethod(exact). This returned an overall estimate as well as subtotal estimates for each country group. Now I want to calculate global prevalence by weighting each subtotal estimate for each country group according to the summed country population size that each country group represent.

              Comment


              • #8
                OK. So this is rather different from what I had imagined, but now I understand it. In this case, it's a "hand" calculation. If the weights are w1, w2, and w3 (w1 + w2 + w3 = 1), and the means (proportions, in your case) are m1, m2, and m3 then, as I'm sure you know, the weighted mean is w1*m1 + w2*m2 + w3*m3. Now, if the three standard errors of those three means are s1, s2, and s3, the standard error of the weighted mean is sqrt( (w1*s1)^2 + (w2*s2)^2 + (w3*s3)^2). And then you can get your CI as the usual weighted mean plus or minus 1.96 times its standard error.

                If your data justify better precision than 1.96, you can use invnormal(0.975) instead. If your original CIs were t- rather than z-based, then the degrees of freedom for the standard error of the weighted mean is the sum of those three degrees of freedom, and you would replace 1.96 by the corresponding value of invt(df, 0.975).

                Comment


                • #9
                  Addendum to #8.

                  To clarify, when I say it is a "hand" calculation, I mean that there is, so far as I know, no built-in or user-written program that does this. It doesn't mean you have to whip out a pocket calculator. You can do the calculations as evaluation of a scalar or a local macro, or even with the -display- command.

                  Comment


                  • #10
                    Thank you very much for your help! It is greatly appreciated!

                    Comment

                    Working...
                    X